Skip to main content

ChannelAcceptor

ChannelAcceptor dispatches a bi-directional streaming RPC in which OpenChannel requests are sent to the client and the client responds with a boolean that tells LND whether or not to accept the channel. This allows node operators to specify their own criteria for accepting inbound channels through a single persistent connection.

Source: lightning.proto

gRPC

info

This is a bidirectional-streaming RPC

rpc ChannelAcceptor (stream ChannelAcceptResponse) returns (stream ChannelAcceptRequest);

REST

HTTP MethodPath
POST /v1/channels/acceptor

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10009'
const MACAROON_PATH = 'LND_DIR/data/chain/bitcoin/regtest/admin.macaroon'
const TLS_PATH = 'LND_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('lightning.proto', loaderOptions);
const lnrpc = grpc.loadPackageDefinition(packageDefinition).lnrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new lnrpc.Lightning(GRPC_HOST, creds);
let request = {
accept: <bool>,
pending_chan_id: <bytes>,
error: <string>,
upfront_shutdown: <string>,
csv_delay: <uint32>,
reserve_sat: <uint64>,
in_flight_max_msat: <uint64>,
max_htlc_count: <uint32>,
min_htlc_in: <uint64>,
min_accept_depth: <uint32>,
zero_conf: <bool>,
};
let call = client.channelAcceptor({});
call.on('data', function(response) {
// A response was received from the server.
console.log(response);
});
call.on('status', function(status) {
// The current status of the stream.
});
call.on('end', function() {
// The server has closed the stream.
});
call.write(request);
// Console output:
// {
// "node_pubkey": <bytes>,
// "chain_hash": <bytes>,
// "pending_chan_id": <bytes>,
// "funding_amt": <uint64>,
// "push_amt": <uint64>,
// "dust_limit": <uint64>,
// "max_value_in_flight": <uint64>,
// "channel_reserve": <uint64>,
// "min_htlc": <uint64>,
// "fee_per_kw": <uint64>,
// "csv_delay": <uint32>,
// "max_accepted_htlcs": <uint32>,
// "channel_flags": <uint32>,
// "commitment_type": <CommitmentType>,
// "wants_zero_conf": <bool>,
// "wants_scid_alias": <bool>,
// }

Messages

lnrpc.ChannelAcceptResponse

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
accept
boolbooleanbody
pending_chan_id
bytesstringbody
error
stringstringbody
upfront_shutdown
stringstringbody
csv_delay
uint32integerbody
reserve_sat
uint64stringbody
in_flight_max_msat
uint64stringbody
max_htlc_count
uint32integerbody
min_htlc_in
uint64stringbody
min_accept_depth
uint32integerbody
zero_conf
boolbooleanbody

lnrpc.ChannelAcceptRequest

Source: lightning.proto

FieldgRPC TypeREST Type
node_pubkey
bytesstring
chain_hash
bytesstring
pending_chan_id
bytesstring
funding_amt
uint64string
push_amt
uint64string
dust_limit
uint64string
max_value_in_flight
uint64string
channel_reserve
uint64string
min_htlc
uint64string
fee_per_kw
uint64string
csv_delay
uint32integer
max_accepted_htlcs
uint32integer
channel_flags
uint32integer
commitment_type
CommitmentTypestring
wants_zero_conf
boolboolean
wants_scid_alias
boolboolean

Enums

lnrpc.CommitmentType

NameNumber
UNKNOWN_COMMITMENT_TYPE
0
LEGACY
1
STATIC_REMOTE_KEY
2
ANCHORS
3
SCRIPT_ENFORCED_LEASE
4