Skip to content

Commit

Permalink
localchans: bugfix so that we always use the correct chanID
Browse files Browse the repository at this point in the history
  • Loading branch information
ziggie1984 committed Jan 14, 2025
1 parent a388c1f commit e008190
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions routing/localchans/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit e008190

Please sign in to comment.