From b7a3677c988c5d8f5ed6968302303c7000af5c23 Mon Sep 17 00:00:00 2001 From: koh-gt <101822992+koh-gt@users.noreply.github.com> Date: Thu, 25 Apr 2024 19:16:10 +0800 Subject: [PATCH] Update txmempool.cpp --- src/txmempool.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index a7fffdb0..2cb386ed 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -818,16 +818,11 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const 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 j = wtxid ? get_iter_from_wtxid(hashb) : mapTx.find(hashb); - 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; + 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; uint64_t counta = i->GetCountWithAncestors(); uint64_t countb = j->GetCountWithAncestors(); if (counta == countb) {