diff --git a/src/main.cpp b/src/main.cpp index 4d6872d2d..b061383ef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2152,6 +2152,14 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI } + // move best block pointer to prevout block + view.SetBestBlock(pindex->pprev->GetBlockHash()); + + if (pfClean) { + *pfClean = fClean; + return true; + } + if (fAddressIndex) { if (!pblocktree->EraseAddressIndex(addressIndex)) { return AbortNode(state, "Failed to delete address index"); @@ -2161,14 +2169,6 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI } } - // move best block pointer to prevout block - view.SetBestBlock(pindex->pprev->GetBlockHash()); - - if (pfClean) { - *pfClean = fClean; - return true; - } - return fClean; }