mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-10 14:17:56 +01:00
chanacceptor: Adding Chained and RPC acceptors
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.
This commit is contained in:
25
chanacceptor/interface.go
Normal file
25
chanacceptor/interface.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user