From e008190a85f2f43265616509381f561e77f827e5 Mon Sep 17 00:00:00 2001 From: ziggie Date: Thu, 19 Dec 2024 18:10:04 +0100 Subject: [PATCH] localchans: bugfix so that we always use the correct chanID --- routing/localchans/manager.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/routing/localchans/manager.go b/routing/localchans/manager.go index cd9e58fcaa..3beb28525c 100644 --- a/routing/localchans/manager.go +++ b/routing/localchans/manager.go @@ -311,8 +311,16 @@ func (r *Manager) createEdge(channel *channeldb.OpenChannel, err) } + // We need to make sure we use the real scid for public confirmed + // zero-conf channels. + shortChanID := channel.ShortChanID() + isPublic := channel.ChannelFlags&lnwire.FFAnnounceChannel != 0 + if isPublic && channel.IsZeroConf() && channel.ZeroConfConfirmed() { + shortChanID = channel.ZeroConfRealScid() + } + info := &models.ChannelEdgeInfo{ - ChannelID: channel.ShortChanID().ToUint64(), + ChannelID: shortChanID.ToUint64(), ChainHash: channel.ChainHash, Features: featureBuf.Bytes(), Capacity: channel.Capacity, @@ -328,7 +336,7 @@ func (r *Manager) createEdge(channel *channeldb.OpenChannel, // be updated with the new values in the call to processChan below. timeLockDelta := uint16(r.DefaultRoutingPolicy.TimeLockDelta) edge := &models.ChannelEdgePolicy{ - ChannelID: channel.ShortChanID().ToUint64(), + ChannelID: shortChanID.ToUint64(), LastUpdate: timestamp, TimeLockDelta: timeLockDelta, ChannelFlags: channelFlags,