htlcswitch: prevent ChannelLink from leaking ChannelPoint pointer
This commit is contained in:
1 parent
db39a905cb
commit
16be46c1e5
3 files changed
+11
-9
No files matched your search
@@ -221,7 +221,7 @@ type ChannelLink interface {
|
|||||||
IsUnadvertised() bool
|
IsUnadvertised() bool
|
||||||
|
|
||||||
// ChannelPoint returns the channel outpoint for the channel link.
|
// ChannelPoint returns the channel outpoint for the channel link.
|
||||||
ChannelPoint() *wire.OutPoint
|
ChannelPoint() wire.OutPoint
|
||||||
|
|
||||||
// ShortChanID returns the short channel ID for the channel link. The
|
// ShortChanID returns the short channel ID for the channel link. The
|
||||||
// short channel ID encodes the exact location in the main chain that
|
// short channel ID encodes the exact location in the main chain that
|
||||||
|
|||||||
+6
-7
@@ -1090,8 +1090,8 @@ func (l *channelLink) htlcManager() {
|
|||||||
// ActiveLinkEvent. We'll also defer an inactive link notification for
|
// ActiveLinkEvent. We'll also defer an inactive link notification for
|
||||||
// when the link exits to ensure that every active notification is
|
// when the link exits to ensure that every active notification is
|
||||||
// matched by an inactive one.
|
// matched by an inactive one.
|
||||||
l.cfg.NotifyActiveLink(*l.ChannelPoint())
|
l.cfg.NotifyActiveLink(l.ChannelPoint())
|
||||||
defer l.cfg.NotifyInactiveLinkEvent(*l.ChannelPoint())
|
defer l.cfg.NotifyInactiveLinkEvent(l.ChannelPoint())
|
||||||
|
|
||||||
// TODO(roasbeef): need to call wipe chan whenever D/C?
|
// 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
|
// we can go ahead and send the active channel notification. We'll also
|
||||||
// defer the inactive notification for when the link exits to ensure
|
// defer the inactive notification for when the link exits to ensure
|
||||||
// that every active notification is matched by an inactive one.
|
// that every active notification is matched by an inactive one.
|
||||||
l.cfg.NotifyActiveChannel(*l.ChannelPoint())
|
l.cfg.NotifyActiveChannel(l.ChannelPoint())
|
||||||
defer l.cfg.NotifyInactiveChannel(*l.ChannelPoint())
|
defer l.cfg.NotifyInactiveChannel(l.ChannelPoint())
|
||||||
|
|
||||||
// With the channel states synced, we now reset the mailbox to ensure
|
// With the channel states synced, we now reset the mailbox to ensure
|
||||||
// we start processing all unacked packets in order. This is done here
|
// 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.
|
// ChannelPoint returns the channel outpoint for the channel link.
|
||||||
// NOTE: Part of the ChannelLink interface.
|
// NOTE: Part of the ChannelLink interface.
|
||||||
func (l *channelLink) ChannelPoint() *wire.OutPoint {
|
func (l *channelLink) ChannelPoint() wire.OutPoint {
|
||||||
chanPoint := l.channel.ChannelPoint()
|
return l.channel.ChannelPoint()
|
||||||
return &chanPoint
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShortChanID returns the short channel ID for the channel link. The short
|
// ShortChanID returns the short channel ID for the channel link. The short
|
||||||
|
|||||||
+4
-1
@@ -907,7 +907,10 @@ func (f *mockChannelLink) PeerPubKey() [33]byte {
|
|||||||
return f.peer.PubKey()
|
return f.peer.PubKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *mockChannelLink) ChannelPoint() *wire.OutPoint { return &wire.OutPoint{} }
|
func (f *mockChannelLink) ChannelPoint() wire.OutPoint {
|
||||||
|
return wire.OutPoint{}
|
||||||
|
}
|
||||||
|
|
||||||
func (f *mockChannelLink) Stop() {}
|
func (f *mockChannelLink) Stop() {}
|
||||||
func (f *mockChannelLink) EligibleToForward() bool { return f.eligible }
|
func (f *mockChannelLink) EligibleToForward() bool { return f.eligible }
|
||||||
func (f *mockChannelLink) MayAddOutgoingHtlc(lnwire.MilliSatoshi) error { return nil }
|
func (f *mockChannelLink) MayAddOutgoingHtlc(lnwire.MilliSatoshi) error { return nil }
|
||||||
|
|||||||
Reference in new issue
Block a user