From bf4417804753174f2b80de5158e09ae2828c0e6b Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 26 Apr 2022 14:41:41 +0200 Subject: [PATCH] gossipd: Use the remote alias if no real scid is known This is for the local channel announcement that'll not leave this host, as it doesn't have signatures. --- lightningd/gossip_control.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index f57cd7a5d..51a3cd789 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -348,15 +348,26 @@ void tell_gossipd_local_private_channel(struct lightningd *ld, struct amount_sat capacity, const u8 *features) { + /* Which short_channel_id should we use to refer to this channel when + * creating invoices? */ + const struct short_channel_id *scid; + /* As we're shutting down, ignore */ if (!ld->gossip) return; + if (channel->scid != NULL) { + scid = channel->scid; + } else { + scid = channel->alias[REMOTE]; + } + + assert(scid != NULL); subd_send_msg(ld->gossip, take(towire_gossipd_local_private_channel (NULL, &channel->peer->id, capacity, - channel->scid, + scid, features))); }