babylonchain / staking-indexer

A tool that extracts BTC staking relevant data from the Bitcoin blockchain
Other
3 stars 4 forks source link

hotfix: Fix bootstrapping isSync reset #109

Closed gitferry closed 4 months ago

gitferry commented 4 months ago

This PR fixed a bug which might cause skipping processing unconfirmed blocks.

During bootstrapping, isSynced should be set to true before calling commitChainUpdate even though we have defer isSynced.Store(true). Otherwise, there's a small chance that defer isSynced.Store(true) is called after chainUpdated is processed, and the unconfirmed block will not be processed (requiring isSynced to be true)