Skip to content

Commit

Permalink
CompareFeerateDiagram: short-circuit comparison when detected as inco…
Browse files Browse the repository at this point in the history
…mparable
  • Loading branch information
instagibbs committed Mar 26, 2024
1 parent cebcced commit a9d42b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/feefrac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ std::partial_ordering CompareFeerateDiagram(Span<const FeeFrac> dia0, Span<const
if (std::is_gt(cmp)) better_somewhere[unproc_side] = true;
if (std::is_lt(cmp)) better_somewhere[!unproc_side] = true;
++next_index[unproc_side];

// If both diagrams are better somewhere, they are incomparable.
if (better_somewhere[0] && better_somewhere[1]) return std::partial_ordering::unordered;

} while(true);

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

0 comments on commit a9d42b9

Please sign in to comment.