From 9609aa332e7f271f87dbc19008b73fa5c8eb73d8 Mon Sep 17 00:00:00 2001 From: Jesse de Wit Date: Tue, 2 Jul 2024 11:35:06 +0200 Subject: [PATCH] lncli: add create_missing_edge --- cmd/commands/commands.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/cmd/commands/commands.go b/cmd/commands/commands.go index 06759990f..5241c8a77 100644 --- a/cmd/commands/commands.go +++ b/cmd/commands/commands.go @@ -2327,6 +2327,21 @@ var updateChannelPolicyCommand = cli.Command{ "channels will be updated. Takes the form of " + "txid:output_index", }, + cli.BoolFlag{ + Name: "create_missing_edge", + Usage: "Under unknown circumstances a channel can " + + "exist with a missing edge in the graph " + + "database. This can cause an 'edge not " + + "found' error when calling `getchaninfo` " + + "and/or cause the default channel policy to " + + "be used during forwards. Setting this flag " + + "will recreate the edge if not found, " + + "allowing updating this channel policy and " + + "fixing the missing edge problem for this " + + "channel permanently. For fields not set in " + + "this command, the default policy will be " + + "created.", + }, }, Action: actionDecorator(updateChannelPolicy), } @@ -2486,11 +2501,14 @@ func updateChannelPolicy(ctx *cli.Context) error { } } + createMissingEdge := ctx.Bool("create_missing_edge") + req := &lnrpc.PolicyUpdateRequest{ - BaseFeeMsat: baseFee, - TimeLockDelta: uint32(timeLockDelta), - MaxHtlcMsat: ctx.Uint64("max_htlc_msat"), - InboundFee: inboundFee, + BaseFeeMsat: baseFee, + TimeLockDelta: uint32(timeLockDelta), + MaxHtlcMsat: ctx.Uint64("max_htlc_msat"), + InboundFee: inboundFee, + CreateMissingEdge: createMissingEdge, } if ctx.IsSet("min_htlc_msat") {