Skip to content

Commit 38db17b

Browse files
committed
htlcswitch: remove redundant field from channelLink
1 parent 72764b1 commit 38db17b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

htlcswitch/link.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,6 @@ type channelLink struct {
320320
// updates.
321321
channel *lnwallet.LightningChannel
322322

323-
// shortChanID is the most up to date short channel ID for the link.
324-
shortChanID lnwire.ShortChannelID
325-
326323
// cfg is a structure which carries all dependable fields/handlers
327324
// which may affect behaviour of the service.
328325
cfg ChannelLinkConfig
@@ -455,7 +452,6 @@ func NewChannelLink(cfg ChannelLinkConfig,
455452
return &channelLink{
456453
cfg: cfg,
457454
channel: channel,
458-
shortChanID: channel.ShortChanID(),
459455
hodlMap: make(map[models.CircuitKey]hodlHtlc),
460456
hodlQueue: queue.NewConcurrentQueue(10),
461457
log: build.NewPrefixLog(logPrefix, log),
@@ -2202,7 +2198,7 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
22022198
for id, settled := range finalHTLCs {
22032199
l.cfg.HtlcNotifier.NotifyFinalHtlcEvent(
22042200
models.CircuitKey{
2205-
ChanID: l.shortChanID,
2201+
ChanID: l.ShortChanID(),
22062202
HtlcID: id,
22072203
},
22082204
channeldb.FinalHtlcInfo{
@@ -2582,7 +2578,7 @@ func (l *channelLink) ShortChanID() lnwire.ShortChannelID {
25822578
l.RLock()
25832579
defer l.RUnlock()
25842580

2585-
return l.shortChanID
2581+
return l.channel.ShortChanID()
25862582
}
25872583

25882584
// UpdateShortChanID updates the short channel ID for a link. This may be

htlcswitch/switch_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5313,7 +5313,6 @@ func testSwitchHandlePacketForward(t *testing.T, zeroConf, private,
53135313
if zeroConf {
53145314
// Store the alias in the shortChanID field and mark the real
53155315
// scid in the database.
5316-
aliceChannelLink.shortChanID = aliceAlias
53175316
err = aliceChannelState.MarkRealScid(aliceScid)
53185317
require.NoError(t, err)
53195318

0 commit comments

Comments
 (0)