multi: unify default sweep/htlc conf targets

Create a HtlcConfTarget which is used as a default for quote
and loop in. Update loop out quote to use the existing var
rather than just 6 inline.
pull/179/head
carla 4 years ago
parent e36c5a45d3
commit 1f5aeff45f
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -88,7 +88,7 @@ var quoteOutCommand = cli.Command{
Usage: "the number of blocks from the swap " +
"initiation height that the on-chain HTLC " +
"should be swept within in a Loop Out",
Value: 6,
Value: uint64(loop.DefaultSweepConfTarget),
},
cli.BoolFlag{
Name: "fast",

@ -14,10 +14,7 @@ import (
"github.com/lightningnetwork/lnd/build"
)
const (
defaultConfTarget = int32(6)
defaultConfigFilename = "loopd.conf"
)
const defaultConfigFilename = "loopd.conf"
// RPCConfig holds optional options that can be used to make the loop daemon
// communicate on custom connections.

@ -363,7 +363,7 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context,
quote, err := s.impl.LoopInQuote(ctx, &loop.LoopInQuoteRequest{
Amount: btcutil.Amount(req.Amt),
HtlcConfTarget: defaultConfTarget,
HtlcConfTarget: loop.DefaultHtlcConfTarget,
ExternalHtlc: req.ExternalHtlc,
})
if err != nil {
@ -385,7 +385,7 @@ func (s *swapClientServer) LoopIn(ctx context.Context,
Amount: btcutil.Amount(in.Amt),
MaxMinerFee: btcutil.Amount(in.MaxMinerFee),
MaxSwapFee: btcutil.Amount(in.MaxSwapFee),
HtlcConfTarget: defaultConfTarget,
HtlcConfTarget: loop.DefaultHtlcConfTarget,
ExternalHtlc: in.ExternalHtlc,
}
if in.LastHop != nil {

@ -26,6 +26,10 @@ var (
// when sweeping on-chain HTLCs.
DefaultSweepConfTarget int32 = 6
// DefaultHtlcConfTarget is the default confirmation target we'll use
// for on-chain htlcs published by the swap client for Loop In.
DefaultHtlcConfTarget int32 = 6
// DefaultSweepConfTargetDelta is the delta of blocks from a Loop Out
// swap's expiration height at which we begin to use the default sweep
// confirmation target.

Loading…
Cancel
Save