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.
This commit is contained in:
Christian Decker 2022-04-26 14:41:41 +02:00
parent 3e57d6f9d0
commit bf44178047
1 changed files with 12 additions and 1 deletions

View File

@ -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)));
}