MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / RewindBlockIndex

Function RewindBlockIndex

src/validation.cpp:4508–4525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4506}
4507
4508bool RewindBlockIndex(const CChainParams& params) {
4509 if (!g_chainstate.RewindBlockIndex(params)) {
4510 return false;
4511 }
4512
4513 if (chainActive.Tip() != nullptr) {
4514 // FlushStateToDisk can possibly read chainActive. Be conservative
4515 // and skip it here, we're about to -reindex-chainstate anyway, so
4516 // it'll get called a bunch real soon.
4517 CValidationState state;
4518 if (!FlushStateToDisk(params, state, FlushStateMode::ALWAYS)) {
4519 LogPrintf("RewindBlockIndex: unable to flush state to disk (%s)\n", FormatStateMessage(state));
4520 return false;
4521 }
4522 }
4523
4524 return true;
4525}
4526
4527void CChainState::UnloadBlockIndex() {
4528 nBlockSequenceId = 1;

Callers 1

AppInitMainFunction · 0.85

Calls 4

FlushStateToDiskFunction · 0.85
FormatStateMessageFunction · 0.85
RewindBlockIndexMethod · 0.80
TipMethod · 0.45

Tested by

no test coverage detected