Skip to content

Commit 13449fb

Browse files
committed
loop: add htlc confirmations flag to loop out command
1 parent 852f459 commit 13449fb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cmd/loop/loopout.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/btcsuite/btcutil"
1111
"github.com/lightninglabs/loop"
1212
"github.com/lightninglabs/loop/labels"
13+
"github.com/lightninglabs/loop/loopdb"
1314
"github.com/lightninglabs/loop/looprpc"
1415
"github.com/urfave/cli"
1516
)
@@ -42,6 +43,13 @@ var loopOutCommand = cli.Command{
4243
Name: "amt",
4344
Usage: "the amount in satoshis to loop out",
4445
},
46+
cli.Uint64Flag{
47+
Name: "htlc_confs",
48+
Usage: "the number of of confirmations, in blocks " +
49+
"that we require for the htlc extended by " +
50+
"the server before we reveal the preimage.",
51+
Value: uint64(loopdb.DefaultLoopOutHtlcConfirmations),
52+
},
4553
cli.Uint64Flag{
4654
Name: "conf_target",
4755
Usage: "the number of blocks from the swap " +
@@ -135,6 +143,11 @@ func loopOut(ctx *cli.Context) error {
135143
}
136144

137145
sweepConfTarget := int32(ctx.Uint64("conf_target"))
146+
htlcConfs := int32(ctx.Uint64("htlc_confs"))
147+
if htlcConfs == 0 {
148+
return fmt.Errorf("at least 1 confirmation required for htlcs")
149+
}
150+
138151
quoteReq := &looprpc.QuoteRequest{
139152
Amt: int64(amt),
140153
ConfTarget: sweepConfTarget,
@@ -179,6 +192,7 @@ func loopOut(ctx *cli.Context) error {
179192
MaxSwapRoutingFee: int64(limits.maxSwapRoutingFee),
180193
OutgoingChanSet: outgoingChanSet,
181194
SweepConfTarget: sweepConfTarget,
195+
HtlcConfirmations: htlcConfs,
182196
SwapPublicationDeadline: uint64(swapDeadline.Unix()),
183197
Label: label,
184198
})

0 commit comments

Comments
 (0)