Skip to main content

PendingChannels

PendingChannels returns a list of all the channels that are currently considered "pending". A channel is pending if it has finished the funding workflow and is waiting for confirmations for the funding txn, or is in the process of closure, either initiated cooperatively or non-cooperatively.

Source: lightning.proto

gRPC

rpc PendingChannels (PendingChannelsRequest) returns (PendingChannelsResponse);

REST

HTTP MethodPath
GET /v1/channels/pending

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 = {};
client.pendingChannels(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "total_limbo_balance": <int64>,
// "pending_open_channels": <PendingOpenChannel>,
// "pending_closing_channels": <ClosedChannel>,
// "pending_force_closing_channels": <ForceClosedChannel>,
// "waiting_close_channels": <WaitingCloseChannel>,
// }

Messages

lnrpc.PendingChannelsRequest

Source: lightning.proto

note

This request has no parameters.

lnrpc.PendingChannelsResponse

Source: lightning.proto

FieldgRPC TypeREST Type
total_limbo_balance
int64string
pending_open_channels
PendingOpenChannel[]array
pending_closing_channels
ClosedChannel[]array
pending_force_closing_channels
ForceClosedChannel[]array
waiting_close_channels
WaitingCloseChannel[]array

Nested Messages

lnrpc.PendingChannelsResponse.PendingOpenChannel

FieldgRPC TypeREST Type
channel
PendingChannelunknown
commit_fee
int64unknown
commit_weight
int64unknown
fee_per_kw
int64unknown

lnrpc.PendingChannelsResponse.PendingChannel

FieldgRPC TypeREST Type
remote_node_pub
stringunknown
channel_point
stringunknown
capacity
int64unknown
local_balance
int64unknown
remote_balance
int64unknown
local_chan_reserve_sat
int64unknown
remote_chan_reserve_sat
int64unknown
initiator
Initiatorunknown
commitment_type
CommitmentTypeunknown
num_forwarding_packages
int64unknown
chan_status_flags
stringunknown
private
boolunknown

lnrpc.PendingChannelsResponse.ClosedChannel

FieldgRPC TypeREST Type
channel
PendingChannelunknown
closing_txid
stringunknown

lnrpc.PendingChannelsResponse.ForceClosedChannel

FieldgRPC TypeREST Type
channel
PendingChannelunknown
closing_txid
stringunknown
limbo_balance
int64unknown
maturity_height
uint32unknown
blocks_til_maturity
int32unknown
recovered_balance
int64unknown
pending_htlcs
PendingHTLC[]unknown
anchor
AnchorStateunknown

lnrpc.PendingHTLC

FieldgRPC TypeREST Type
incoming
boolboolean
amount
int64string
outpoint
stringstring
maturity_height
uint32integer
blocks_til_maturity
int32integer
stage
uint32integer

lnrpc.PendingChannelsResponse.WaitingCloseChannel

FieldgRPC TypeREST Type
channel
PendingChannelunknown
limbo_balance
int64unknown
commitments
Commitmentsunknown
closing_txid
stringunknown

lnrpc.PendingChannelsResponse.Commitments

FieldgRPC TypeREST Type
local_txid
stringunknown
remote_txid
stringunknown
remote_pending_txid
stringunknown
local_commit_fee_sat
uint64unknown
remote_commit_fee_sat
uint64unknown
remote_pending_commit_fee_sat
uint64unknown

Enums

lnrpc.Initiator

NameNumber
INITIATOR_UNKNOWN
0
INITIATOR_LOCAL
1
INITIATOR_REMOTE
2
INITIATOR_BOTH
3

lnrpc.CommitmentType

NameNumber
UNKNOWN_COMMITMENT_TYPE
0
LEGACY
1
STATIC_REMOTE_KEY
2
ANCHORS
3
SCRIPT_ENFORCED_LEASE
4

lnrpc.PendingChannelsResponse.ForceClosedChannel.AnchorState

NameNumber
LIMBO
0
RECOVERED
1
LOST
2