mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-09 05:34:24 +00:00
Merge pull request #3163 from sipa/allunspendable
Generalize the remove-outputs check for fully-prunable transactions.
This commit is contained in:
commit
377cd74930
@ -421,6 +421,9 @@ public:
|
|||||||
|
|
||||||
// equality test
|
// equality test
|
||||||
friend bool operator==(const CCoins &a, const CCoins &b) {
|
friend bool operator==(const CCoins &a, const CCoins &b) {
|
||||||
|
// Empty CCoins objects are always equal.
|
||||||
|
if (a.IsPruned() && b.IsPruned())
|
||||||
|
return true;
|
||||||
return a.fCoinBase == b.fCoinBase &&
|
return a.fCoinBase == b.fCoinBase &&
|
||||||
a.nHeight == b.nHeight &&
|
a.nHeight == b.nHeight &&
|
||||||
a.nVersion == b.nVersion &&
|
a.nVersion == b.nVersion &&
|
||||||
|
12
src/main.cpp
12
src/main.cpp
@ -1750,12 +1750,12 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
|
|||||||
const CTransaction &tx = block.vtx[i];
|
const CTransaction &tx = block.vtx[i];
|
||||||
uint256 hash = tx.GetHash();
|
uint256 hash = tx.GetHash();
|
||||||
|
|
||||||
// check that all outputs are available
|
// Check that all outputs are available and match the outputs in the block itself
|
||||||
if (!view.HaveCoins(hash)) {
|
// exactly. Note that transactions with only provably unspendable outputs won't
|
||||||
fClean = fClean && error("DisconnectBlock() : outputs still spent? database corrupted");
|
// have outputs available even in the block itself, so we handle that case
|
||||||
view.SetCoins(hash, CCoins());
|
// specially with outsEmpty.
|
||||||
}
|
CCoins outsEmpty;
|
||||||
CCoins &outs = view.GetCoins(hash);
|
CCoins &outs = view.HaveCoins(hash) ? view.GetCoins(hash) : outsEmpty;
|
||||||
outs.ClearUnspendable();
|
outs.ClearUnspendable();
|
||||||
|
|
||||||
CCoins outsBlock = CCoins(tx, pindex->nHeight);
|
CCoins outsBlock = CCoins(tx, pindex->nHeight);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user