trie: clean up iterator constructors

Make it so each iterator has exactly one public constructor:

- NodeIterators can be created through a method.
- Iterators can be created through NewIterator on any NodeIterator.
This commit is contained in:
Felix Lange
2017-04-18 13:37:10 +02:00
parent f958d7d482
commit a13e920af0
9 changed files with 21 additions and 31 deletions

View File

@ -126,8 +126,8 @@ func New(root common.Hash, db Database) (*Trie, error) {
}
// Iterator returns an iterator over all mappings in the trie.
func (t *Trie) Iterator() *Iterator {
return NewIterator(t)
func (t *Trie) NodeIterator() NodeIterator {
return newNodeIterator(t)
}
// Get returns the value for key stored in the trie.