multi: don't leak underlying pointer to LightningChannel.ChannelPoint()

This commit is contained in:
Keagan McClelland committed 2024-03-08 15:27:19 -08:00
1 parent e9b3808c29
commit fd1cd315ce
11 files changed
+53 -42

No files matched your search

+5 -3
View File
@@ -1371,7 +1371,7 @@ func (l *channelLink) htlcManager() {
// TODO(roasbeef): remove all together
go func() {
chanPoint := l.channel.ChannelPoint()
l.cfg.Peer.WipeChannel(chanPoint)
l.cfg.Peer.WipeChannel(&chanPoint)
}()
return
@@ -2559,7 +2559,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 {
return l.channel.ChannelPoint()
chanPoint := l.channel.ChannelPoint()
return &chanPoint
}
// ShortChanID returns the short channel ID for the channel link. The short
@@ -2601,7 +2602,8 @@ func (l *channelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
//
// NOTE: Part of the ChannelLink interface.
func (l *channelLink) ChanID() lnwire.ChannelID {
return lnwire.NewChanIDFromOutPoint(l.channel.ChannelPoint())
chanPoint := l.channel.ChannelPoint()
return lnwire.NewChanIDFromOutPoint(&chanPoint)
}
// Bandwidth returns the total amount that can flow through the channel link at
+2 -1
View File
@@ -3762,7 +3762,8 @@ func TestChannelRetransmission(t *testing.T) {
t.Fatalf("unable to create channel: %v", err)
}
chanID := lnwire.NewChanIDFromOutPoint(channels.aliceToBob.ChannelPoint())
chanPoint := channels.aliceToBob.ChannelPoint()
chanID := lnwire.NewChanIDFromOutPoint(&chanPoint)
serverErr := make(chan error, 4)
aliceInterceptor := createInterceptorFunc("[alice] <-- [bob]",