main: don't undo indexes when verifying blocks at startup

This commit is contained in:
Braydon Fuller 2016-03-30 12:50:10 -04:00 committed by Simon
parent 4725b25e60
commit 6107ae66d2
1 changed files with 8 additions and 8 deletions

View File

@ -2380,6 +2380,14 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
view.PopAnchor(blockUndo.old_tree_root); view.PopAnchor(blockUndo.old_tree_root);
// move best block pointer to prevout block
view.SetBestBlock(pindex->pprev->GetBlockHash());
if (pfClean) {
*pfClean = fClean;
return true;
}
if (fAddressIndex) { if (fAddressIndex) {
if (!pblocktree->EraseAddressIndex(addressIndex)) { if (!pblocktree->EraseAddressIndex(addressIndex)) {
return AbortNode(state, "Failed to delete address index"); return AbortNode(state, "Failed to delete address index");
@ -2389,14 +2397,6 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
} }
} }
// move best block pointer to prevout block
view.SetBestBlock(pindex->pprev->GetBlockHash());
if (pfClean) {
*pfClean = fClean;
return true;
}
return fClean; return fClean;
} }