lnpeer

package
v0.18.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPeerExiting signals that the peer received a disconnect request.
	ErrPeerExiting = fmt.Errorf("peer exiting")
)

Functions

This section is empty.

Types

type MockPeer

type MockPeer struct {
	mock.Mock
}

MockPeer implements the `lnpeer.Peer` interface.

func (*MockPeer) AddNewChannel

func (m *MockPeer) AddNewChannel(channel *NewChannel,
	cancel <-chan struct{}) error

func (*MockPeer) AddPendingChannel

func (m *MockPeer) AddPendingChannel(cid lnwire.ChannelID,
	cancel <-chan struct{}) error

func (*MockPeer) Address

func (m *MockPeer) Address() net.Addr

func (*MockPeer) IdentityKey

func (m *MockPeer) IdentityKey() *btcec.PublicKey

func (*MockPeer) LocalFeatures

func (m *MockPeer) LocalFeatures() *lnwire.FeatureVector

func (*MockPeer) PubKey

func (m *MockPeer) PubKey() [33]byte

func (*MockPeer) QuitSignal

func (m *MockPeer) QuitSignal() <-chan struct{}

func (*MockPeer) RemoteFeatures

func (m *MockPeer) RemoteFeatures() *lnwire.FeatureVector

func (*MockPeer) RemovePendingChannel

func (m *MockPeer) RemovePendingChannel(cid lnwire.ChannelID) error

func (*MockPeer) SendMessage

func (m *MockPeer) SendMessage(sync bool, msgs ...lnwire.Message) error

func (*MockPeer) SendMessageLazy

func (m *MockPeer) SendMessageLazy(sync bool, msgs ...lnwire.Message) error

func (*MockPeer) WipeChannel

func (m *MockPeer) WipeChannel(op *wire.OutPoint)

type NewChannel

type NewChannel struct {
	*channeldb.OpenChannel

	// ChanOpts can be used to change how the channel is created.
	ChanOpts []lnwallet.ChannelOpt
}

NewChannel is a newly funded channel. This struct couples a channel along with the set of channel options that may change how the channel is created. This can be used to pass along the nonce state needed for taproot channels.

type Peer

type Peer interface {
	// SendMessage sends a variadic number of high-priority message to
	// remote peer.  The first argument denotes if the method should block
	// until the messages have been sent to the remote peer or an error is
	// returned, otherwise it returns immediately after queuing.
	SendMessage(sync bool, msgs ...lnwire.Message) error

	// SendMessageLazy sends a variadic number of low-priority message to
	// remote peer. The first argument denotes if the method should block
	// until the messages have been sent to the remote peer or an error is
	// returned, otherwise it returns immediately after queueing.
	SendMessageLazy(sync bool, msgs ...lnwire.Message) error

	// AddNewChannel adds a new channel to the peer. The channel should fail
	// to be added if the cancel channel is closed.
	AddNewChannel(newChan *NewChannel, cancel <-chan struct{}) error

	// AddPendingChannel adds a pending open channel ID to the peer. The
	// channel should fail to be added if the cancel chan is closed.
	AddPendingChannel(cid lnwire.ChannelID, cancel <-chan struct{}) error

	// RemovePendingChannel removes a pending open channel ID to the peer.
	RemovePendingChannel(cid lnwire.ChannelID) error

	// WipeChannel removes the channel uniquely identified by its channel
	// point from all indexes associated with the peer.
	WipeChannel(*wire.OutPoint)

	// PubKey returns the serialized public key of the remote peer.
	PubKey() [33]byte

	// IdentityKey returns the public key of the remote peer.
	IdentityKey() *btcec.PublicKey

	// Address returns the network address of the remote peer.
	Address() net.Addr

	// QuitSignal is a method that should return a channel which will be
	// sent upon or closed once the backing peer exits. This allows callers
	// using the interface to cancel any processing in the event the backing
	// implementation exits.
	QuitSignal() <-chan struct{}

	// LocalFeatures returns the set of features that has been advertised by
	// the us to the remote peer. This allows sub-systems that use this
	// interface to gate their behavior off the set of negotiated feature
	// bits.
	LocalFeatures() *lnwire.FeatureVector

	// RemoteFeatures returns the set of 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.
	RemoteFeatures() *lnwire.FeatureVector
}

Peer is an interface which represents a remote lightning node.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL