From 38db17b8cc3c1931314ad22dce0f06174eba393d Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Thu, 22 Feb 2024 16:17:09 -0800 Subject: [PATCH] htlcswitch: remove redundant field from channelLink --- htlcswitch/link.go | 8 ++------ htlcswitch/switch_test.go | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index f8f87ca8f..b045b5ab1 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -320,9 +320,6 @@ type channelLink struct { // updates. channel *lnwallet.LightningChannel - // shortChanID is the most up to date short channel ID for the link. - shortChanID lnwire.ShortChannelID - // cfg is a structure which carries all dependable fields/handlers // which may affect behaviour of the service. cfg ChannelLinkConfig @@ -455,7 +452,6 @@ func NewChannelLink(cfg ChannelLinkConfig, return &channelLink{ cfg: cfg, channel: channel, - shortChanID: channel.ShortChanID(), hodlMap: make(map[models.CircuitKey]hodlHtlc), hodlQueue: queue.NewConcurrentQueue(10), log: build.NewPrefixLog(logPrefix, log), @@ -2202,7 +2198,7 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) { for id, settled := range finalHTLCs { l.cfg.HtlcNotifier.NotifyFinalHtlcEvent( models.CircuitKey{ - ChanID: l.shortChanID, + ChanID: l.ShortChanID(), HtlcID: id, }, channeldb.FinalHtlcInfo{ @@ -2582,7 +2578,7 @@ func (l *channelLink) ShortChanID() lnwire.ShortChannelID { l.RLock() defer l.RUnlock() - return l.shortChanID + return l.channel.ShortChanID() } // UpdateShortChanID updates the short channel ID for a link. This may be diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index 2d507f01b..b443be355 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -5313,7 +5313,6 @@ func testSwitchHandlePacketForward(t *testing.T, zeroConf, private, if zeroConf { // Store the alias in the shortChanID field and mark the real // scid in the database. - aliceChannelLink.shortChanID = aliceAlias err = aliceChannelState.MarkRealScid(aliceScid) require.NoError(t, err)