aboutsummaryrefslogtreecommitdiffstats
path: root/trie/iterator.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-16 23:28:16 +0800
committerobscuren <geffobscura@gmail.com>2015-03-16 23:28:16 +0800
commitd338650089d7a01983c3a853d2f917243c4de064 (patch)
tree6c7852e9e75c4ba1ff476f4c77e25adfae135e35 /trie/iterator.go
parent20b7162a6206e61a39d799a5adf84379c9c8c818 (diff)
downloaddexon-d338650089d7a01983c3a853d2f917243c4de064.tar
dexon-d338650089d7a01983c3a853d2f917243c4de064.tar.gz
dexon-d338650089d7a01983c3a853d2f917243c4de064.tar.bz2
dexon-d338650089d7a01983c3a853d2f917243c4de064.tar.lz
dexon-d338650089d7a01983c3a853d2f917243c4de064.tar.xz
dexon-d338650089d7a01983c3a853d2f917243c4de064.tar.zst
dexon-d338650089d7a01983c3a853d2f917243c4de064.zip
compilable trie (tests fail)
Diffstat (limited to 'trie/iterator.go')
-rw-r--r--trie/iterator.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/trie/iterator.go b/trie/iterator.go
index fda7c6cbe..aff614f95 100644
--- a/trie/iterator.go
+++ b/trie/iterator.go
@@ -2,17 +2,19 @@ package trie
import (
"bytes"
+
+ "github.com/ethereum/go-ethereum/common"
)
type Iterator struct {
trie *Trie
- Key []byte
+ Key common.Hash
Value []byte
}
func NewIterator(trie *Trie) *Iterator {
- return &Iterator{trie: trie, Key: nil}
+ return &Iterator{trie: trie}
}
func (self *Iterator) Next() bool {
@@ -20,15 +22,15 @@ func (self *Iterator) Next() bool {
defer self.trie.mu.Unlock()
isIterStart := false
- if self.Key == nil {
+ if (self.Key == common.Hash{}) {
isIterStart = true
- self.Key = make([]byte, 32)
+ //self.Key = make([]byte, 32)
}
- key := RemTerm(CompactHexDecode(string(self.Key)))
+ key := RemTerm(CompactHexDecode(self.Key.Str()))
k := self.next(self.trie.root, key, isIterStart)
- self.Key = []byte(DecodeCompact(k))
+ self.Key = common.StringToHash(DecodeCompact(k))
return len(k) > 0
}