From 563e56987b0a73439afa1e6214b3c205aceaf599 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Wed, 8 Jul 2020 17:13:26 -0700 Subject: [PATCH] lncli: add --no_publish to PSBT channel opening --- cmd/lncli/cmd_open_channel.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/lncli/cmd_open_channel.go b/cmd/lncli/cmd_open_channel.go index 5ba7fea9e..b7e78d132 100644 --- a/cmd/lncli/cmd_open_channel.go +++ b/cmd/lncli/cmd_open_channel.go @@ -163,6 +163,15 @@ var openChannelCommand = cli.Command{ "as a base and add the new channel output to " + "it instead of creating a new, empty one.", }, + cli.BoolFlag{ + Name: "no_publish", + Usage: "when using the interactive PSBT mode to open " + + "multiple channels in a batch, this flag " + + "instructs lnd to not publish the full batch " + + "transaction just yet. For safety reasons " + + "this flag should be set for each of the " + + "batch's transactions except the very last", + }, cli.Uint64Flag{ Name: "remote_max_value_in_flight_msat", Usage: "(optional) the maximum value in msat that " + @@ -270,6 +279,10 @@ func openChannel(ctx *cli.Context) error { if ctx.Bool("psbt") { return openChannelPsbt(ctx, client, req) } + if !ctx.Bool("psbt") && ctx.Bool("no_publish") { + return fmt.Errorf("the --no_publish flag can only be used in " + + "combination with the --psbt flag") + } stream, err := client.OpenChannel(ctxb, req) if err != nil { @@ -388,6 +401,7 @@ func openChannelPsbt(ctx *cli.Context, client lnrpc.LightningClient, PsbtShim: &lnrpc.PsbtShim{ PendingChanId: pendingChanID[:], BasePsbt: basePsbtBytes, + NoPublish: ctx.Bool("no_publish"), }, }, }