From 18608a6aa38c03b6d650b6cc41eea86cff4cd03e Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 7 Jan 2020 13:47:07 +0100 Subject: [PATCH] cmd/loop: account for fast swap in loopout cmd quote --- cmd/loop/loopout.go | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cmd/loop/loopout.go b/cmd/loop/loopout.go index 64d80c3..bb05970 100644 --- a/cmd/loop/loopout.go +++ b/cmd/loop/loopout.go @@ -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,