diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2023-05-17 13:26:44 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-05-17 13:27:31 -0400 |
commit | 4e8a7654f623fc0dad933b3d93dc54d8206c605d (patch) | |
tree | a5f5056ea6825feb4b22e3533cd43025b29c4932 /configure.ac | |
parent | 594f05db19fa2eaf6705f13bb0e147bce6ac21e5 (diff) | |
parent | 97844d9268b87b5d09b1091bfd0326ed18ce5b91 (diff) |
Merge bitcoin/bitcoin#25193: indexes: Read the locator's top block during init, allow interaction with reindex-chainstate
97844d9268b87b5d09b1091bfd0326ed18ce5b91 index: Enable reindex-chainstate with active indexes (Martin Zumsande)
60bec3c82d09ec208bf0028ad32499e251ad205e index: Use first block from locator instead of looking for fork point (Martin Zumsande)
Pull request description:
This makes two improvements to the index init phase:
**1) Prevent index corruption in case a reorg happens when the index was switched off**:
This is done by reading in the top block stored in the locator instead of looking for a fork point already in `BaseIndex::Init()`.
Before, we'd just go back to the fork point by calling `FindForkInGlobalIndex()`, which would have corrupted the coinstatsindex because its saved muhash needs to be reverted step by step by un-applying all blocks in between, which wasn't done before. This is now being done a bit later in `ThreadSync()`, which has existing logic to call the custom `Rewind()` method when going back along the chain to the forking point (thanks ryanofsky for pointing this out to me!).
**2) Allow using the `-reindex-chainstate` option without needing to disabling indexes**:
With `BaseIndex::Init()` not calling `FindForkInGlobalIndex()` anymore, we can allow `reindex-chainstate` with active indexes. `reindex-chainstate` deletes the chain and rebuilds it later in `ThreadImport`, so there is no chain available during `BaseIndex::Init()`, which would lead to problems (see #24789).
But now we'll only need the chain a bit later in `BaseIndex::ThreadSync`, which will wait for the reindex-chainstate in `ThreadImport` to finish and will continue syncing after that.
ACKs for top commit:
ryanofsky:
Code review ACK 97844d9268b87b5d09b1091bfd0326ed18ce5b91. Just simple rebase since last review
Tree-SHA512: e24973fc22e0b87a49026f4820aecb0a4e415f4d381bade9969dd31cf97afecfea0449dce7fcc797343b792199cc8287276d1f5ffa4433dcb54fb24a808db6fb
Diffstat (limited to 'configure.ac')
0 files changed, 0 insertions, 0 deletions