| 614 | } |
| 615 | |
| 616 | static const struct short_channel_id_dir * |
| 617 | payment_get_excluded_channels(const tal_t *ctx, struct payment *p) |
| 618 | { |
| 619 | struct payment *root = payment_root(p); |
| 620 | struct channel_hint *hint; |
| 621 | struct channel_hint_map_iter iter; |
| 622 | struct short_channel_id_dir *res = |
| 623 | tal_arr(ctx, struct short_channel_id_dir, 0); |
| 624 | for (hint = channel_hint_map_first(root->hints->hints, &iter); |
| 625 | hint; |
| 626 | hint = channel_hint_map_next(root->hints->hints, &iter)) { |
| 627 | if (!hint->enabled) |
| 628 | tal_arr_expand(&res, hint->scid); |
| 629 | |
| 630 | else if (amount_msat_greater(p->our_amount, |
| 631 | hint->estimated_capacity)) |
| 632 | tal_arr_expand(&res, hint->scid); |
| 633 | |
| 634 | else if (hint->local && hint->local->htlc_budget == 0) |
| 635 | /* If we cannot add any HTLCs to the channel we |
| 636 | * shouldn't look for a route through that channel */ |
| 637 | tal_arr_expand(&res, hint->scid); |
| 638 | } |
| 639 | return res; |
| 640 | } |
| 641 | |
| 642 | static const struct node_id *payment_get_excluded_nodes(const tal_t *ctx, |
| 643 | struct payment *p) |
no test coverage detected