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:
@ -125,9 +125,10 @@ func New(root common.Hash, db Database) (*Trie, error) {
|
||||
return trie, nil
|
||||
}
|
||||
|
||||
// Iterator returns an iterator over all mappings in the trie.
|
||||
func (t *Trie) NodeIterator() NodeIterator {
|
||||
return newNodeIterator(t)
|
||||
// NodeIterator returns an iterator that returns nodes of the trie. Iteration starts at
|
||||
// the key after the given start key.
|
||||
func (t *Trie) NodeIterator(start []byte) NodeIterator {
|
||||
return newNodeIterator(t, start)
|
||||
}
|
||||
|
||||
// Get returns the value for key stored in the trie.
|
||||
|
Reference in New Issue
Block a user