diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2023-09-07 11:40:41 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2023-09-07 12:15:34 -0300 |
commit | eef595560e9ecf3a0d1db4d8ea7ecc33a49d839f (patch) | |
tree | a40946bf4e5a8894e625ca7fb23bc71391ddb5bf | |
parent | 8e0d9796da8cfb6c4e918788a03eea125d0633a6 (diff) | |
download | bitcoin-eef595560e9ecf3a0d1db4d8ea7ecc33a49d839f.tar.xz |
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.
-rw-r--r-- | src/index/coinstatsindex.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index d80885f842..30a4d52a34 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -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); |