@@ -28,6 +28,7 @@ func TestAutoLoopDisabled(t *testing.T) {
2828 }
2929
3030 params := defaultParameters
31+ params .AutoloopBudgetLastRefresh = testBudgetStart
3132 params .ChannelRules = map [lnwire.ShortChannelID ]* SwapRule {
3233 chanID1 : chanRule ,
3334 }
@@ -95,12 +96,13 @@ func TestAutoLoopEnabled(t *testing.T) {
9596 // autoloop budget is set to allow exactly 2 swaps at the prices
9697 // that we set in our test quotes.
9798 params = Parameters {
98- Autoloop : true ,
99- AutoFeeBudget : 40066 ,
100- AutoFeeRefreshPeriod : testBudgetRefresh ,
101- MaxAutoInFlight : 2 ,
102- FailureBackOff : time .Hour ,
103- SweepConfTarget : 10 ,
99+ Autoloop : true ,
100+ AutoFeeBudget : 40066 ,
101+ AutoFeeRefreshPeriod : testBudgetRefresh ,
102+ AutoloopBudgetLastRefresh : testBudgetStart ,
103+ MaxAutoInFlight : 2 ,
104+ FailureBackOff : time .Hour ,
105+ SweepConfTarget : 10 ,
104106 FeeLimit : NewFeeCategoryLimit (
105107 swapFeePPM , routeFeePPM , prepayFeePPM , maxMiner ,
106108 prepayAmount , 20000 ,
@@ -353,13 +355,14 @@ func TestAutoloopAddress(t *testing.T) {
353355 // Create some dummy parameters for autoloop and also specify an
354356 // destination address.
355357 params = Parameters {
356- Autoloop : true ,
357- AutoFeeBudget : 40066 ,
358- DestAddr : addr ,
359- AutoFeeRefreshPeriod : testBudgetRefresh ,
360- MaxAutoInFlight : 2 ,
361- FailureBackOff : time .Hour ,
362- SweepConfTarget : 10 ,
358+ Autoloop : true ,
359+ AutoFeeBudget : 40066 ,
360+ DestAddr : addr ,
361+ AutoFeeRefreshPeriod : testBudgetRefresh ,
362+ AutoloopBudgetLastRefresh : testBudgetStart ,
363+ MaxAutoInFlight : 2 ,
364+ FailureBackOff : time .Hour ,
365+ SweepConfTarget : 10 ,
363366 FeeLimit : NewFeeCategoryLimit (
364367 swapFeePPM , routeFeePPM , prepayFeePPM , maxMiner ,
365368 prepayAmount , 20000 ,
@@ -523,12 +526,13 @@ func TestCompositeRules(t *testing.T) {
523526 swapFeePPM , routeFeePPM , prepayFeePPM , maxMiner ,
524527 prepayAmount , 20000 ,
525528 ),
526- Autoloop : true ,
527- AutoFeeBudget : 100000 ,
528- AutoFeeRefreshPeriod : testBudgetRefresh ,
529- MaxAutoInFlight : 2 ,
530- FailureBackOff : time .Hour ,
531- SweepConfTarget : 10 ,
529+ Autoloop : true ,
530+ AutoFeeBudget : 100000 ,
531+ AutoFeeRefreshPeriod : testBudgetRefresh ,
532+ AutoloopBudgetLastRefresh : testBudgetStart ,
533+ MaxAutoInFlight : 2 ,
534+ FailureBackOff : time .Hour ,
535+ SweepConfTarget : 10 ,
532536 ChannelRules : map [lnwire.ShortChannelID ]* SwapRule {
533537 chanID1 : chanRule ,
534538 },
@@ -715,13 +719,14 @@ func TestAutoLoopInEnabled(t *testing.T) {
715719 peer2MaxFee = ppmToSat (peer2ExpectedAmt , swapFeePPM )
716720
717721 params = Parameters {
718- Autoloop : true ,
719- AutoFeeBudget : peer1MaxFee + peer2MaxFee + 1 ,
720- AutoFeeRefreshPeriod : testBudgetRefresh ,
721- MaxAutoInFlight : 2 ,
722- FailureBackOff : time .Hour ,
723- FeeLimit : NewFeePortion (swapFeePPM ),
724- ChannelRules : make (map [lnwire.ShortChannelID ]* SwapRule ),
722+ Autoloop : true ,
723+ AutoFeeBudget : peer1MaxFee + peer2MaxFee + 1 ,
724+ AutoFeeRefreshPeriod : testBudgetRefresh ,
725+ AutoloopBudgetLastRefresh : testBudgetStart ,
726+ MaxAutoInFlight : 2 ,
727+ FailureBackOff : time .Hour ,
728+ FeeLimit : NewFeePortion (swapFeePPM ),
729+ ChannelRules : make (map [lnwire.ShortChannelID ]* SwapRule ),
725730 PeerRules : map [route.Vertex ]* SwapRule {
726731 peer1 : rule ,
727732 peer2 : rule ,
@@ -898,12 +903,13 @@ func TestAutoloopBothTypes(t *testing.T) {
898903 loopInMaxFee = ppmToSat (loopInAmount , swapFeePPM )
899904
900905 params = Parameters {
901- Autoloop : true ,
902- AutoFeeBudget : loopOutMaxFee + loopInMaxFee + 1 ,
903- AutoFeeRefreshPeriod : testBudgetRefresh ,
904- MaxAutoInFlight : 2 ,
905- FailureBackOff : time .Hour ,
906- FeeLimit : NewFeePortion (swapFeePPM ),
906+ Autoloop : true ,
907+ AutoFeeBudget : loopOutMaxFee + loopInMaxFee + 1 ,
908+ AutoFeeRefreshPeriod : testBudgetRefresh ,
909+ AutoloopBudgetLastRefresh : testBudgetStart ,
910+ MaxAutoInFlight : 2 ,
911+ FailureBackOff : time .Hour ,
912+ FeeLimit : NewFeePortion (swapFeePPM ),
907913 ChannelRules : map [lnwire.ShortChannelID ]* SwapRule {
908914 chanID1 : outRule ,
909915 },
@@ -1041,12 +1047,13 @@ func TestAutoLoopRecurringBudget(t *testing.T) {
10411047 maxMiner = btcutil .Amount (20000 )
10421048
10431049 params = Parameters {
1044- Autoloop : true ,
1045- AutoFeeBudget : 36000 ,
1046- AutoFeeRefreshPeriod : time .Hour * 3 ,
1047- MaxAutoInFlight : 2 ,
1048- FailureBackOff : time .Hour ,
1049- SweepConfTarget : 10 ,
1050+ Autoloop : true ,
1051+ AutoFeeBudget : 36000 ,
1052+ AutoFeeRefreshPeriod : time .Hour * 3 ,
1053+ AutoloopBudgetLastRefresh : testBudgetStart ,
1054+ MaxAutoInFlight : 2 ,
1055+ FailureBackOff : time .Hour ,
1056+ SweepConfTarget : 10 ,
10501057 FeeLimit : NewFeeCategoryLimit (
10511058 swapFeePPM , routeFeePPM , prepayFeePPM , maxMiner ,
10521059 prepayAmount , 20000 ,
0 commit comments