aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2017-06-08 12:08:32 -0400
committerAlex Morcos <morcos@chaincode.com>2017-06-27 15:04:56 -0400
commit3c8a9aefff3a600bef3da63c560f62af9e5582d6 (patch)
tree354ccd21bf82944ddf85a4cfc05fc0ea574e26db /src/validation.cpp
parentac52492cd22782d7b09c78c198fb6fd8eb1da57c (diff)
Add belt-and-suspenders in DisconnectBlock
These extra variables were previously checked before the move to per-txout database.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index eb6ea42b63..baf76e5bae 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1364,6 +1364,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex*
for (int i = block.vtx.size() - 1; i >= 0; i--) {
const CTransaction &tx = *(block.vtx[i]);
uint256 hash = tx.GetHash();
+ bool is_coinbase = tx.IsCoinBase();
// Check that all outputs are available and match the outputs in the block itself
// exactly.
@@ -1372,7 +1373,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex*
COutPoint out(hash, o);
Coin coin;
bool is_spent = view.SpendCoin(out, &coin);
- if (!is_spent || tx.vout[o] != coin.out) {
+ if (!is_spent || tx.vout[o] != coin.out || pindex->nHeight != coin.nHeight || is_coinbase != coin.fCoinBase) {
fClean = false; // transaction output mismatch
}
}