Skip to content

Commit eef5955

Browse files
committed
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.
1 parent 8e0d979 commit eef5955

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index/coinstatsindex.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ bool CoinStatsIndex::CustomRewind(const interfaces::BlockKey& current_tip, const
288288
__func__, iter_tip->GetBlockHash().ToString());
289289
}
290290

291-
ReverseBlock(block, iter_tip);
291+
if (!ReverseBlock(block, iter_tip)) {
292+
return false; // failure cause logged internally
293+
}
292294

293295
iter_tip = iter_tip->GetAncestor(iter_tip->nHeight - 1);
294296
} while (new_tip_index != iter_tip);

0 commit comments

Comments
 (0)