@@ -536,10 +536,7 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
536536
537537 // Get a summary of our existing swaps so that we can check our autoloop
538538 // budget.
539- summary , err := m .checkExistingAutoLoops (ctx , loopOut , loopIn )
540- if err != nil {
541- return err
542- }
539+ summary := m .checkExistingAutoLoops (ctx , loopOut , loopIn )
543540
544541 err = m .checkSummaryBudget (summary )
545542 if err != nil {
@@ -581,7 +578,7 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
581578 // allowed clamp it to max.
582579 amount := localTotal - m .params .EasyAutoloopTarget
583580 if amount > restrictions .Maximum {
584- amount = btcutil . Amount ( restrictions .Maximum )
581+ amount = restrictions .Maximum
585582 }
586583
587584 // If the amount we want to loop out is less than the minimum we can't
@@ -601,7 +598,7 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
601598 builder := newLoopOutBuilder (m .cfg )
602599
603600 channel := m .pickEasyAutoloopChannel (
604- channels , restrictions , loopOut , loopIn , amount ,
601+ channels , restrictions , loopOut , loopIn ,
605602 )
606603 if channel == nil {
607604 return fmt .Errorf ("no eligible channel for easy autoloop" )
@@ -624,12 +621,12 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
624621 switch feeLimit := easyParams .FeeLimit .(type ) {
625622 case * FeePortion :
626623 if feeLimit .PartsPerMillion == 0 {
627- feeLimit = & FeePortion {
624+ easyParams . FeeLimit = & FeePortion {
628625 PartsPerMillion : defaultFeePPM ,
629626 }
630627 }
631628 default :
632- feeLimit = & FeePortion {
629+ easyParams . FeeLimit = & FeePortion {
633630 PartsPerMillion : defaultFeePPM ,
634631 }
635632 }
@@ -646,16 +643,16 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
646643 return err
647644 }
648645
649- swap := loop.OutRequest {}
646+ var swp loop.OutRequest
650647 if t , ok := suggestion .(* loopOutSwapSuggestion ); ok {
651- swap = t .OutRequest
648+ swp = t .OutRequest
652649 } else {
653650 return fmt .Errorf ("unexpected swap suggestion type: %T" , t )
654651 }
655652
656653 // Dispatch a sticky loop out.
657654 go m .dispatchStickyLoopOut (
658- ctx , swap , defaultAmountBackoffRetry , defaultAmountBackoff ,
655+ ctx , swp , defaultAmountBackoffRetry , defaultAmountBackoff ,
659656 )
660657
661658 return nil
@@ -762,10 +759,7 @@ func (m *Manager) SuggestSwaps(ctx context.Context) (
762759
763760 // Get a summary of our existing swaps so that we can check our autoloop
764761 // budget.
765- summary , err := m .checkExistingAutoLoops (ctx , loopOut , loopIn )
766- if err != nil {
767- return nil , err
768- }
762+ summary := m .checkExistingAutoLoops (ctx , loopOut , loopIn )
769763
770764 err = m .checkSummaryBudget (summary )
771765 if err != nil {
@@ -1074,9 +1068,9 @@ func (e *existingAutoLoopSummary) totalFees() btcutil.Amount {
10741068// automatically dispatched swaps that have completed, and the worst-case fee
10751069// total for our set of ongoing, automatically dispatched swaps as well as a
10761070// current in-flight count.
1077- func (m * Manager ) checkExistingAutoLoops (ctx context.Context ,
1078- loopOuts []* loopdb.LoopOut , loopIns [] * loopdb. LoopIn ) (
1079- * existingAutoLoopSummary , error ) {
1071+ func (m * Manager ) checkExistingAutoLoops (_ context.Context ,
1072+ loopOuts []* loopdb.LoopOut ,
1073+ loopIns [] * loopdb. LoopIn ) * existingAutoLoopSummary {
10801074
10811075 var summary existingAutoLoopSummary
10821076
@@ -1133,7 +1127,7 @@ func (m *Manager) checkExistingAutoLoops(ctx context.Context,
11331127 }
11341128 }
11351129
1136- return & summary , nil
1130+ return & summary
11371131}
11381132
11391133// currentSwapTraffic examines our existing swaps and returns a summary of the
@@ -1416,7 +1410,7 @@ func (m *Manager) waitForSwapPayment(ctx context.Context, swapHash lntypes.Hash,
14161410// swap conflicts.
14171411func (m * Manager ) pickEasyAutoloopChannel (channels []lndclient.ChannelInfo ,
14181412 restrictions * Restrictions , loopOut []* loopdb.LoopOut ,
1419- loopIn []* loopdb.LoopIn , amount btcutil. Amount ) * lndclient.ChannelInfo {
1413+ loopIn []* loopdb.LoopIn ) * lndclient.ChannelInfo {
14201414
14211415 traffic := m .currentSwapTraffic (loopOut , loopIn )
14221416
@@ -1472,7 +1466,6 @@ func (m *Manager) numActiveStickyLoops() int {
14721466 defer m .activeStickyLock .Unlock ()
14731467
14741468 return m .activeStickyLoops
1475-
14761469}
14771470
14781471func (m * Manager ) checkSummaryBudget (summary * existingAutoLoopSummary ) error {
@@ -1482,7 +1475,6 @@ func (m *Manager) checkSummaryBudget(summary *existingAutoLoopSummary) error {
14821475 "(upper limit)" ,
14831476 m .params .AutoFeeBudget , summary .spentFees ,
14841477 summary .pendingFees )
1485-
14861478 }
14871479
14881480 return nil
@@ -1556,7 +1548,3 @@ func satPerKwToSatPerVByte(satPerKw chainfee.SatPerKWeight) int64 {
15561548func ppmToSat (amount btcutil.Amount , ppm uint64 ) btcutil.Amount {
15571549 return btcutil .Amount (uint64 (amount ) * ppm / FeeBase )
15581550}
1559-
1560- func mSatToSatoshis (amount lnwire.MilliSatoshi ) btcutil.Amount {
1561- return btcutil .Amount (amount / 1000 )
1562- }
0 commit comments