liquidity: tweak autoloop tests for recurring budget

pull/551/head
George Tsagkarelis 1 year ago
parent b025b9ae37
commit 5d6be011f9
No known key found for this signature in database
GPG Key ID: 0807D1013F48208A

@ -97,7 +97,7 @@ func TestAutoLoopEnabled(t *testing.T) {
params = Parameters{
Autoloop: true,
AutoFeeBudget: 40066,
AutoFeeStartDate: testTime,
AutoFeeRefreshPeriod: testBudgetRefresh,
MaxAutoInFlight: 2,
FailureBackOff: time.Hour,
SweepConfTarget: 10,
@ -112,6 +112,7 @@ func TestAutoLoopEnabled(t *testing.T) {
HtlcConfTarget: defaultHtlcConfTarget,
}
)
c := newAutoloopTestCtx(t, params, channels, testRestrictions)
c.start()
@ -338,7 +339,7 @@ func TestAutoloopAddress(t *testing.T) {
Autoloop: true,
AutoFeeBudget: 40066,
DestAddr: addr,
AutoFeeStartDate: testTime,
AutoFeeRefreshPeriod: testBudgetRefresh,
MaxAutoInFlight: 2,
FailureBackOff: time.Hour,
SweepConfTarget: 10,
@ -493,7 +494,7 @@ func TestCompositeRules(t *testing.T) {
),
Autoloop: true,
AutoFeeBudget: 100000,
AutoFeeStartDate: testTime,
AutoFeeRefreshPeriod: testBudgetRefresh,
MaxAutoInFlight: 2,
FailureBackOff: time.Hour,
SweepConfTarget: 10,
@ -672,7 +673,7 @@ func TestAutoLoopInEnabled(t *testing.T) {
params = Parameters{
Autoloop: true,
AutoFeeBudget: peer1MaxFee + peer2MaxFee + 1,
AutoFeeStartDate: testTime,
AutoFeeRefreshPeriod: testBudgetRefresh,
MaxAutoInFlight: 2,
FailureBackOff: time.Hour,
FeeLimit: NewFeePortion(swapFeePPM),
@ -855,7 +856,7 @@ func TestAutoloopBothTypes(t *testing.T) {
params = Parameters{
Autoloop: true,
AutoFeeBudget: loopOutMaxFee + loopInMaxFee + 1,
AutoFeeStartDate: testTime,
AutoFeeRefreshPeriod: testBudgetRefresh,
MaxAutoInFlight: 2,
FailureBackOff: time.Hour,
FeeLimit: NewFeePortion(swapFeePPM),

@ -118,6 +118,7 @@ func newAutoloopTestCtx(t *testing.T, parameters Parameters,
cfg := &Config{
AutoloopTicker: ticker.NewForce(DefaultAutoloopTicker),
AutoloopBudgetLastRefresh: testBudgetStart,
Restrictions: func(_ context.Context, swapType swap.Type) (*Restrictions,
error) {

@ -24,6 +24,11 @@ import (
var (
testTime = time.Date(2020, 02, 13, 0, 0, 0, 0, time.UTC)
testBudgetStart = testTime.Add(time.Hour * -1)
// In order to not influence existing tests we set the budget refresh
// period to 10 years so that it will never be refreshed. This way the
// behavior of autoloop remains identical to before recurring budget was
// introduced.
testBudgetRefresh = time.Hour * 24 * 365 * 10
chanID1 = lnwire.NewShortChanIDFromInt(1)
chanID2 = lnwire.NewShortChanIDFromInt(2)
@ -145,6 +150,7 @@ func newTestConfig() (*Config, *test.LndMockServices) {
},
Lnd: &lnd.LndServices,
Clock: clock.NewTestClock(testTime),
AutoloopBudgetLastRefresh: testBudgetStart,
ListLoopOut: func() ([]*loopdb.LoopOut, error) {
return nil, nil
},
@ -1100,8 +1106,8 @@ func TestFeeBudget(t *testing.T) {
chanID1: chanRule,
chanID2: chanRule,
}
params.AutoFeeStartDate = testBudgetStart
params.AutoFeeBudget = testCase.budget
params.AutoFeeRefreshPeriod = testBudgetRefresh
params.MaxAutoInFlight = 2
params.FeeLimit = NewFeeCategoryLimit(
defaultSwapFeePPM, defaultRoutingFeePPM,
@ -1758,7 +1764,7 @@ func TestBudgetWithLoopin(t *testing.T) {
params := defaultParameters
params.AutoFeeBudget = budget
params.AutoFeeStartDate = testBudgetStart
params.AutoFeeRefreshPeriod = testBudgetRefresh
params.FeeLimit = NewFeePortion(testPPM)
params.ChannelRules = map[lnwire.ShortChannelID]*SwapRule{

Loading…
Cancel
Save