diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-16 23:36:58 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-16 23:36:58 +0800 |
commit | 0dd9ac375b20fc597e205225db819e8847bcf971 (patch) | |
tree | dc63d665edf225977148e8c75f1626f3995b689f /trie/iterator.go | |
parent | d338650089d7a01983c3a853d2f917243c4de064 (diff) | |
download | dexon-0dd9ac375b20fc597e205225db819e8847bcf971.tar dexon-0dd9ac375b20fc597e205225db819e8847bcf971.tar.gz dexon-0dd9ac375b20fc597e205225db819e8847bcf971.tar.bz2 dexon-0dd9ac375b20fc597e205225db819e8847bcf971.tar.lz dexon-0dd9ac375b20fc597e205225db819e8847bcf971.tar.xz dexon-0dd9ac375b20fc597e205225db819e8847bcf971.tar.zst dexon-0dd9ac375b20fc597e205225db819e8847bcf971.zip |
undo
Diffstat (limited to 'trie/iterator.go')
-rw-r--r-- | trie/iterator.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/trie/iterator.go b/trie/iterator.go index aff614f95..fda7c6cbe 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -2,19 +2,17 @@ package trie import ( "bytes" - - "github.com/ethereum/go-ethereum/common" ) type Iterator struct { trie *Trie - Key common.Hash + Key []byte Value []byte } func NewIterator(trie *Trie) *Iterator { - return &Iterator{trie: trie} + return &Iterator{trie: trie, Key: nil} } func (self *Iterator) Next() bool { @@ -22,15 +20,15 @@ func (self *Iterator) Next() bool { defer self.trie.mu.Unlock() isIterStart := false - if (self.Key == common.Hash{}) { + if self.Key == nil { isIterStart = true - //self.Key = make([]byte, 32) + self.Key = make([]byte, 32) } - key := RemTerm(CompactHexDecode(self.Key.Str())) + key := RemTerm(CompactHexDecode(string(self.Key))) k := self.next(self.trie.root, key, isIterStart) - self.Key = common.StringToHash(DecodeCompact(k)) + self.Key = []byte(DecodeCompact(k)) return len(k) > 0 } |