Skip to content

Commit

Permalink
trie: golint iterator fixes (ethereum#16639)
Browse files Browse the repository at this point in the history
  • Loading branch information
roveneliah authored and firmianavan committed Aug 28, 2018
1 parent 11de507 commit 0b925b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions trie/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
}
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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++
}
}
}
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 0b925b7

Please sign in to comment.