feefrac: drop comparison and operator{<<,>>} for sorted wrappers

Instead of having an unintuitive but total implicit sort order on
FeeFrac (first increasing feerate, then decreasing size), and separate
overloaded operator<< and operator>> for a weak ordering that only looks
at feerate, replace these with explicit wrapper classes which make the
behavior more explicit.

This allows for things like ByRatio{a} <= ByRatio{b}, instead of the
earlier !(a >> b). It also supports usage inside std::max and
std::greater, so one can use:
* std::max<ByRatioNegSize<FeeFrac>>(a, b)
* std::sort(v.begin(), v.end(), std::greater<ByRatioNegSize<FeeFrac>>{})
This commit is contained in:
Pieter Wuille
2026-02-24 17:09:59 -05:00
committed by Pieter Wuille
parent 3a8b4e89f6
commit 747da25360
15 changed files with 215 additions and 158 deletions

View File

@@ -295,7 +295,7 @@ void BlockAssembler::addChunks()
while (selected_transactions.size() > 0) {
// Check to see if min fee rate is still respected.
if (chunk_feerate_vsize << m_options.blockMinFeeRate.GetFeePerVSize()) {
if (ByRatio{chunk_feerate_vsize} < ByRatio{m_options.blockMinFeeRate.GetFeePerVSize()}) {
// Everything else we might consider has a lower feerate
return;
}