For deterministic results with bolt12/11 routes, we only return a * single candidate: choose the one with most capacity */
| 463 | /* For deterministic results with bolt12/11 routes, we only return a |
| 464 | * single candidate: choose the one with most capacity */ |
| 465 | static size_t best_candidate(const struct gossmap *gossmap, |
| 466 | const struct gossmap_node *me) |
| 467 | { |
| 468 | struct amount_msat best_cap = AMOUNT_MSAT(0); |
| 469 | size_t best_num = 0; |
| 470 | for (size_t i = 0; i < me->num_chans; i++) { |
| 471 | int dir; |
| 472 | struct gossmap_chan *ourchan; |
| 473 | struct amount_msat cap; |
| 474 | struct gossmap_node *peer; |
| 475 | |
| 476 | ourchan = gossmap_nth_chan(gossmap, me, i, &dir); |
| 477 | if (ourchan->cupdate_off[!dir] == 0) |
| 478 | continue; |
| 479 | |
| 480 | peer = gossmap_nth_node(gossmap, ourchan, !dir); |
| 481 | cap = peer_capacity(gossmap, me, peer, ourchan); |
| 482 | if (amount_msat_greater(cap, best_cap)) { |
| 483 | best_num = i; |
| 484 | best_cap = cap; |
| 485 | } |
| 486 | } |
| 487 | return best_num; |
| 488 | } |
| 489 | |
| 490 | static struct command_result * |
| 491 | listpeerchannels_listincoming_done(struct command *cmd, |
no test coverage detected