lncli: add --no_publish to PSBT channel opening

This commit is contained in:
Oliver Gugger 2020-07-08 17:13:26 -07:00 committed by Conner Fromknecht
parent 56b916a313
commit 563e56987b
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -163,6 +163,15 @@ var openChannelCommand = cli.Command{
"as a base and add the new channel output to " + "as a base and add the new channel output to " +
"it instead of creating a new, empty one.", "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{ cli.Uint64Flag{
Name: "remote_max_value_in_flight_msat", Name: "remote_max_value_in_flight_msat",
Usage: "(optional) the maximum value in msat that " + Usage: "(optional) the maximum value in msat that " +
@ -270,6 +279,10 @@ func openChannel(ctx *cli.Context) error {
if ctx.Bool("psbt") { if ctx.Bool("psbt") {
return openChannelPsbt(ctx, client, req) 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) stream, err := client.OpenChannel(ctxb, req)
if err != nil { if err != nil {
@ -388,6 +401,7 @@ func openChannelPsbt(ctx *cli.Context, client lnrpc.LightningClient,
PsbtShim: &lnrpc.PsbtShim{ PsbtShim: &lnrpc.PsbtShim{
PendingChanId: pendingChanID[:], PendingChanId: pendingChanID[:],
BasePsbt: basePsbtBytes, BasePsbt: basePsbtBytes,
NoPublish: ctx.Bool("no_publish"),
}, },
}, },
} }