Skip to content

Commit 1f5aeff

Browse files
committed
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.
1 parent e36c5a4 commit 1f5aeff

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

cmd/loop/quote.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ var quoteOutCommand = cli.Command{
8888
Usage: "the number of blocks from the swap " +
8989
"initiation height that the on-chain HTLC " +
9090
"should be swept within in a Loop Out",
91-
Value: 6,
91+
Value: uint64(loop.DefaultSweepConfTarget),
9292
},
9393
cli.BoolFlag{
9494
Name: "fast",

loopd/start.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ import (
1414
"github.com/lightningnetwork/lnd/build"
1515
)
1616

17-
const (
18-
defaultConfTarget = int32(6)
19-
defaultConfigFilename = "loopd.conf"
20-
)
17+
const defaultConfigFilename = "loopd.conf"
2118

2219
// RPCConfig holds optional options that can be used to make the loop daemon
2320
// communicate on custom connections.

loopd/swapclient_server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ func (s *swapClientServer) GetLoopInQuote(ctx context.Context,
363363

364364
quote, err := s.impl.LoopInQuote(ctx, &loop.LoopInQuoteRequest{
365365
Amount: btcutil.Amount(req.Amt),
366-
HtlcConfTarget: defaultConfTarget,
366+
HtlcConfTarget: loop.DefaultHtlcConfTarget,
367367
ExternalHtlc: req.ExternalHtlc,
368368
})
369369
if err != nil {
@@ -385,7 +385,7 @@ func (s *swapClientServer) LoopIn(ctx context.Context,
385385
Amount: btcutil.Amount(in.Amt),
386386
MaxMinerFee: btcutil.Amount(in.MaxMinerFee),
387387
MaxSwapFee: btcutil.Amount(in.MaxSwapFee),
388-
HtlcConfTarget: defaultConfTarget,
388+
HtlcConfTarget: loop.DefaultHtlcConfTarget,
389389
ExternalHtlc: in.ExternalHtlc,
390390
}
391391
if in.LastHop != nil {

loopout.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ var (
2626
// when sweeping on-chain HTLCs.
2727
DefaultSweepConfTarget int32 = 6
2828

29+
// DefaultHtlcConfTarget is the default confirmation target we'll use
30+
// for on-chain htlcs published by the swap client for Loop In.
31+
DefaultHtlcConfTarget int32 = 6
32+
2933
// DefaultSweepConfTargetDelta is the delta of blocks from a Loop Out
3034
// swap's expiration height at which we begin to use the default sweep
3135
// confirmation target.

0 commit comments

Comments
 (0)