2bd2e2e5ce
This commit introduces the chanacceptor package which is used to determine, by a set of heuristics, which open channel messages to accept and reject. Currently, two acceptors are implemented via the ChannelAcceptor interface: ChainedAcceptor and RPCAcceptor. The RPCAcceptor allows the RPC client to respond to the open channel request, and the ChainedAcceptor allows a conjunction of acceptors to be used.
26 lines
859 B
Go
26 lines
859 B
Go
package chanacceptor
|
|
|
|
import (
|
|
"github.com/btcsuite/btcd/btcec"
|
|
"github.com/lightningnetwork/lnd/lnwire"
|
|
)
|
|
|
|
// ChannelAcceptRequest is a struct containing the requesting node's public key
|
|
// along with the lnwire.OpenChannel message that they sent when requesting an
|
|
// inbound channel. This information is provided to each acceptor so that they
|
|
// can each leverage their own decision-making with this information.
|
|
type ChannelAcceptRequest struct {
|
|
// Node is the public key of the node requesting to open a channel.
|
|
Node *btcec.PublicKey
|
|
|
|
// OpenChanMsg is the actual OpenChannel protocol message that the peer
|
|
// sent to us.
|
|
OpenChanMsg *lnwire.OpenChannel
|
|
}
|
|
|
|
// ChannelAcceptor is an interface that represents a predicate on the data
|
|
// contained in ChannelAcceptRequest.
|
|
type ChannelAcceptor interface {
|
|
Accept(req *ChannelAcceptRequest) bool
|
|
}
|