Skip to content

Commit 5a639a2

Browse files
authored
Merge pull request #351 from carlaKC/autoloop-defaults
liquidity: update default budget and confirmation target
2 parents 6d4d53c + c17631e commit 5a639a2

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

liquidity/liquidity.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ const (
6060
// a channel is part of a temporarily failed swap.
6161
defaultFailureBackoff = time.Hour * 24
6262

63+
// defaultConfTarget is the default sweep target we use for loop outs.
64+
// We get our inbound liquidity quickly using preimage push, so we can
65+
// use a long conf target without worrying about ux impact.
66+
defaultConfTarget = 100
67+
6368
// FeeBase is the base that we use to express fees.
6469
FeeBase = 1e6
6570

@@ -83,12 +88,9 @@ var (
8388
// only be used for automatically dispatched swaps if autoloop is
8489
// explicitly enabled, so we are happy to set a non-zero value here. The
8590
// amount chosen simply uses the current defaults to provide budget for
86-
// a single swap. We don't have a swap amount to calculate our maximum
87-
// routing fee, so we use 0.16 BTC for now.
88-
defaultBudget = defaultMaximumMinerFee +
89-
ppmToSat(funding.MaxBtcFundingAmount, defaultSwapFeePPM) +
90-
ppmToSat(defaultMaximumPrepay, defaultPrepayRoutingFeePPM) +
91-
ppmToSat(funding.MaxBtcFundingAmount, defaultRoutingFeePPM)
91+
// a single swap. We don't have a swap amount so we just use our max
92+
// funding amount.
93+
defaultBudget = ppmToSat(funding.MaxBtcFundingAmount, defaultFeePPM)
9294

9395
// defaultParameters contains the default parameters that we start our
9496
// liquidity manger with.
@@ -98,7 +100,7 @@ var (
98100
ChannelRules: make(map[lnwire.ShortChannelID]*ThresholdRule),
99101
PeerRules: make(map[route.Vertex]*ThresholdRule),
100102
FailureBackOff: defaultFailureBackoff,
101-
SweepConfTarget: loop.DefaultSweepConfTarget,
103+
SweepConfTarget: defaultConfTarget,
102104
FeeLimit: defaultFeePortion(),
103105
}
104106

liquidity/liquidity_test.go

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ var (
6666
MaxMinerFee: scaleMinerFee(testQuote.MinerFee),
6767
MaxSwapFee: testQuote.SwapFee,
6868
MaxPrepayAmount: testQuote.PrepayAmount,
69-
SweepConfTarget: loop.DefaultSweepConfTarget,
69+
SweepConfTarget: defaultConfTarget,
7070
Initiator: autoloopSwapInitiator,
7171
}
7272

@@ -79,7 +79,7 @@ var (
7979
MaxMinerFee: scaleMinerFee(testQuote.MinerFee),
8080
MaxPrepayAmount: testQuote.PrepayAmount,
8181
MaxSwapFee: testQuote.SwapFee,
82-
SweepConfTarget: loop.DefaultSweepConfTarget,
82+
SweepConfTarget: defaultConfTarget,
8383
Initiator: autoloopSwapInitiator,
8484
}
8585

@@ -612,7 +612,7 @@ func TestSweepFeeLimit(t *testing.T) {
612612

613613
// Set our test case's fee rate for our mock lnd.
614614
lnd.SetFeeEstimate(
615-
loop.DefaultSweepConfTarget, testCase.feeRate,
615+
defaultConfTarget, testCase.feeRate,
616616
)
617617

618618
lnd.Channels = []lndclient.ChannelInfo{
@@ -622,6 +622,13 @@ func TestSweepFeeLimit(t *testing.T) {
622622
params := defaultParameters
623623
params.FeeLimit = defaultFeeCategoryLimit()
624624

625+
// Set our budget to cover a single swap with these
626+
// parameters.
627+
params.AutoFeeBudget = defaultMaximumMinerFee +
628+
ppmToSat(7500, defaultSwapFeePPM) +
629+
ppmToSat(7500, defaultPrepayRoutingFeePPM) +
630+
ppmToSat(7500, defaultRoutingFeePPM)
631+
625632
params.ChannelRules = map[lnwire.ShortChannelID]*ThresholdRule{
626633
chanID1: chanRule,
627634
}
@@ -725,7 +732,7 @@ func TestSuggestSwaps(t *testing.T) {
725732
MaxMinerFee: scaleMinerFee(testQuote.MinerFee),
726733
MaxSwapFee: testQuote.SwapFee,
727734
MaxPrepayAmount: testQuote.PrepayAmount,
728-
SweepConfTarget: loop.DefaultSweepConfTarget,
735+
SweepConfTarget: defaultConfTarget,
729736
Initiator: autoloopSwapInitiator,
730737
},
731738
},
@@ -855,6 +862,13 @@ func TestFeeLimits(t *testing.T) {
855862
params := defaultParameters
856863
params.FeeLimit = defaultFeeCategoryLimit()
857864

865+
// Set our budget to cover a single swap with these
866+
// parameters.
867+
params.AutoFeeBudget = defaultMaximumMinerFee +
868+
ppmToSat(7500, defaultSwapFeePPM) +
869+
ppmToSat(7500, defaultPrepayRoutingFeePPM) +
870+
ppmToSat(7500, defaultRoutingFeePPM)
871+
858872
params.ChannelRules = map[lnwire.ShortChannelID]*ThresholdRule{
859873
chanID1: chanRule,
860874
}
@@ -1213,7 +1227,7 @@ func TestSizeRestrictions(t *testing.T) {
12131227
MaxMinerFee: scaleMinerFee(testQuote.MinerFee),
12141228
MaxSwapFee: testQuote.SwapFee,
12151229
MaxPrepayAmount: testQuote.PrepayAmount,
1216-
SweepConfTarget: loop.DefaultSweepConfTarget,
1230+
SweepConfTarget: defaultConfTarget,
12171231
Initiator: autoloopSwapInitiator,
12181232
}
12191233
)
@@ -1362,7 +1376,7 @@ func TestFeePercentage(t *testing.T) {
13621376
MaxMinerFee: scaleMinerFee(okQuote.MinerFee),
13631377
MaxSwapFee: okQuote.SwapFee,
13641378
MaxPrepayAmount: okQuote.PrepayAmount,
1365-
SweepConfTarget: loop.DefaultSweepConfTarget,
1379+
SweepConfTarget: defaultConfTarget,
13661380
Initiator: autoloopSwapInitiator,
13671381
}
13681382
)

release_notes.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ This file tracks release notes for the loop client.
2222
peer-level rules, provide the 'setrule' command with the peer's pubkey.
2323
* Autoloop's fee API has been simplified to allow setting a single percentage
2424
which will be used to limit total swap fees to a percentage of the amount
25-
being swapped. Use `loop setparams --feepercent={percentage}` to update
26-
this value. This fee setting has been updated to the default for autoloop.
25+
being swapped, the default budget has been updated to reflect this. Use
26+
`loop setparams --feepercent={percentage}` to update this value. This fee
27+
setting has been updated to the default for autoloop.
28+
* The default confirmation target for automated loop out swap sweeps has been
29+
increased to 100 blocks. This change will not affect the time it takes to
30+
acquire inbound liquidity, but will decrease the cost of swaps.
2731

2832
#### Breaking Changes
2933

0 commit comments

Comments
 (0)