| 647 | } |
| 648 | |
| 649 | static bool payment_route_check(const struct gossmap *gossmap, |
| 650 | const struct gossmap_chan *c, |
| 651 | int dir, |
| 652 | struct amount_msat amount, |
| 653 | struct payment *p) |
| 654 | { |
| 655 | struct short_channel_id scid; |
| 656 | const struct channel_hint *hint; |
| 657 | |
| 658 | if (dst_is_excluded(gossmap, c, dir, payment_root(p)->excluded_nodes)) |
| 659 | return false; |
| 660 | |
| 661 | if (dst_is_excluded(gossmap, c, dir, p->temp_exclusion)) |
| 662 | return false; |
| 663 | |
| 664 | scid = gossmap_chan_scid(gossmap, c); |
| 665 | hint = find_hint(payment_root(p)->channel_hints, &scid, dir); |
| 666 | if (!hint) |
| 667 | return true; |
| 668 | |
| 669 | if (!hint->enabled) |
| 670 | return false; |
| 671 | |
| 672 | if (amount_msat_greater_eq(amount, hint->estimated_capacity)) |
| 673 | /* We exclude on equality because we've set the |
| 674 | * estimate to the smallest failed attempt. */ |
| 675 | return false; |
| 676 | |
| 677 | if (hint->local && hint->htlc_budget == 0) |
| 678 | /* If we cannot add any HTLCs to the channel we |
| 679 | * shouldn't look for a route through that channel */ |
| 680 | return false; |
| 681 | |
| 682 | return true; |
| 683 | } |
| 684 | |
| 685 | static bool payment_route_can_carry(const struct gossmap *map, |
| 686 | const struct gossmap_chan *c, |
no test coverage detected