cmd/loop: account for fast swap in loopout cmd quote

pull/129/head
Johan T. Halseth 4 years ago
parent dcc5a8ce88
commit 18608a6aa3
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -93,10 +93,19 @@ func loopOut(ctx *cli.Context) error {
}
defer cleanup()
// Set our maximum swap wait time. If a fast swap is requested we set
// it to now, otherwise to 30 minutes in the future.
fast := ctx.Bool("fast")
swapDeadline := time.Now()
if !fast {
swapDeadline = time.Now().Add(defaultSwapWaitTime)
}
sweepConfTarget := int32(ctx.Uint64("conf_target"))
quoteReq := &looprpc.QuoteRequest{
Amt: int64(amt),
ConfTarget: sweepConfTarget,
Amt: int64(amt),
ConfTarget: sweepConfTarget,
SwapPublicationDeadline: uint64(swapDeadline.Unix()),
}
quote, err := client.LoopOutQuote(context.Background(), quoteReq)
if err != nil {
@ -104,7 +113,6 @@ func loopOut(ctx *cli.Context) error {
}
// Show a warning if a slow swap was requested.
fast := ctx.Bool("fast")
warning := ""
if fast {
warning = "Fast swap requested."
@ -125,13 +133,6 @@ func loopOut(ctx *cli.Context) error {
unchargeChannel = ctx.Uint64("channel")
}
// Set our maximum swap wait time. If a fast swap is requested we set
// it to now, otherwise to 30 minutes in the future.
swapDeadline := time.Now()
if !fast {
swapDeadline = time.Now().Add(defaultSwapWaitTime)
}
resp, err := client.LoopOut(context.Background(), &looprpc.LoopOutRequest{
Amt: int64(amt),
Dest: destAddr,

Loading…
Cancel
Save