Skip to content

Commit e3de7cb

Browse files
author
MarcoFalke
committed
Merge bitcoin#24102: mempool: Run coin.IsSpent only once in a row
fa2bcc4 Run coin.IsSpent only once in a row (MarcoFalke) Pull request description: Follow-up to commit 64e4963 and bitcoin#23976 (comment) ACKs for top commit: glozow: utACK fa2bcc4, agree the assertion is sufficient theStack: Code-review ACK fa2bcc4 w0xlt: crACK bitcoin@fa2bcc4 shaavan: Code Review ACK fa2bcc4 brunoerg: crACK fa2bcc4 Tree-SHA512: 3be9d6b313bf6bb835f031826c81777b4659118d839001d084e72462391cb64ba81d06a5e07fd21fcfb709a71b08892b23212a98604ce8481da489476b72f072
2 parents b32f0d3 + fa2bcc4 commit e3de7cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/validation.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,10 @@ void CChainState::MaybeUpdateMempoolForReorg(
384384
auto it2 = m_mempool->mapTx.find(txin.prevout.hash);
385385
if (it2 != m_mempool->mapTx.end())
386386
continue;
387-
const Coin &coin = CoinsTip().AccessCoin(txin.prevout);
387+
const Coin& coin{CoinsTip().AccessCoin(txin.prevout)};
388388
assert(!coin.IsSpent());
389389
const auto mempool_spend_height{m_chain.Tip()->nHeight + 1};
390-
if (coin.IsSpent() || (coin.IsCoinBase() && mempool_spend_height - coin.nHeight < COINBASE_MATURITY)) {
390+
if (coin.IsCoinBase() && mempool_spend_height - coin.nHeight < COINBASE_MATURITY) {
391391
return true;
392392
}
393393
}

0 commit comments

Comments
 (0)