diff options
author | Eli <elihanover@yahoo.com> | 2018-05-02 16:24:34 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-05-02 16:24:34 +0800 |
commit | 4a8d5d2b1e6e78550ebc3495d9d87787dedadb20 (patch) | |
tree | a6ced67814cd3e39afc9aa993f795f87455b302f /trie/iterator.go | |
parent | d76c5ca532bfeba5469ed42985630116a1f41ebe (diff) | |
download | dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.tar dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.tar.gz dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.tar.bz2 dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.tar.lz dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.tar.xz dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.tar.zst dexon-4a8d5d2b1e6e78550ebc3495d9d87787dedadb20.zip |
trie: golint iterator fixes (#16639)
Diffstat (limited to 'trie/iterator.go')
-rw-r--r-- | trie/iterator.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/trie/iterator.go b/trie/iterator.go index 76146c0d6..3bae8e186 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -303,7 +303,7 @@ func (it *nodeIterator) push(state *nodeIteratorState, parentIndex *int, path [] it.path = path it.stack = append(it.stack, state) if parentIndex != nil { - *parentIndex += 1 + *parentIndex++ } } @@ -380,7 +380,7 @@ func (it *differenceIterator) Next(bool) bool { if !it.b.Next(true) { return false } - it.count += 1 + it.count++ if it.eof { // a has reached eof, so we just return all elements from b @@ -395,7 +395,7 @@ func (it *differenceIterator) Next(bool) bool { it.eof = true return true } - it.count += 1 + it.count++ case 1: // b is before a return true @@ -405,12 +405,12 @@ func (it *differenceIterator) Next(bool) bool { if !it.b.Next(hasHash) { return false } - it.count += 1 + it.count++ if !it.a.Next(hasHash) { it.eof = true return true } - it.count += 1 + it.count++ } } } @@ -504,14 +504,14 @@ func (it *unionIterator) Next(descend bool) bool { skipped := heap.Pop(it.items).(NodeIterator) // Skip the whole subtree if the nodes have hashes; otherwise just skip this node if skipped.Next(skipped.Hash() == common.Hash{}) { - it.count += 1 + it.count++ // If there are more elements, push the iterator back on the heap heap.Push(it.items, skipped) } } if least.Next(descend) { - it.count += 1 + it.count++ heap.Push(it.items, least) } |