diff options
| author | Gregory Maxwell <[email protected]> | 2013-10-28 08:34:42 -0700 |
|---|---|---|
| committer | Gregory Maxwell <[email protected]> | 2013-10-28 08:34:42 -0700 |
| commit | 377cd749308d43bc718cac806a3f8a1710652b0e (patch) | |
| tree | 1f4585e24c7331b6bd7010eb1bf536fae7d812f5 /src/main.cpp | |
| parent | qt: make receive coins tab look more consistent with send coins tab (diff) | |
| parent | Generalize the remove-outputs check for fully-prunable transactions. (diff) | |
| download | discoin-377cd749308d43bc718cac806a3f8a1710652b0e.tar.xz discoin-377cd749308d43bc718cac806a3f8a1710652b0e.zip | |
Merge pull request #3163 from sipa/allunspendable
Generalize the remove-outputs check for fully-prunable transactions.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 56bd7a5cf..49fc7abba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1750,12 +1750,12 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex const CTransaction &tx = block.vtx[i]; uint256 hash = tx.GetHash(); - // check that all outputs are available - if (!view.HaveCoins(hash)) { - fClean = fClean && error("DisconnectBlock() : outputs still spent? database corrupted"); - view.SetCoins(hash, CCoins()); - } - CCoins &outs = view.GetCoins(hash); + // Check that all outputs are available and match the outputs in the block itself + // exactly. Note that transactions with only provably unspendable outputs won't + // have outputs available even in the block itself, so we handle that case + // specially with outsEmpty. + CCoins outsEmpty; + CCoins &outs = view.HaveCoins(hash) ? view.GetCoins(hash) : outsEmpty; outs.ClearUnspendable(); CCoins outsBlock = CCoins(tx, pindex->nHeight); |