aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-05-11 19:10:21 +0100
committerfanquake <fanquake@gmail.com>2023-05-11 19:15:53 +0100
commit8996da626d68784aaaccd96d3459c805b578f759 (patch)
tree65b94889489e2e7c8089c20daf0ca5326a56cb60 /src/txmempool.cpp
parentfcdd7b9e5328d59d621a690166bf0115a57b6e9e (diff)
parent49a2d66f4e3a01aa697c1b9e5994fd8300953951 (diff)
Merge bitcoin/bitcoin#27613: [25.0] Backports for rc2v25.0rc2
49a2d66f4e3a01aa697c1b9e5994fd8300953951 doc: update manual pages for v25.0rc2 (fanquake) 3ea4a115c213fd67c80a0ad2301b170b805303c9 build: bump version to v25.0rc2 (fanquake) 7ef71e30c9bc108e29dec008490db5a0fa051629 net_processing: Boost inv trickle rate (Anthony Towns) 1adbcd302fe3b937e9078fa0e21b3252a0e642de txmempool: have CompareDepthAndScore sort missing txs first (Anthony Towns) 9a23079df33d9d728bf7435fc1d07d0f414f7429 p2p: Avoid prematurely clearing download state for other peers (Suhas Daftuar) Pull request description: Backports for rc2. Currently: * https://github.com/bitcoin/bitcoin/pull/27608 * https://github.com/bitcoin/bitcoin/pull/27610 ACKs for top commit: achow101: ACK 49a2d66f4e3a01aa697c1b9e5994fd8300953951 Tree-SHA512: a1a7678e16136636ec8a232d12630529639bae3b577769b5a5fd204dda234a5e588f3d4dfebf4d7abe7111d13cc0714f9ccdea0a858fe821a7146e6a697308d3
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 032dfee3ea..2111367f75 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -754,11 +754,16 @@ void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendhei
bool CTxMemPool::CompareDepthAndScore(const uint256& hasha, const uint256& hashb, bool wtxid)
{
+ /* Return `true` if hasha should be considered sooner than hashb. Namely when:
+ * a is not in the mempool, but b is
+ * both are in the mempool and a has fewer ancestors than b
+ * both are in the mempool and a has a higher score than b
+ */
LOCK(cs);
- indexed_transaction_set::const_iterator i = wtxid ? get_iter_from_wtxid(hasha) : mapTx.find(hasha);
- if (i == mapTx.end()) return false;
indexed_transaction_set::const_iterator j = wtxid ? get_iter_from_wtxid(hashb) : mapTx.find(hashb);
- if (j == mapTx.end()) return true;
+ if (j == mapTx.end()) return false;
+ indexed_transaction_set::const_iterator i = wtxid ? get_iter_from_wtxid(hasha) : mapTx.find(hasha);
+ if (i == mapTx.end()) return true;
uint64_t counta = i->GetCountWithAncestors();
uint64_t countb = j->GetCountWithAncestors();
if (counta == countb) {