Skip to content

Commit 4535018

Browse files
committed
liquidity: update default budget to use flat fee percentage
1 parent c5ee984 commit 4535018

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

liquidity/liquidity.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,9 @@ var (
8383
// only be used for automatically dispatched swaps if autoloop is
8484
// explicitly enabled, so we are happy to set a non-zero value here. The
8585
// 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)
86+
// a single swap. We don't have a swap amount so we just use our max
87+
// funding amount.
88+
defaultBudget = ppmToSat(funding.MaxBtcFundingAmount, defaultFeePPM)
9289

9390
// defaultParameters contains the default parameters that we start our
9491
// liquidity manger with.

liquidity/liquidity_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}
@@ -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
}

0 commit comments

Comments
 (0)