Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
feat(pkg): improve BlockBatchIterator (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Mar 6, 2023
1 parent 6c85058 commit 4fab06a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/chain_iterator/block_batch_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ func (i *BlockBatchIterator) ensureCurrentNotReorged() error {

// Reorg detected, rewind back `ReorgRewindDepth` blocks
var newCurrentHeight uint64
if current.Number.Uint64() <= ReorgRewindDepth {
if i.current.Number.Uint64() <= ReorgRewindDepth {
newCurrentHeight = 0
} else {
newCurrentHeight = current.Number.Uint64() - ReorgRewindDepth
newCurrentHeight = i.current.Number.Uint64() - ReorgRewindDepth
}

i.current, err = i.client.HeaderByNumber(i.ctx, new(big.Int).SetUint64(newCurrentHeight))
Expand Down

0 comments on commit 4fab06a

Please sign in to comment.