Skip to content

Commit 68a5336

Browse files
committed
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.
1 parent 476ae39 commit 68a5336

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

liquidity/liquidity.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,15 @@ func (m *Manager) autoloop(ctx context.Context) error {
512512
}
513513

514514
for _, swap := range swaps {
515+
// If we don't actually have dispatch of swaps enabled, log
516+
// suggestions.
517+
if !m.params.Autoloop {
518+
log.Debugf("recommended autoloop: %v sats over "+
519+
"%v", swap.Amount, swap.OutgoingChanSet)
520+
521+
continue
522+
}
523+
515524
// Create a copy of our range var so that we can reference it.
516525
swap := swap
517526
loopOut, err := m.cfg.LoopOut(ctx, &swap)
@@ -730,18 +739,6 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) (
730739
}
731740
}
732741

733-
// If we are getting suggestions for automatically dispatched swaps,
734-
// and they are not enabled in our parameters, we just log the swap
735-
// suggestions and return an empty set of suggestions.
736-
if autoloop && !m.params.Autoloop {
737-
for _, swap := range inBudget {
738-
log.Debugf("recommended autoloop: %v sats over "+
739-
"%v", swap.Amount, swap.OutgoingChanSet)
740-
}
741-
742-
return nil, nil
743-
}
744-
745742
return inBudget, nil
746743
}
747744

0 commit comments

Comments
 (0)