@@ -178,8 +178,8 @@ type Config struct {
178178
179179 // Restrictions returns the restrictions that the server applies to
180180 // swaps.
181- Restrictions func (ctx context.Context , swapType swap.Type ) (
182- * Restrictions , error )
181+ Restrictions func (ctx context.Context , swapType swap.Type ,
182+ initiator string ) ( * Restrictions , error )
183183
184184 // Lnd provides us with access to lnd's rpc servers.
185185 Lnd * lndclient.LndServices
@@ -212,10 +212,12 @@ type Config struct {
212212 request * loop.LoopInRequest ) (* loop.LoopInSwapInfo , error )
213213
214214 // LoopInTerms returns the terms for a loop in swap.
215- LoopInTerms func (ctx context.Context ) (* loop.LoopInTerms , error )
215+ LoopInTerms func (ctx context.Context ,
216+ initiator string ) (* loop.LoopInTerms , error )
216217
217218 // LoopOutTerms returns the terms for a loop out swap.
218- LoopOutTerms func (ctx context.Context ) (* loop.LoopOutTerms , error )
219+ LoopOutTerms func (ctx context.Context ,
220+ initiator string ) (* loop.LoopOutTerms , error )
219221
220222 // Clock allows easy mocking of time in unit tests.
221223 Clock clock.Clock
@@ -355,7 +357,9 @@ func (m *Manager) SetParameters(ctx context.Context,
355357func (m * Manager ) setParameters (ctx context.Context ,
356358 params Parameters ) error {
357359
358- restrictions , err := m .cfg .Restrictions (ctx , swap .TypeOut )
360+ restrictions , err := m .cfg .Restrictions (
361+ ctx , swap .TypeOut , getInitiator (m .params ),
362+ )
359363 if err != nil {
360364 return err
361365 }
@@ -566,7 +570,9 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
566570 return nil
567571 }
568572
569- restrictions , err := m .cfg .Restrictions (ctx , swap .TypeOut )
573+ restrictions , err := m .cfg .Restrictions (
574+ ctx , swap .TypeOut , getInitiator (m .params ),
575+ )
570576 if err != nil {
571577 return err
572578 }
@@ -999,7 +1005,9 @@ func (m *Manager) suggestSwap(ctx context.Context, traffic *swapTraffic,
9991005func (m * Manager ) getSwapRestrictions (ctx context.Context , swapType swap.Type ) (
10001006 * Restrictions , error ) {
10011007
1002- restrictions , err := m .cfg .Restrictions (ctx , swapType )
1008+ restrictions , err := m .cfg .Restrictions (
1009+ ctx , swapType , getInitiator (m .params ),
1010+ )
10031011 if err != nil {
10041012 return nil , err
10051013 }
@@ -1487,6 +1495,14 @@ func (m *Manager) checkSummaryInflight(
14871495 return allowedSwaps , nil
14881496}
14891497
1498+ func getInitiator (params Parameters ) string {
1499+ if params .EasyAutoloop {
1500+ return "easy-autoloop"
1501+ }
1502+
1503+ return "autoloop"
1504+ }
1505+
14901506// isAutoloopLabel is a helper function that returns a flag indicating whether
14911507// the provided label corresponds to an autoloop swap.
14921508func isAutoloopLabel (label string ) bool {
0 commit comments