diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-03-24 14:27:08 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2022-03-24 14:27:13 +0100 |
commit | 4a0ab355b3e7e7a3fae218fb5d9894fb7f3636a5 (patch) | |
tree | 0b1c58a371efc80968fff8b1030b859e8788134d /src/rpc/util.h | |
parent | 7d0e42abce9dd7c0f192928e909a98278a70dd3d (diff) | |
parent | b2813980b81034ff9b40bd45080fa67dea475d39 (diff) |
Merge bitcoin/bitcoin#24626: init: disallow reindex-chainstate when pruning
b2813980b81034ff9b40bd45080fa67dea475d39 init: disallow reindex-chainstate when pruning (Martin Zumsande)
Pull request description:
The combination of `-reindex-chainstate` and `-prune` currently makes the node stuck in an endless loop:
- `LoadChainstate()` will wipe the existing chainstate (so we have no genesis block anymore). It won't clean up unusable block files by calling `CleanupBlockRevFiles()` as for full `-reindex`.
- `ThreadImport()` has [logic](https://github.com/bitcoin/bitcoin/blob/91d12344b1e51809c1ef6b630b631a6da00267c3/src/node/blockstorage.cpp#L855) of reloading Genesis after reindexing. This is what makes full `-reindex` work with `-prune` but it's not executed for `-reindex-chainstate`.
- Since we still don't have a genesis block, init will wait for it forever in an endless loop ([code](https://github.com/bitcoin/bitcoin/blob/91d12344b1e51809c1ef6b630b631a6da00267c3/src/init.cpp#L1630-L1640)).
Fix this by disallowing `-reindex-chainstate` together with `-prune`. This is discouraged in the help for `-reindex-chainstate` anyway ("When in pruning mode or if blocks on disk might be corrupted, use full -reindex instead.") but wasn't enforced.
Fixes #24242
ACKs for top commit:
MarcoFalke:
cr ACK b2813980b81034ff9b40bd45080fa67dea475d39
Tree-SHA512: 7220842daaf9a4f972d82b13b81fdeac2833bf5e665c5b0f8eaf6a4bcd0725c8e97d19ec956ca4b730065a983475bb3a2732713d338f4caf8666ccbf63d4d988
Diffstat (limited to 'src/rpc/util.h')
0 files changed, 0 insertions, 0 deletions