Skip unspendable outputs in consistency check
This commit is contained in:
parent
fb8724ee6c
commit
99740bab9c
2 changed files with 10 additions and 5 deletions
14
src/core.h
14
src/core.h
|
@ -390,11 +390,7 @@ public:
|
|||
|
||||
// construct a CCoins from a CTransaction, at a given height
|
||||
CCoins(const CTransaction &tx, int nHeightIn) : fCoinBase(tx.IsCoinBase()), vout(tx.vout), nHeight(nHeightIn), nVersion(tx.nVersion) {
|
||||
BOOST_FOREACH(CTxOut &txout, vout) {
|
||||
if (txout.scriptPubKey.IsUnspendable())
|
||||
txout.SetNull();
|
||||
}
|
||||
Cleanup();
|
||||
ClearUnspendable();
|
||||
}
|
||||
|
||||
// empty constructor
|
||||
|
@ -408,6 +404,14 @@ public:
|
|||
std::vector<CTxOut>().swap(vout);
|
||||
}
|
||||
|
||||
void ClearUnspendable() {
|
||||
BOOST_FOREACH(CTxOut &txout, vout) {
|
||||
if (txout.scriptPubKey.IsUnspendable())
|
||||
txout.SetNull();
|
||||
}
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void swap(CCoins &to) {
|
||||
std::swap(to.fCoinBase, fCoinBase);
|
||||
to.vout.swap(vout);
|
||||
|
|
|
@ -1781,6 +1781,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
|
|||
view.SetCoins(hash, CCoins());
|
||||
}
|
||||
CCoins &outs = view.GetCoins(hash);
|
||||
outs.ClearUnspendable();
|
||||
|
||||
CCoins outsBlock = CCoins(tx, pindex->nHeight);
|
||||
// The CCoins serialization does not serialize negative numbers.
|
||||
|
|
Loading…
Reference in a new issue