MCPcopy Create free account
hub / github.com/ElementsProject/lightning / find_channel_for_htlc_add

Function find_channel_for_htlc_add

lightningd/pay.c:833–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

831}
832
833static 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. */

Callers 1

send_payment_coreFunction · 0.85

Calls 4

peer_by_idFunction · 0.85
channel_can_add_htlcFunction · 0.85
memeqzeroFunction · 0.85
find_channel_by_scidFunction · 0.70

Tested by

no test coverage detected