diff --git a/src/validation.cpp b/src/validation.cpp index cf8a3211a8..8eaa5ab073 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1755,6 +1755,13 @@ static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& s // move best block pointer to prevout block view.SetBestBlock(pindex->pprev->GetBlockHash()); + if (fSpentIndex) { + if (!pblocktree->UpdateSpentIndex(spentIndex)) { + AbortNode("Failed to delete spent index"); + return DISCONNECT_FAILED; + } + } + if (fAddressIndex) { if (!pblocktree->EraseAddressIndex(addressIndex)) { AbortNode(state, "Failed to delete address index");