Skip to content

Commit a9d42b9

Browse files
committed
CompareFeerateDiagram: short-circuit comparison when detected as incomparable
1 parent cebcced commit a9d42b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/util/feefrac.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ std::partial_ordering CompareFeerateDiagram(Span<const FeeFrac> dia0, Span<const
7676
if (std::is_gt(cmp)) better_somewhere[unproc_side] = true;
7777
if (std::is_lt(cmp)) better_somewhere[!unproc_side] = true;
7878
++next_index[unproc_side];
79+
80+
// If both diagrams are better somewhere, they are incomparable.
81+
if (better_somewhere[0] && better_somewhere[1]) return std::partial_ordering::unordered;
82+
7983
} while(true);
8084

81-
// If both diagrams are better somewhere, they are incomparable.
82-
if (better_somewhere[0] && better_somewhere[1]) return std::partial_ordering::unordered;
8385
// Otherwise compare the better_somewhere values.
8486
return better_somewhere[0] <=> better_somewhere[1];
8587
}

0 commit comments

Comments
 (0)