| 921 | } |
| 922 | |
| 923 | bool CTxMemPool::CompareDepthAndScore(const uint256& hasha, const uint256& hashb, bool wtxid) |
| 924 | { |
| 925 | /* Return `true` if hasha should be considered sooner than hashb. Namely when: |
| 926 | * a is not in the mempool, but b is |
| 927 | * both are in the mempool and a has fewer ancestors than b |
| 928 | * both are in the mempool and a has a higher score than b |
| 929 | */ |
| 930 | LOCK(cs); |
| 931 | indexed_transaction_set::const_iterator j = wtxid ? get_iter_from_wtxid(hashb) : mapTx.find(hashb); |
| 932 | if (j == mapTx.end()) return false; |
| 933 | indexed_transaction_set::const_iterator i = wtxid ? get_iter_from_wtxid(hasha) : mapTx.find(hasha); |
| 934 | if (i == mapTx.end()) return true; |
| 935 | uint64_t counta = i->GetCountWithAncestors(); |
| 936 | uint64_t countb = j->GetCountWithAncestors(); |
| 937 | if (counta == countb) { |
| 938 | return CompareTxMemPoolEntryByScore()(*i, *j); |
| 939 | } |
| 940 | return counta < countb; |
| 941 | } |
| 942 | |
| 943 | namespace { |
| 944 | class DepthAndScoreComparator |
no test coverage detected