htlcswitch: remove redundant field from channelLink

This commit is contained in:
Keagan McClelland committed 2024-02-27 17:06:35 -08:00
1 parent 72764b1473
commit 38db17b8cc
2 files changed
+2 -7

No files matched your search

+2 -6
View File
@@ -320,9 +320,6 @@ type channelLink struct {
// updates. // updates.
channel *lnwallet.LightningChannel 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 // cfg is a structure which carries all dependable fields/handlers
// which may affect behaviour of the service. // which may affect behaviour of the service.
cfg ChannelLinkConfig cfg ChannelLinkConfig
@@ -455,7 +452,6 @@ func NewChannelLink(cfg ChannelLinkConfig,
return &channelLink{ return &channelLink{
cfg: cfg, cfg: cfg,
channel: channel, channel: channel,
shortChanID: channel.ShortChanID(),
hodlMap: make(map[models.CircuitKey]hodlHtlc), hodlMap: make(map[models.CircuitKey]hodlHtlc),
hodlQueue: queue.NewConcurrentQueue(10), hodlQueue: queue.NewConcurrentQueue(10),
log: build.NewPrefixLog(logPrefix, log), log: build.NewPrefixLog(logPrefix, log),
@@ -2202,7 +2198,7 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
for id, settled := range finalHTLCs { for id, settled := range finalHTLCs {
l.cfg.HtlcNotifier.NotifyFinalHtlcEvent( l.cfg.HtlcNotifier.NotifyFinalHtlcEvent(
models.CircuitKey{ models.CircuitKey{
ChanID: l.shortChanID, ChanID: l.ShortChanID(),
HtlcID: id, HtlcID: id,
}, },
channeldb.FinalHtlcInfo{ channeldb.FinalHtlcInfo{
@@ -2582,7 +2578,7 @@ func (l *channelLink) ShortChanID() lnwire.ShortChannelID {
l.RLock() l.RLock()
defer l.RUnlock() defer l.RUnlock()
return l.shortChanID return l.channel.ShortChanID()
} }
// UpdateShortChanID updates the short channel ID for a link. This may be // UpdateShortChanID updates the short channel ID for a link. This may be
-1
View File
@@ -5313,7 +5313,6 @@ func testSwitchHandlePacketForward(t *testing.T, zeroConf, private,
if zeroConf { if zeroConf {
// Store the alias in the shortChanID field and mark the real // Store the alias in the shortChanID field and mark the real
// scid in the database. // scid in the database.
aliceChannelLink.shortChanID = aliceAlias
err = aliceChannelState.MarkRealScid(aliceScid) err = aliceChannelState.MarkRealScid(aliceScid)
require.NoError(t, err) require.NoError(t, err)