Actually update spent index on DisconnectBlock (#3167)

Fixes #3166
This commit is contained in:
UdjinM6 2019-10-23 10:55:44 +03:00 committed by Alexander Block
parent 9b49bfda81
commit ce66871308

View File

@ -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");