aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-01-24 12:43:19 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-01-24 12:43:23 +0100
commite3de7cb9039770e0fd5b8bb8a5cba35c87ae8f00 (patch)
tree38c6cdd764755be2540d34da2313f45b88fc4102
parentb32f0d3af1e0af858ef75d76661f55b2ce9af8e2 (diff)
parentfa2bcc4e42e7fed61727b3de4019e9702d4090ce (diff)
Merge bitcoin/bitcoin#24102: mempool: Run coin.IsSpent only once in a row
fa2bcc4e42e7fed61727b3de4019e9702d4090ce Run coin.IsSpent only once in a row (MarcoFalke) Pull request description: Follow-up to commit 64e4963c635ec3a73a5fa3f32f6ec08e70609f60 and https://github.com/bitcoin/bitcoin/pull/23976#discussion_r787758193 ACKs for top commit: glozow: utACK fa2bcc4e42e7fed61727b3de4019e9702d4090ce, agree the assertion is sufficient theStack: Code-review ACK fa2bcc4e42e7fed61727b3de4019e9702d4090ce w0xlt: crACK https://github.com/bitcoin/bitcoin/pull/24102/commits/fa2bcc4e42e7fed61727b3de4019e9702d4090ce shaavan: Code Review ACK fa2bcc4e42e7fed61727b3de4019e9702d4090ce brunoerg: crACK fa2bcc4e42e7fed61727b3de4019e9702d4090ce Tree-SHA512: 3be9d6b313bf6bb835f031826c81777b4659118d839001d084e72462391cb64ba81d06a5e07fd21fcfb709a71b08892b23212a98604ce8481da489476b72f072
-rw-r--r--src/validation.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index fff7cfc07b..b3d989e150 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -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;
}
}