loopd: receive external HTLC flag in loop in quote request

pull/86/head
Oliver Gugger 5 years ago
parent be9a2b9a47
commit 489ab5620e
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -470,6 +470,15 @@ func (s *Client) LoopInQuote(ctx context.Context,
request.Amount*btcutil.Amount(terms.SwapFeeRate)/
btcutil.Amount(swap.FeeRateTotalParts)
// We don't calculate the on-chain fee if the HTLC is going to be
// published externally.
if request.ExternalHtlc {
return &LoopInQuote{
SwapFee: swapFee,
MinerFee: 0,
}, nil
}
// Get estimate for miner fee.
minerFee, err := s.lndServices.Client.EstimateFeeToP2WSH(
ctx, request.Amount, request.HtlcConfTarget,

@ -306,6 +306,7 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context,
quote, err := s.impl.LoopInQuote(ctx, &loop.LoopInQuoteRequest{
Amount: btcutil.Amount(req.Amt),
HtlcConfTarget: defaultConfTarget,
ExternalHtlc: req.ExternalHtlc,
})
if err != nil {
return nil, err

@ -224,6 +224,10 @@ type LoopInQuoteRequest struct {
// HtlcConfTarget specifies the targeted confirmation target for the
// client sweep tx.
HtlcConfTarget int32
// ExternalHtlc specifies whether the htlc is published by an external
// source.
ExternalHtlc bool
}
// LoopInQuote contains estimates for the fees making up the total swap cost

Loading…
Cancel
Save