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

@ -118,7 +118,7 @@ func (it *NodeIterator) step() error {
if err != nil {
return err
}
it.dataIt = trie.NewNodeIterator(dataTrie)
it.dataIt = dataTrie.NodeIterator()
if !it.dataIt.Next(true) {
it.dataIt = nil
}