Skip to content

Commit 489ab56

Browse files
committed
loopd: receive external HTLC flag in loop in quote request
1 parent be9a2b9 commit 489ab56

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,15 @@ func (s *Client) LoopInQuote(ctx context.Context,
470470
request.Amount*btcutil.Amount(terms.SwapFeeRate)/
471471
btcutil.Amount(swap.FeeRateTotalParts)
472472

473+
// We don't calculate the on-chain fee if the HTLC is going to be
474+
// published externally.
475+
if request.ExternalHtlc {
476+
return &LoopInQuote{
477+
SwapFee: swapFee,
478+
MinerFee: 0,
479+
}, nil
480+
}
481+
473482
// Get estimate for miner fee.
474483
minerFee, err := s.lndServices.Client.EstimateFeeToP2WSH(
475484
ctx, request.Amount, request.HtlcConfTarget,

cmd/loopd/swapclient_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context,
306306
quote, err := s.impl.LoopInQuote(ctx, &loop.LoopInQuoteRequest{
307307
Amount: btcutil.Amount(req.Amt),
308308
HtlcConfTarget: defaultConfTarget,
309+
ExternalHtlc: req.ExternalHtlc,
309310
})
310311
if err != nil {
311312
return nil, err

interface.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ type LoopInQuoteRequest struct {
224224
// HtlcConfTarget specifies the targeted confirmation target for the
225225
// client sweep tx.
226226
HtlcConfTarget int32
227+
228+
// ExternalHtlc specifies whether the htlc is published by an external
229+
// source.
230+
ExternalHtlc bool
227231
}
228232

229233
// LoopInQuote contains estimates for the fees making up the total swap cost

0 commit comments

Comments
 (0)