trie: add start key to NodeIterator constructors

The 'step' method is split into two parts, 'peek' and 'push'. peek
returns the next state but doesn't make it current.

The end of iteration was previously tracked by setting 'trie' to nil.
End of iteration is now tracked using the 'iteratorEnd' error, which is
slightly cleaner and requires less code.
This commit is contained in:
Felix Lange
2017-04-13 14:41:24 +02:00
parent a13e920af0
commit 4047ccad2f
9 changed files with 148 additions and 75 deletions

View File

@ -80,7 +80,7 @@ func checkTrieConsistency(db Database, root common.Hash) error {
if err != nil {
return nil // // Consider a non existent state consistent
}
it := trie.NodeIterator()
it := trie.NodeIterator(nil)
for it.Next(true) {
}
return it.Error()