From 37c4fba1f4c18632bceb16f41f5a8f1a61fb9096 Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Tue, 26 Aug 2025 00:21:24 +0100 Subject: [PATCH] index: Check BIP30 blocks when rewinding Coinstatsindex This is practically irrelevant due to the unlikeliness of a re-org reaching so deep that it would drop the BIP30 blocks from the chain (91842 and 91880). However this serves as documentation and ensures that the functions RevertBlock and CustomAppend are consistent. --- src/index/coinstatsindex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp index e4daf9ef425..24b1837bb09 100644 --- a/src/index/coinstatsindex.cpp +++ b/src/index/coinstatsindex.cpp @@ -426,6 +426,10 @@ bool CoinStatsIndex::RevertBlock(const interfaces::BlockInfo& block) const auto& tx{block.data->vtx.at(i)}; const bool is_coinbase{tx->IsCoinBase()}; + if (is_coinbase && IsBIP30Unspendable(block.hash, block.height)) { + continue; + } + for (uint32_t j = 0; j < tx->vout.size(); ++j) { const CTxOut& out{tx->vout[j]}; const COutPoint outpoint{tx->GetHash(), j};