@@ -188,9 +188,10 @@ type Config struct {
188188 // trigger autoloop in itests.
189189 AutoloopTicker * ticker.Force
190190
191- // LoopOutRestrictions returns the restrictions that the server applies
192- // to loop out swaps.
193- LoopOutRestrictions func (ctx context.Context ) (* Restrictions , error )
191+ // Restrictions returns the restrictions that the server applies to
192+ // swaps.
193+ Restrictions func (ctx context.Context , swapType swap.Type ) (
194+ * Restrictions , error )
194195
195196 // Lnd provides us with access to lnd's rpc servers.
196197 Lnd * lndclient.LndServices
@@ -467,7 +468,7 @@ func (m *Manager) GetParameters() Parameters {
467468// SetParameters updates our current set of parameters if the new parameters
468469// provided are valid.
469470func (m * Manager ) SetParameters (ctx context.Context , params Parameters ) error {
470- restrictions , err := m .cfg .LoopOutRestrictions (ctx )
471+ restrictions , err := m .cfg .Restrictions (ctx , swap . TypeOut )
471472 if err != nil {
472473 return err
473474 }
@@ -588,7 +589,7 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) (
588589
589590 // Get the current server side restrictions, combined with the client
590591 // set restrictions, if any.
591- outRestrictions , err := m .getLoopOutRestrictions (ctx )
592+ restrictions , err := m .getSwapRestrictions (ctx , swap . TypeOut )
592593 if err != nil {
593594 return nil , err
594595 }
@@ -647,7 +648,7 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) (
647648
648649 balance := newBalances (channel )
649650
650- suggestion := rule .suggestSwap (balance , outRestrictions )
651+ suggestion := rule .suggestSwap (balance , restrictions )
651652
652653 // We can have nil suggestions in the case where no action is
653654 // required, so we skip over them.
@@ -744,14 +745,14 @@ func (m *Manager) SuggestSwaps(ctx context.Context, autoloop bool) (
744745 return inBudget , nil
745746}
746747
747- // getLoopOutRestrictions queries the server for its latest swap size
748- // restrictions, validates client restrictions (if present) against these
749- // values and merges the client's custom requirements with the server's limits
750- // to produce a single set of limitations for our swap.
751- func (m * Manager ) getLoopOutRestrictions (ctx context.Context ) (* Restrictions ,
752- error ) {
748+ // getSwapRestrictions queries the server for its latest swap size restrictions,
749+ // validates client restrictions (if present) against these values and merges
750+ // the client's custom requirements with the server's limits to produce a single
751+ // set of limitations for our swap.
752+ func (m * Manager ) getSwapRestrictions (ctx context.Context , swapType swap. Type ) (
753+ * Restrictions , error ) {
753754
754- restrictions , err := m .cfg .LoopOutRestrictions (ctx )
755+ restrictions , err := m .cfg .Restrictions (ctx , swapType )
755756 if err != nil {
756757 return nil , err
757758 }
0 commit comments