0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-04 13:55:23 -05:00

index: coinstats reorg, fail when block cannot be reversed

During a reorg, continuing execution when a block cannot be
reversed leaves the coinstats index in an inconsistent state,
which was surely overlooked when 'CustomRewind' was implemented.
This commit is contained in:
furszy 2023-09-07 11:40:41 -03:00
parent 8e0d9796da
commit eef595560e
No known key found for this signature in database
GPG key ID: 5DD23CCC686AA623

View file

@ -288,7 +288,9 @@ bool CoinStatsIndex::CustomRewind(const interfaces::BlockKey& current_tip, const
__func__, iter_tip->GetBlockHash().ToString());
}
ReverseBlock(block, iter_tip);
if (!ReverseBlock(block, iter_tip)) {
return false; // failure cause logged internally
}
iter_tip = iter_tip->GetAncestor(iter_tip->nHeight - 1);
} while (new_tip_index != iter_tip);