2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-04 06:00:21 +00:00

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.
This commit is contained in:
carla 2021-02-03 08:54:51 +02:00
parent 476ae39ce9
commit 68a5336362
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

View File

@ -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
}