peer+lnpeer: add new methods to expose local+global features for lnpeer interface
This commit is contained in:
parent
a58cfa65ff
commit
3f8526a0ca
@ -56,6 +56,12 @@ func (p *mockPeer) Address() net.Addr { return nil }
|
|||||||
func (p *mockPeer) QuitSignal() <-chan struct{} {
|
func (p *mockPeer) QuitSignal() <-chan struct{} {
|
||||||
return p.quit
|
return p.quit
|
||||||
}
|
}
|
||||||
|
func (p *mockPeer) LocalGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (p *mockPeer) RemoteGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// mockMessageStore is an in-memory implementation of the MessageStore interface
|
// mockMessageStore is an in-memory implementation of the MessageStore interface
|
||||||
// used for the gossiper's unit tests.
|
// used for the gossiper's unit tests.
|
||||||
|
@ -183,6 +183,14 @@ func (n *testNode) QuitSignal() <-chan struct{} {
|
|||||||
return n.shutdownChannel
|
return n.shutdownChannel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *testNode) LocalGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return lnwire.NewFeatureVector(nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n *testNode) RemoteGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return lnwire.NewFeatureVector(nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
func (n *testNode) AddNewChannel(channel *channeldb.OpenChannel,
|
func (n *testNode) AddNewChannel(channel *channeldb.OpenChannel,
|
||||||
quit <-chan struct{}) error {
|
quit <-chan struct{}) error {
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/lightningnetwork/lightning-onion"
|
sphinx "github.com/lightningnetwork/lightning-onion"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1651,6 +1651,12 @@ func (m *mockPeer) IdentityKey() *btcec.PublicKey {
|
|||||||
func (m *mockPeer) Address() net.Addr {
|
func (m *mockPeer) Address() net.Addr {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *mockPeer) LocalGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *mockPeer) RemoteGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func newSingleLinkTestHarness(chanAmt, chanReserve btcutil.Amount) (
|
func newSingleLinkTestHarness(chanAmt, chanReserve btcutil.Amount) (
|
||||||
ChannelLink, *lnwallet.LightningChannel, chan time.Time, func() error,
|
ChannelLink, *lnwallet.LightningChannel, chan time.Time, func() error,
|
||||||
|
@ -597,6 +597,14 @@ func (s *mockServer) WipeChannel(*wire.OutPoint) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *mockServer) LocalGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *mockServer) RemoteGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *mockServer) Stop() error {
|
func (s *mockServer) Stop() error {
|
||||||
if !atomic.CompareAndSwapInt32(&s.shutdown, 0, 1) {
|
if !atomic.CompareAndSwapInt32(&s.shutdown, 0, 1) {
|
||||||
return nil
|
return nil
|
||||||
|
@ -46,4 +46,16 @@ type Peer interface {
|
|||||||
// using the interface to cancel any processing in the event the backing
|
// using the interface to cancel any processing in the event the backing
|
||||||
// implementation exits.
|
// implementation exits.
|
||||||
QuitSignal() <-chan struct{}
|
QuitSignal() <-chan struct{}
|
||||||
|
|
||||||
|
// LocalGlobalFeatures returns the set of global features that has been
|
||||||
|
// advertised by the local peer. This allows sub-systems that use this
|
||||||
|
// interface to gate their behavior off the set of negotiated feature
|
||||||
|
// bits.
|
||||||
|
LocalGlobalFeatures() *lnwire.FeatureVector
|
||||||
|
|
||||||
|
// RemoteGlobalFeatures returns the set of global features that has
|
||||||
|
// been advertised by the remote peer. This allows sub-systems that use
|
||||||
|
// this interface to gate their behavior off the set of negotiated
|
||||||
|
// feature bits.
|
||||||
|
RemoteGlobalFeatures() *lnwire.FeatureVector
|
||||||
}
|
}
|
||||||
|
18
peer.go
18
peer.go
@ -2410,6 +2410,24 @@ func (p *peer) handleInitMsg(msg *lnwire.Init) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LocalGlobalFeatures returns the set of global features that has been
|
||||||
|
// advertised by the local node. This allows sub-systems that use this
|
||||||
|
// interface to gate their behavior off the set of negotiated feature bits.
|
||||||
|
//
|
||||||
|
// NOTE: Part of the lnpeer.Peer interface.
|
||||||
|
func (p *peer) LocalGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return p.server.globalFeatures
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoteGlobalFeatures returns the set of global features that has been
|
||||||
|
// advertised by the remote node. This allows sub-systems that use this
|
||||||
|
// interface to gate their behavior off the set of negotiated feature bits.
|
||||||
|
//
|
||||||
|
// NOTE: Part of the lnpeer.Peer interface.
|
||||||
|
func (p *peer) RemoteGlobalFeatures() *lnwire.FeatureVector {
|
||||||
|
return p.remoteGlobalFeatures
|
||||||
|
}
|
||||||
|
|
||||||
// sendInitMsg sends init message to remote peer which contains our currently
|
// sendInitMsg sends init message to remote peer which contains our currently
|
||||||
// supported local and global features.
|
// supported local and global features.
|
||||||
func (p *peer) sendInitMsg() error {
|
func (p *peer) sendInitMsg() error {
|
||||||
|
Loading…
Reference in New Issue
Block a user