Skip to content

Commit e899d4c

Browse files
seejeejamesob
andcommitted
init: limit bip30 exceptions to coinbase txs
Co-authored-by: James O'Beirne <[email protected]>
1 parent 511eb7f commit e899d4c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/validation.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,7 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
18511851
const CTransaction &tx = *(block.vtx[i]);
18521852
uint256 hash = tx.GetHash();
18531853
bool is_coinbase = tx.IsCoinBase();
1854+
bool is_bip30_exception = (is_coinbase && !fEnforceBIP30);
18541855

18551856
// Check that all outputs are available and match the outputs in the block itself
18561857
// exactly.
@@ -1859,8 +1860,10 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
18591860
COutPoint out(hash, o);
18601861
Coin coin;
18611862
bool is_spent = view.SpendCoin(out, &coin);
1862-
if (fEnforceBIP30 && (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase)) {
1863-
fClean = false; // transaction output mismatch
1863+
if (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase) {
1864+
if (!is_bip30_exception) {
1865+
fClean = false; // transaction output mismatch
1866+
}
18641867
}
18651868
}
18661869
}

0 commit comments

Comments
 (0)