htlcswitch: avoid leaking peer interface from link
Here we notice that the only use of the Peer call on the link is to find out what the peer's pubkey is. To avoid leaking handles to IO actions outside the interface we reduce the surface area to just return the peer's public key.
This commit is contained in:
1 parent
be69b022d9
commit
3761912680
4 files changed
+26
-15
No files matched your search
+16
-4
@@ -891,10 +891,22 @@ func (f *mockChannelLink) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *mockChannelLink) ChanID() lnwire.ChannelID { return f.chanID }
|
||||
func (f *mockChannelLink) ShortChanID() lnwire.ShortChannelID { return f.shortChanID }
|
||||
func (f *mockChannelLink) Bandwidth() lnwire.MilliSatoshi { return 99999999 }
|
||||
func (f *mockChannelLink) Peer() lnpeer.Peer { return f.peer }
|
||||
func (f *mockChannelLink) ChanID() lnwire.ChannelID {
|
||||
return f.chanID
|
||||
}
|
||||
|
||||
func (f *mockChannelLink) ShortChanID() lnwire.ShortChannelID {
|
||||
return f.shortChanID
|
||||
}
|
||||
|
||||
func (f *mockChannelLink) Bandwidth() lnwire.MilliSatoshi {
|
||||
return 99999999
|
||||
}
|
||||
|
||||
func (f *mockChannelLink) PeerPubKey() [33]byte {
|
||||
return f.peer.PubKey()
|
||||
}
|
||||
|
||||
func (f *mockChannelLink) ChannelPoint() *wire.OutPoint { return &wire.OutPoint{} }
|
||||
func (f *mockChannelLink) Stop() {}
|
||||
func (f *mockChannelLink) EligibleToForward() bool { return f.eligible }
|
||||
|
||||
Reference in new issue
Block a user