fixed ordering on txundo emplace

This commit is contained in:
Brannon King 2020-01-06 16:23:51 -07:00 committed by Anthony Fieroni
parent eac4f02348
commit 4b03309a64
2 changed files with 6 additions and 7 deletions

View file

@ -331,10 +331,10 @@ void ClaimTrieChainFixture::DecrementBlocks(int num_blocks)
{
LOCK(cs_main);
CBlockIndex* pblockindex = ::ChainActive()[::ChainActive().Height() - num_blocks + 1];
BOOST_CHECK_EQUAL(InvalidateBlock(state, Params(), pblockindex), true);
BOOST_REQUIRE(InvalidateBlock(state, Params(), pblockindex));
}
BOOST_CHECK_EQUAL(state.IsValid(), true);
BOOST_CHECK_EQUAL(ActivateBestChain(state, Params()), true);
BOOST_REQUIRE(state.IsValid());
BOOST_REQUIRE(ActivateBestChain(state, Params()));
mempool.clear();
num_txs_for_next_block = 0;
expirationHeight = ::ChainActive().Height();

View file

@ -1506,11 +1506,10 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund
// mark inputs spent
if (!tx.IsCoinBase()) {
txundo.vprevout.reserve(tx.vin.size());
Coin coin;
for (const CTxIn &txin : tx.vin) {
bool is_spent = inputs.SpendCoin(txin.prevout, &coin);
txundo.vprevout.emplace_back();
bool is_spent = inputs.SpendCoin(txin.prevout, &txundo.vprevout.back());
assert(is_spent);
txundo.vprevout.emplace_back(coin.out, coin.IsCoinBase(), int(coin.nHeight));
}
}
// add outputs