aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-06 23:44:19 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-06 23:44:19 +0800
commit7baa5977c8c4b1608c2a23615143da414a638b5c (patch)
tree96911d3cf503bafae5b7b5ffd06245766912950e /trie/trie.go
parent82ef26f6007986debd6ce082f57050f0c7e36006 (diff)
parentc1d516546d221de898ddeb12a77477d992d125df (diff)
downloadgo-tangerine-7baa5977c8c4b1608c2a23615143da414a638b5c.tar.gz
go-tangerine-7baa5977c8c4b1608c2a23615143da414a638b5c.tar.zst
go-tangerine-7baa5977c8c4b1608c2a23615143da414a638b5c.zip
Merge pull request #1594 from ebuchman/trie_hex_fix
faster hex-prefix codec and string -> []byte
Diffstat (limited to 'trie/trie.go')
-rw-r--r--trie/trie.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/trie/trie.go b/trie/trie.go
index e7ee86402..abf48a850 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -69,7 +69,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 +131,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 +149,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 +164,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 +336,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 {