From b2d1d99521e21fa15efd9c3c73ccb8d74979cfeb Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 7 Jan 2020 13:52:42 +0100 Subject: [PATCH] loopd call swapserver with SwapPublicationDeadline set --- interface.go | 4 ++++ loopd/swapclient_server.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/interface.go b/interface.go index 94d709b..e445b66 100644 --- a/interface.go +++ b/interface.go @@ -99,6 +99,10 @@ type LoopOutQuoteRequest struct { // client sweep tx. SweepConfTarget int32 + // SwapPublicationDeadline can be set by the client to allow the server + // delaying publication of the swap HTLC to save on chain fees. + SwapPublicationDeadline time.Time + // TODO: Add argument to specify confirmation target for server // publishing htlc. This may influence the swap fee quote, because the // server needs to pay more for faster confirmations. diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index 232061f..4f704ab 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -266,6 +266,9 @@ func (s *swapClientServer) LoopOutQuote(ctx context.Context, quote, err := s.impl.LoopOutQuote(ctx, &loop.LoopOutQuoteRequest{ Amount: btcutil.Amount(req.Amt), SweepConfTarget: confTarget, + SwapPublicationDeadline: time.Unix( + int64(req.SwapPublicationDeadline), 0, + ), }) if err != nil { return nil, err