| 831 | } |
| 832 | |
| 833 | static struct channel *find_channel_for_htlc_add(struct lightningd *ld, |
| 834 | const struct node_id *node, |
| 835 | const struct short_channel_id *scid) |
| 836 | { |
| 837 | struct channel *channel; |
| 838 | struct peer *peer = peer_by_id(ld, node); |
| 839 | if (!peer) |
| 840 | return NULL; |
| 841 | |
| 842 | channel = find_channel_by_scid(peer, scid); |
| 843 | if (channel && channel_can_add_htlc(channel)) |
| 844 | return channel; |
| 845 | |
| 846 | /* We used to ignore scid: now all-zero means "any" */ |
| 847 | if (!channel && (deprecated_apis || memeqzero(scid, sizeof(*scid)))) { |
| 848 | list_for_each(&peer->channels, channel, list) { |
| 849 | if (channel_can_add_htlc(channel)) { |
| 850 | return channel; |
| 851 | } |
| 852 | } |
| 853 | } |
| 854 | return NULL; |
| 855 | } |
| 856 | |
| 857 | /* destination/route_channels/route_nodes are NULL (and path_secrets may be NULL) |
| 858 | * if we're sending a raw onion. */ |
no test coverage detected