Run coin.IsSpent only once in a row

Follow-up to commit 64e4963c63
This commit is contained in:
MarcoFalke 2022-01-19 16:56:25 +01:00
parent 06b6369766
commit fa2bcc4e42
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548

View File

@ -384,10 +384,10 @@ void CChainState::MaybeUpdateMempoolForReorg(
auto it2 = m_mempool->mapTx.find(txin.prevout.hash);
if (it2 != m_mempool->mapTx.end())
continue;
const Coin &coin = CoinsTip().AccessCoin(txin.prevout);
const Coin& coin{CoinsTip().AccessCoin(txin.prevout)};
assert(!coin.IsSpent());
const auto mempool_spend_height{m_chain.Tip()->nHeight + 1};
if (coin.IsSpent() || (coin.IsCoinBase() && mempool_spend_height - coin.nHeight < COINBASE_MATURITY)) {
if (coin.IsCoinBase() && mempool_spend_height - coin.nHeight < COINBASE_MATURITY) {
return true;
}
}