| 668 | } |
| 669 | |
| 670 | static bool payment_route_check(const struct gossmap *gossmap, |
| 671 | const struct gossmap_chan *c, |
| 672 | int dir, |
| 673 | struct amount_msat amount, |
| 674 | struct payment *p) |
| 675 | { |
| 676 | struct short_channel_id_dir scidd; |
| 677 | const struct channel_hint *hint; |
| 678 | |
| 679 | if (dst_is_excluded(gossmap, c, dir, payment_root(p)->excluded_nodes)) |
| 680 | return false; |
| 681 | |
| 682 | if (dst_is_excluded(gossmap, c, dir, p->temp_exclusion)) |
| 683 | return false; |
| 684 | |
| 685 | scidd.scid = gossmap_chan_scid(gossmap, c); |
| 686 | scidd.dir = dir; |
| 687 | hint = channel_hint_set_find(payment_root(p)->hints, &scidd); |
| 688 | if (!hint) |
| 689 | return true; |
| 690 | |
| 691 | paymod_log(p, LOG_DBG, |
| 692 | "Checking hint {.scid=%s, .enabled=%d, .estimate=%s}", |
| 693 | fmt_short_channel_id_dir(tmpctx, &hint->scid), hint->enabled, |
| 694 | fmt_amount_msat(tmpctx, hint->estimated_capacity)); |
| 695 | |
| 696 | if (!hint->enabled) |
| 697 | return false; |
| 698 | |
| 699 | if (amount_msat_greater_eq(amount, hint->estimated_capacity)) |
| 700 | /* We exclude on equality because we've set the |
| 701 | * estimate to the smallest failed attempt. */ |
| 702 | return false; |
| 703 | |
| 704 | if (hint->local && hint->local->htlc_budget == 0) |
| 705 | /* If we cannot add any HTLCs to the channel we |
| 706 | * shouldn't look for a route through that channel */ |
| 707 | return false; |
| 708 | |
| 709 | return true; |
| 710 | } |
| 711 | |
| 712 | static bool payment_route_can_carry(const struct gossmap *map, |
| 713 | const struct gossmap_chan *c, |
no test coverage detected