mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-11 01:11:50 +02:00
init: limit bip30 exceptions to coinbase txs
Co-authored-by: James O'Beirne <james.obeirne@pm.me>
This commit is contained in:
parent
511eb7fdea
commit
e899d4ca6f
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user