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
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
"github.com/lightningnetwork/lnd/invoices"
|
||||
"github.com/lightningnetwork/lnd/lnpeer"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -262,9 +261,9 @@ type ChannelLink interface {
|
||||
// total sent/received milli-satoshis.
|
||||
Stats() (uint64, lnwire.MilliSatoshi, lnwire.MilliSatoshi)
|
||||
|
||||
// Peer returns the representation of remote peer with which we have
|
||||
// the channel link opened.
|
||||
Peer() lnpeer.Peer
|
||||
// Peer returns the serialized public key of remote peer with which we
|
||||
// have the channel link opened.
|
||||
PeerPubKey() [33]byte
|
||||
|
||||
// AttachMailBox delivers an active MailBox to the link. The MailBox may
|
||||
// have buffered messages.
|
||||
|
||||
Reference in new issue
Block a user