Closed christroutner closed 2 years ago
Every time you call tryResync
it runs the internal __resync
which will delete any non-active tips from all indexes recursively, one block at a time.
While it's doing that recursion, this.syncing
is true.
So as long as you don't rely on the data while this.syncing
is true, you will be fine (you won't catch it in the middle of reorg deletion and insertion.
https://github.com/bitcoinjs/indexd/blob/b9e503daf8edc3e0f4d01dd307665c48fcabb744/index.js#L195-L203
Is there any code or documentation around block reorgs and how indexd handles them? I'm referring to the types of block reorgs illustrated in this technical explanation.
I'm just starting to look through the code and get the indexer running. If there are specific places in the code that handle re-orgs, please drop some links.