Skip to main content

ClosedChannels

ClosedChannels returns a description of all the closed channels that this node was a participant in.

Source: lightning.proto

gRPC

rpc ClosedChannels (ClosedChannelsRequest) returns (ClosedChannelsResponse);

REST

HTTP MethodPath
GET /v1/channels/closed

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 = {
cooperative: <bool>,
local_force: <bool>,
remote_force: <bool>,
breach: <bool>,
funding_canceled: <bool>,
abandoned: <bool>,
};
client.closedChannels(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "channels": <ChannelCloseSummary>,
// }

Messages

lnrpc.ClosedChannelsRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
cooperative
boolbooleanquery
local_force
boolbooleanquery
remote_force
boolbooleanquery
breach
boolbooleanquery
funding_canceled
boolbooleanquery
abandoned
boolbooleanquery

lnrpc.ClosedChannelsResponse

Source: lightning.proto

FieldgRPC TypeREST Type
channels
ChannelCloseSummary[]array

Nested Messages

lnrpc.ChannelCloseSummary

FieldgRPC TypeREST Type
channel_point
stringstring
chan_id
uint64string
chain_hash
stringstring
closing_tx_hash
stringstring
remote_pubkey
stringstring
capacity
int64string
close_height
uint32integer
settled_balance
int64string
time_locked_balance
int64string
close_type
ClosureTypestring
open_initiator
Initiatorstring
close_initiator
Initiatorstring
resolutions
Resolution[]array
alias_scids
uint64[]array
zero_conf_confirmed_scid
uint64string

lnrpc.OutPoint

FieldgRPC TypeREST Type
txid_bytes
bytesstring
txid_str
stringstring
output_index
uint32integer

lnrpc.Resolution

FieldgRPC TypeREST Type
resolution_type
ResolutionTypestring
outcome
ResolutionOutcomestring
outpoint
OutPointobject
amount_sat
uint64string
sweep_txid
stringstring

Enums

lnrpc.ChannelCloseSummary.ClosureType

NameNumber
COOPERATIVE_CLOSE
0
LOCAL_FORCE_CLOSE
1
REMOTE_FORCE_CLOSE
2
BREACH_CLOSE
3
FUNDING_CANCELED
4
ABANDONED
5

lnrpc.Initiator

NameNumber
INITIATOR_UNKNOWN
0
INITIATOR_LOCAL
1
INITIATOR_REMOTE
2
INITIATOR_BOTH
3

lnrpc.ResolutionOutcome

NameNumber
OUTCOME_UNKNOWN
0
CLAIMED
1
UNCLAIMED
2
ABANDONED
3
FIRST_STAGE
4
TIMEOUT
5

lnrpc.ResolutionType

NameNumber
TYPE_UNKNOWN
0
ANCHOR
1
INCOMING_HTLC
2
OUTGOING_HTLC
3
COMMIT
4