lnpeer: birth of peer package!

This commit moves the generic interface for
Lightning Network peers so that it can be
imported directly into the switch and gossiper.
Eventually, the majority of the peer logic
would be moved into this package for testing
and modularization.
This commit is contained in:
Conner Fromknecht 2018-06-07 20:05:32 -07:00
parent 15f812b10f
commit dcf76a59b2
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

26
lnpeer/peer.go Normal file

@ -0,0 +1,26 @@
package lnpeer
import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/roasbeef/btcd/btcec"
"github.com/roasbeef/btcd/wire"
)
// Peer is an interface which represents the remote lightning node inside our
// system.
type Peer interface {
// SendMessage sends a variadic number of message to remote peer. The
// first argument denotes if the method should block until the message
// has been sent to the remote peer.
SendMessage(sync bool, msg ...lnwire.Message) error
// WipeChannel removes the channel uniquely identified by its channel
// point from all indexes associated with the peer.
WipeChannel(*wire.OutPoint) error
// 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
}