htlcswitch: prevent ChannelLink from leaking ChannelPoint pointer

This commit is contained in:
Keagan McClelland committed 2024-03-08 15:48:02 -08:00
1 parent db39a905cb
commit 16be46c1e5
3 files changed
+11 -9

No files matched your search

+6 -7
View File
@@ -1090,8 +1090,8 @@ func (l *channelLink) htlcManager() {
// ActiveLinkEvent. We'll also defer an inactive link notification for
// when the link exits to ensure that every active notification is
// matched by an inactive one.
l.cfg.NotifyActiveLink(*l.ChannelPoint())
defer l.cfg.NotifyInactiveLinkEvent(*l.ChannelPoint())
l.cfg.NotifyActiveLink(l.ChannelPoint())
defer l.cfg.NotifyInactiveLinkEvent(l.ChannelPoint())
// TODO(roasbeef): need to call wipe chan whenever D/C?
@@ -1215,8 +1215,8 @@ func (l *channelLink) htlcManager() {
// we can go ahead and send the active channel notification. We'll also
// defer the inactive notification for when the link exits to ensure
// that every active notification is matched by an inactive one.
l.cfg.NotifyActiveChannel(*l.ChannelPoint())
defer l.cfg.NotifyInactiveChannel(*l.ChannelPoint())
l.cfg.NotifyActiveChannel(l.ChannelPoint())
defer l.cfg.NotifyInactiveChannel(l.ChannelPoint())
// With the channel states synced, we now reset the mailbox to ensure
// we start processing all unacked packets in order. This is done here
@@ -2558,9 +2558,8 @@ func (l *channelLink) PeerPubKey() [33]byte {
// ChannelPoint returns the channel outpoint for the channel link.
// NOTE: Part of the ChannelLink interface.
func (l *channelLink) ChannelPoint() *wire.OutPoint {
chanPoint := l.channel.ChannelPoint()
return &chanPoint
func (l *channelLink) ChannelPoint() wire.OutPoint {
return l.channel.ChannelPoint()
}
// ShortChanID returns the short channel ID for the channel link. The short