diff options
author | Felix Lange <fjl@twurst.com> | 2017-04-13 20:41:24 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2017-04-25 08:14:31 +0800 |
commit | 4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f (patch) | |
tree | 702ff4ccb7e70b4f9a063df145a13d2d54ad1292 /trie/secure_trie.go | |
parent | a13e920af01692cb07a520cda688f1cc5b5469dd (diff) | |
download | go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.tar go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.tar.gz go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.tar.bz2 go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.tar.lz go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.tar.xz go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.tar.zst go-tangerine-4047ccad2fb73fd2cfd69bf5b8cbfa788871ce0f.zip |
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.
Diffstat (limited to 'trie/secure_trie.go')
-rw-r--r-- | trie/secure_trie.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/trie/secure_trie.go b/trie/secure_trie.go index 201716d18..37d1d4b09 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -156,8 +156,10 @@ func (t *SecureTrie) Root() []byte { return t.trie.Root() } -func (t *SecureTrie) NodeIterator() NodeIterator { - return t.trie.NodeIterator() +// NodeIterator returns an iterator that returns nodes of the underlying trie. Iteration +// starts at the key after the given start key. +func (t *SecureTrie) NodeIterator(start []byte) NodeIterator { + return t.trie.NodeIterator(start) } // CommitTo writes all nodes and the secure hash pre-images to the given database. |