babylonchain / staking-indexer

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

hotfix: Potential out-of-memory issue during bootstrapping #132

Closed gitferry closed 4 months ago

gitferry commented 4 months ago

This PR fixed #130 by batching confirmed blocks for each update. Some notable changes:

  1. introduce ConfirmedBlockBatchSize as a package level constant.
  2. call commitChainUpdate once the size of confirmedBlocks reached ConfirmedBlockBatchSize
  3. for each chain update, change the unconfirmed tip to unconfirmed blocks, which will be used as the parameter of the processUnconfirmedInfo. This is to ensure the unconfirmed blocks will not be affected across each update.