Skip to content

Commit

Permalink
Merge pull request #154 from kaleido-io/handle-duplicate-block-number
Browse files Browse the repository at this point in the history
Handle duplicate block number in the same getFilterChanges call
  • Loading branch information
Chengxuan authored Sep 5, 2024
2 parents 102fac7 + 81c455f commit 81ea8f3
Show file tree
Hide file tree
Showing 2 changed files with 388 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/ethereum/blocklistener.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ func (bl *blockListener) listenLoop() {
failCount++
continue
}
log.L(bl.ctx).Debugf("Block filter received new block hashes: %+v", blockHashes)

update := &ffcapi.BlockHashEvent{GapPotential: gapPotential, Created: fftypes.Now()}
var notifyPos *list.Element
Expand Down Expand Up @@ -230,7 +231,7 @@ func (bl *blockListener) listenLoop() {
default:
candidate := bl.reconcileCanonicalChain(bi)
// Check this is the lowest position to notify from
if candidate != nil && (notifyPos == nil || candidate.Value.(*minimalBlockInfo).number < notifyPos.Value.(*minimalBlockInfo).number) {
if candidate != nil && (notifyPos == nil || candidate.Value.(*minimalBlockInfo).number <= notifyPos.Value.(*minimalBlockInfo).number) {
notifyPos = candidate
}
}
Expand Down
Loading

0 comments on commit 81ea8f3

Please sign in to comment.