Skip to main content

AbandonChannel

AbandonChannel removes all channel state from the database except for a close summary. This method can be used to get rid of permanently unusable channels due to bugs fixed in newer versions of lnd. This method can also be used to remove externally funded channels where the funding transaction was never broadcast. Only available for non-externally funded channels in dev build.

Source: lightning.proto

gRPC

rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse);

REST

HTTP MethodPath
DELETE /v1/channels/abandon/{channel_point.funding_txid_str}/{channel_point.output_index}

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 = {
channel_point: <ChannelPoint>,
pending_funding_shim_only: <bool>,
i_know_what_i_am_doing: <bool>,
};
client.abandonChannel(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "status": <string>,
// }

Messages

lnrpc.AbandonChannelRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
channel_point
ChannelPointobjectmixed
pending_funding_shim_only
boolbooleanquery
i_know_what_i_am_doing
boolbooleanquery

lnrpc.AbandonChannelResponse

Source: lightning.proto

FieldgRPC TypeREST Type
status
stringstring

Nested Messages

lnrpc.ChannelPoint

FieldgRPC TypeREST Type
funding_txid_bytes
bytesstring
funding_txid_str
stringstring
output_index
uint32integer