aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie.go
diff options
context:
space:
mode:
Diffstat (limited to 'trie/trie.go')
-rw-r--r--trie/trie.go22
1 files changed, 12 insertions, 10 deletions
diff --git a/trie/trie.go b/trie/trie.go
index 30c2569fa..2970bc185 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -1,18 +1,18 @@
// Copyright 2014 The go-ethereum Authors
-// This file is part of go-ethereum.
+// This file is part of the go-ethereum library.
//
-// go-ethereum is free software: you can redistribute it and/or modify
+// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
-// go-ethereum is distributed in the hope that it will be useful,
+// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
-// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
+// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// Package trie implements Merkle Patricia Tries.
package trie
@@ -27,6 +27,8 @@ import (
"github.com/ethereum/go-ethereum/crypto"
)
+var StatePre = []byte("state-")
+
func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) {
t2 := New(nil, backend)
@@ -69,7 +71,7 @@ func (self *Trie) Iterator() *Iterator {
func (self *Trie) Copy() *Trie {
cpy := make([]byte, 32)
- copy(cpy, self.roothash)
+ copy(cpy, self.roothash) // NOTE: cpy isn't being used anywhere?
trie := New(nil, nil)
trie.cache = self.cache.Copy()
if self.root != nil {
@@ -131,7 +133,7 @@ func (self *Trie) Update(key, value []byte) Node {
self.mu.Lock()
defer self.mu.Unlock()
- k := CompactHexDecode(string(key))
+ k := CompactHexDecode(key)
if len(value) != 0 {
node := NewValueNode(self, value)
@@ -149,7 +151,7 @@ func (self *Trie) Get(key []byte) []byte {
self.mu.Lock()
defer self.mu.Unlock()
- k := CompactHexDecode(string(key))
+ k := CompactHexDecode(key)
n := self.get(self.root, k)
if n != nil {
@@ -164,7 +166,7 @@ func (self *Trie) Delete(key []byte) Node {
self.mu.Lock()
defer self.mu.Unlock()
- k := CompactHexDecode(string(key))
+ k := CompactHexDecode(key)
self.root = self.delete(self.root, k)
return self.root
@@ -336,7 +338,7 @@ func (self *Trie) mknode(value *common.Value) Node {
case 2:
// A value node may consists of 2 bytes.
if value.Get(0).Len() != 0 {
- key := CompactDecode(string(value.Get(0).Bytes()))
+ key := CompactDecode(value.Get(0).Bytes())
if key[len(key)-1] == 16 {
return NewShortNode(self, key, NewValueNode(self, value.Get(1).Bytes()))
} else {