diff --git a/src/validation.cpp b/src/validation.cpp index 6d87ab88b3..ffad7e8402 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1851,6 +1851,7 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI const CTransaction &tx = *(block.vtx[i]); uint256 hash = tx.GetHash(); bool is_coinbase = tx.IsCoinBase(); + bool is_bip30_exception = (is_coinbase && !fEnforceBIP30); // Check that all outputs are available and match the outputs in the block itself // exactly. @@ -1859,8 +1860,10 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI COutPoint out(hash, o); Coin coin; bool is_spent = view.SpendCoin(out, &coin); - if (fEnforceBIP30 && (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase)) { - fClean = false; // transaction output mismatch + if (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase) { + if (!is_bip30_exception) { + fClean = false; // transaction output mismatch + } } } }