Skip to content

Commit 3c8a9ae

Browse files
committed
Add belt-and-suspenders in DisconnectBlock
These extra variables were previously checked before the move to per-txout database.
1 parent ac52492 commit 3c8a9ae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/validation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex*
13641364
for (int i = block.vtx.size() - 1; i >= 0; i--) {
13651365
const CTransaction &tx = *(block.vtx[i]);
13661366
uint256 hash = tx.GetHash();
1367+
bool is_coinbase = tx.IsCoinBase();
13671368

13681369
// Check that all outputs are available and match the outputs in the block itself
13691370
// exactly.
@@ -1372,7 +1373,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex*
13721373
COutPoint out(hash, o);
13731374
Coin coin;
13741375
bool is_spent = view.SpendCoin(out, &coin);
1375-
if (!is_spent || tx.vout[o] != coin.out) {
1376+
if (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase) {
13761377
fClean = false; // transaction output mismatch
13771378
}
13781379
}

0 commit comments

Comments
 (0)