Skip to content

Commit 18608a6

Browse files
committed
cmd/loop: account for fast swap in loopout cmd quote
1 parent dcc5a8c commit 18608a6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cmd/loop/loopout.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,26 @@ func loopOut(ctx *cli.Context) error {
9393
}
9494
defer cleanup()
9595

96+
// Set our maximum swap wait time. If a fast swap is requested we set
97+
// it to now, otherwise to 30 minutes in the future.
98+
fast := ctx.Bool("fast")
99+
swapDeadline := time.Now()
100+
if !fast {
101+
swapDeadline = time.Now().Add(defaultSwapWaitTime)
102+
}
103+
96104
sweepConfTarget := int32(ctx.Uint64("conf_target"))
97105
quoteReq := &looprpc.QuoteRequest{
98-
Amt: int64(amt),
99-
ConfTarget: sweepConfTarget,
106+
Amt: int64(amt),
107+
ConfTarget: sweepConfTarget,
108+
SwapPublicationDeadline: uint64(swapDeadline.Unix()),
100109
}
101110
quote, err := client.LoopOutQuote(context.Background(), quoteReq)
102111
if err != nil {
103112
return err
104113
}
105114

106115
// Show a warning if a slow swap was requested.
107-
fast := ctx.Bool("fast")
108116
warning := ""
109117
if fast {
110118
warning = "Fast swap requested."
@@ -125,13 +133,6 @@ func loopOut(ctx *cli.Context) error {
125133
unchargeChannel = ctx.Uint64("channel")
126134
}
127135

128-
// Set our maximum swap wait time. If a fast swap is requested we set
129-
// it to now, otherwise to 30 minutes in the future.
130-
swapDeadline := time.Now()
131-
if !fast {
132-
swapDeadline = time.Now().Add(defaultSwapWaitTime)
133-
}
134-
135136
resp, err := client.LoopOut(context.Background(), &looprpc.LoopOutRequest{
136137
Amt: int64(amt),
137138
Dest: destAddr,

0 commit comments

Comments
 (0)