From dbb49cfa0519ac8c2c66f7ff39525992548cd072 Mon Sep 17 00:00:00 2001 From: George Tsagkarelis Date: Wed, 14 Jun 2023 14:12:44 +0300 Subject: [PATCH] liquidity: test low feeppm case for easyautoloop --- liquidity/autoloop_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/liquidity/autoloop_test.go b/liquidity/autoloop_test.go index ff7777f..4c63ead 100644 --- a/liquidity/autoloop_test.go +++ b/liquidity/autoloop_test.go @@ -1419,6 +1419,33 @@ func TestEasyAutoloop(t *testing.T) { c.easyautoloop(step, true) c.stop() + + // Restore the local balance to a higher value that will trigger a swap. + easyChannel2.LocalBalance = btcutil.Amount(95000) + channels = []lndclient.ChannelInfo{ + easyChannel1, easyChannel2, + } + + // Override the feeppm with a lower one. + params.FeeLimit = NewFeePortion(5) + + c = newAutoloopTestCtx(t, params, channels, testRestrictions) + c.start() + + // Even though there should be a swap dispatched in order to meet the + // local balance target, we expect no action as the user defined feeppm + // should not be sufficient for the swap to be dispatched. + step = &easyAutoloopStep{ + minAmt: 1, + maxAmt: 50000, + // Since we have the exact same balance as the first step, we + // can reuse the quoteOut1 for the expected loop out quote. + quotesOut: quotesOut1, + expectedOut: nil, + } + + c.easyautoloop(step, false) + c.stop() } // existingSwapFromRequest is a helper function which returns the db