| 3024 | return true; |
| 3025 | } |
| 3026 | bool FinalizeBlockAndInvalidate(CValidationState &state, CBlockIndex *pindex) { |
| 3027 | AssertLockHeld(cs_main); |
| 3028 | if (!FinalizeBlockInternal(state, pindex)) { |
| 3029 | // state is set by FinalizeBlockInternal. |
| 3030 | return false; |
| 3031 | } |
| 3032 | |
| 3033 | // If the finalized block is not on the active chain, we may need to rewind. |
| 3034 | if (!chainActive.Contains(pindex)) { |
| 3035 | const CBlockIndex *pindexFork = chainActive.FindFork(pindex); |
| 3036 | CBlockIndex *pindexToInvalidate = chainActive.Next(pindexFork); |
| 3037 | if (pindexToInvalidate) { |
| 3038 | return InvalidateBlock(state, Params(), pindexToInvalidate); |
| 3039 | } |
| 3040 | } |
| 3041 | |
| 3042 | return true; |
| 3043 | } |
| 3044 | |
| 3045 | bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex) { |
| 3046 | return g_chainstate.InvalidateBlock(state, chainparams, pindex); |
no test coverage detected