Commit a465fb9
invoice: fix false BROKEN log in cmp_rr_number when sort self-compares
Some qsort implementations (notably macOS) call the comparator with
the same element against itself (a == b). cmp_rr_number assumed
rr_numbers are unique across distinct channels and logged BROKEN on
any tie, but when a == b then a->c == b->c and the tie is trivially
expected — not a data corruption.
Guard the BROKEN log with `if (a->c != b->c)`: equal channel pointers
mean the same channel entry; only different channels sharing an
rr_number is genuinely broken. This silences the spurious BROKEN log
on macOS that caused test_xpay_limited_max_accepted_htlcs to fail with
"had BROKEN or That's weird messages".
Changelog-Fixed: invoice: no longer spuriously logs BROKEN when macOS qsort compares a routehint candidate to itself.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent db4644f commit a465fb9
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
610 | | - | |
611 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
612 | 615 | | |
613 | 616 | | |
614 | 617 | | |
| |||
0 commit comments