fixed ordering on txundo emplace
This commit is contained in:
parent
eac4f02348
commit
4b03309a64
2 changed files with 6 additions and 7 deletions
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
@ -2181,7 +2180,7 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
|
|||
for (const auto& tx : block.vtx) {
|
||||
for (size_t o = 0; o < tx->vout.size(); o++) {
|
||||
if (view.HaveCoin(COutPoint(tx->GetHash(), o))) {
|
||||
return state.Invalid(ValidationInvalidReason::CONSENSUS, error("ConnectBlock(): tried to overwrite transaction"),
|
||||
return state.Invalid(ValidationInvalidReason::CONSENSUS, error("ConnectBlock(): tried to overwrite transaction"),
|
||||
REJECT_INVALID, "bad-txns-BIP30");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue