Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trie/*: golint iterator fixes #16639

Merged
merged 1 commit into from
May 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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