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.
This commit is contained in:
Fabian Jahr 2025-08-26 00:21:24 +01:00
parent 51df9de8e5
commit 37c4fba1f4
No known key found for this signature in database
GPG Key ID: F13D1E9D890798CD

View File

@ -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};