From 68a5336362eabf891ad628d85b597b5ad66ef5e2 Mon Sep 17 00:00:00 2001 From: carla Date: Wed, 3 Feb 2021 08:54:51 +0200 Subject: [PATCH] liquidity: move logging out of suggest swaps function This function is already quite long, and will be extended in the commits to follow, so we move it to the calling function. --- liquidity/liquidity.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/liquidity/liquidity.go b/liquidity/liquidity.go index 9fd12da..f70a08a 100644 --- a/liquidity/liquidity.go +++ b/liquidity/liquidity.go @@ -512,6 +512,15 @@ func (m *Manager) autoloop(ctx context.Context) error { } for _, swap := range swaps { + // If we don't actually have dispatch of swaps enabled, log + // suggestions. + if !m.params.Autoloop { + log.Debugf("recommended autoloop: %v sats over "+ + "%v", swap.Amount, swap.OutgoingChanSet) + + continue + } + // Create a copy of our range var so that we can reference it. swap := swap loopOut, err := m.cfg.LoopOut(ctx, &swap) @@ -730,18 +739,6 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) ( } } - // If we are getting suggestions for automatically dispatched swaps, - // and they are not enabled in our parameters, we just log the swap - // suggestions and return an empty set of suggestions. - if autoloop && !m.params.Autoloop { - for _, swap := range inBudget { - log.Debugf("recommended autoloop: %v sats over "+ - "%v", swap.Amount, swap.OutgoingChanSet) - } - - return nil, nil - } - return inBudget, nil }