Use cluster linearization for transaction relay sort order

Previously, transaction batches were first sorted by ancestor count and then
feerate, to ensure transactions are announced in a topologically valid order,
while prioritizing higher feerate transactions. Ancestor count is a crude
topological sort criteria, so replace this with linearization order so that the
highest feerate transactions (as would be observed by the mining algorithm) are
relayed before lower feerate ones, in a topologically valid way.

This also fixes a test that only worked due to the ancestor-count-based sort
order.
This commit is contained in:
Suhas Daftuar
2023-09-27 14:47:42 -04:00
parent 6445aa7d97
commit 21b5cea588
4 changed files with 21 additions and 29 deletions

View File

@@ -5425,8 +5425,8 @@ public:
bool operator()(std::set<Wtxid>::iterator a, std::set<Wtxid>::iterator b)
{
/* As std::make_heap produces a max-heap, we want the entries with the
* fewest ancestors/highest fee to sort later. */
return m_mempool->CompareDepthAndScore(*b, *a);
* higher mining score to sort later. */
return m_mempool->CompareMiningScoreWithTopology(*b, *a);
}
};
} // namespace