Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightningd: Look for channels by alias when finding channels #5846

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lightningd/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,19 +834,23 @@ static struct command_result *check_invoice_request_usage(struct command *cmd,

static struct channel *find_channel_for_htlc_add(struct lightningd *ld,
const struct node_id *node,
const struct short_channel_id *scid)
const struct short_channel_id *scid_or_alias)
{
struct channel *channel;
struct peer *peer = peer_by_id(ld, node);
if (!peer)
return NULL;

channel = find_channel_by_scid(peer, scid);
channel = find_channel_by_scid(peer, scid_or_alias);
if (channel && channel_can_add_htlc(channel))
return channel;

channel = find_channel_by_alias(peer, scid_or_alias, LOCAL);
if (channel && channel_can_add_htlc(channel))
return channel;

/* We used to ignore scid: now all-zero means "any" */
if (!channel && (deprecated_apis || memeqzero(scid, sizeof(*scid)))) {
if (!channel && (deprecated_apis || memeqzero(scid_or_alias, sizeof(*scid_or_alias)))) {
list_for_each(&peer->channels, channel, list) {
if (channel_can_add_htlc(channel)) {
return channel;
Expand Down