From 13449fb7eaa94e719a0c18e4131888039a570624 Mon Sep 17 00:00:00 2001 From: carla Date: Mon, 27 Jul 2020 13:00:46 +0200 Subject: [PATCH] loop: add htlc confirmations flag to loop out command --- cmd/loop/loopout.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/loop/loopout.go b/cmd/loop/loopout.go index be04053..2c8c380 100644 --- a/cmd/loop/loopout.go +++ b/cmd/loop/loopout.go @@ -10,6 +10,7 @@ import ( "github.com/btcsuite/btcutil" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/labels" + "github.com/lightninglabs/loop/loopdb" "github.com/lightninglabs/loop/looprpc" "github.com/urfave/cli" ) @@ -42,6 +43,13 @@ var loopOutCommand = cli.Command{ Name: "amt", Usage: "the amount in satoshis to loop out", }, + cli.Uint64Flag{ + Name: "htlc_confs", + Usage: "the number of of confirmations, in blocks " + + "that we require for the htlc extended by " + + "the server before we reveal the preimage.", + Value: uint64(loopdb.DefaultLoopOutHtlcConfirmations), + }, cli.Uint64Flag{ Name: "conf_target", Usage: "the number of blocks from the swap " + @@ -135,6 +143,11 @@ func loopOut(ctx *cli.Context) error { } sweepConfTarget := int32(ctx.Uint64("conf_target")) + htlcConfs := int32(ctx.Uint64("htlc_confs")) + if htlcConfs == 0 { + return fmt.Errorf("at least 1 confirmation required for htlcs") + } + quoteReq := &looprpc.QuoteRequest{ Amt: int64(amt), ConfTarget: sweepConfTarget, @@ -179,6 +192,7 @@ func loopOut(ctx *cli.Context) error { MaxSwapRoutingFee: int64(limits.maxSwapRoutingFee), OutgoingChanSet: outgoingChanSet, SweepConfTarget: sweepConfTarget, + HtlcConfirmations: htlcConfs, SwapPublicationDeadline: uint64(swapDeadline.Unix()), Label: label, })