| 4506 | } |
| 4507 | |
| 4508 | bool 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 | |
| 4527 | void CChainState::UnloadBlockIndex() { |
| 4528 | nBlockSequenceId = 1; |
no test coverage detected