Skip to main content

UpdateChannelPolicy

UpdateChannelPolicy allows the caller to update the fee schedule and channel policies for all channels globally, or a particular channel.

Source: lightning.proto

gRPC

rpc UpdateChannelPolicy (PolicyUpdateRequest) returns (PolicyUpdateResponse);

REST

HTTP MethodPath
POST /v1/chanpolicy

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 = {
global: <bool>,
chan_point: <ChannelPoint>,
base_fee_msat: <int64>,
fee_rate: <double>,
fee_rate_ppm: <uint32>,
time_lock_delta: <uint32>,
max_htlc_msat: <uint64>,
min_htlc_msat: <uint64>,
min_htlc_msat_specified: <bool>,
inbound_fee: <InboundFee>,
};
client.updateChannelPolicy(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "failed_updates": <FailedUpdate>,
// }

Messages

lnrpc.PolicyUpdateRequest

Source: lightning.proto

FieldgRPC TypeREST TypeREST Placement
global
boolbooleanbody
chan_point
ChannelPointobjectbody
base_fee_msat
int64stringbody
fee_rate
doublenumberbody
fee_rate_ppm
uint32integerbody
time_lock_delta
uint32integerbody
max_htlc_msat
uint64stringbody
min_htlc_msat
uint64stringbody
min_htlc_msat_specified
boolbooleanbody
inbound_fee
InboundFeeobjectbody

lnrpc.PolicyUpdateResponse

Source: lightning.proto

FieldgRPC TypeREST Type
failed_updates
FailedUpdate[]array

Nested Messages

lnrpc.ChannelPoint

FieldgRPC TypeREST Type
funding_txid_bytes
bytesstring
funding_txid_str
stringstring
output_index
uint32integer

lnrpc.FailedUpdate

FieldgRPC TypeREST Type
outpoint
OutPointobject
reason
UpdateFailurestring
update_error
stringstring

lnrpc.InboundFee

FieldgRPC TypeREST Type
base_fee_msat
int32integer
fee_rate_ppm
int32integer

lnrpc.OutPoint

FieldgRPC TypeREST Type
txid_bytes
bytesstring
txid_str
stringstring
output_index
uint32integer

Enums

lnrpc.UpdateFailure

NameNumber
UPDATE_FAILURE_UNKNOWN
0
UPDATE_FAILURE_PENDING
1
UPDATE_FAILURE_NOT_FOUND
2
UPDATE_FAILURE_INTERNAL_ERR
3
UPDATE_FAILURE_INVALID_PARAMETER
4