forked from cerc-io/plugeth
trie: golint iterator fixes (#16639)
This commit is contained in:
parent
d76c5ca532
commit
4a8d5d2b1e
@ -303,7 +303,7 @@ func (it *nodeIterator) push(state *nodeIteratorState, parentIndex *int, path []
|
|||||||
it.path = path
|
it.path = path
|
||||||
it.stack = append(it.stack, state)
|
it.stack = append(it.stack, state)
|
||||||
if parentIndex != nil {
|
if parentIndex != nil {
|
||||||
*parentIndex += 1
|
*parentIndex++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ func (it *differenceIterator) Next(bool) bool {
|
|||||||
if !it.b.Next(true) {
|
if !it.b.Next(true) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
it.count += 1
|
it.count++
|
||||||
|
|
||||||
if it.eof {
|
if it.eof {
|
||||||
// a has reached eof, so we just return all elements from b
|
// 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
|
it.eof = true
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
it.count += 1
|
it.count++
|
||||||
case 1:
|
case 1:
|
||||||
// b is before a
|
// b is before a
|
||||||
return true
|
return true
|
||||||
@ -405,12 +405,12 @@ func (it *differenceIterator) Next(bool) bool {
|
|||||||
if !it.b.Next(hasHash) {
|
if !it.b.Next(hasHash) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
it.count += 1
|
it.count++
|
||||||
if !it.a.Next(hasHash) {
|
if !it.a.Next(hasHash) {
|
||||||
it.eof = true
|
it.eof = true
|
||||||
return 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)
|
skipped := heap.Pop(it.items).(NodeIterator)
|
||||||
// Skip the whole subtree if the nodes have hashes; otherwise just skip this node
|
// Skip the whole subtree if the nodes have hashes; otherwise just skip this node
|
||||||
if skipped.Next(skipped.Hash() == common.Hash{}) {
|
if skipped.Next(skipped.Hash() == common.Hash{}) {
|
||||||
it.count += 1
|
it.count++
|
||||||
// If there are more elements, push the iterator back on the heap
|
// If there are more elements, push the iterator back on the heap
|
||||||
heap.Push(it.items, skipped)
|
heap.Push(it.items, skipped)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if least.Next(descend) {
|
if least.Next(descend) {
|
||||||
it.count += 1
|
it.count++
|
||||||
heap.Push(it.items, least)
|
heap.Push(it.items, least)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user