Skip to content

Commit 7a45cad

Browse files
committed
liquidity: skip asset channels in easy autoloop
1 parent 34faa4b commit 7a45cad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

liquidity/liquidity.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -593,12 +593,14 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
593593
return err
594594
}
595595

596+
usableChannels := make([]lndclient.ChannelInfo, 0, len(channels))
596597
localTotal := btcutil.Amount(0)
597598
for _, channel := range channels {
598599
if channelIsCustom(channel) {
599600
continue
600601
}
601602
localTotal += channel.LocalBalance
603+
usableChannels = append(usableChannels, channel)
602604
}
603605

604606
// Since we're only autolooping-out we need to check if we are below
@@ -640,7 +642,7 @@ func (m *Manager) dispatchBestEasyAutoloopSwap(ctx context.Context) error {
640642
builder := newLoopOutBuilder(m.cfg)
641643

642644
channel := m.pickEasyAutoloopChannel(
643-
channels, restrictions, loopOut, loopIn,
645+
usableChannels, restrictions, loopOut, loopIn, 0,
644646
)
645647
if channel == nil {
646648
return fmt.Errorf("no eligible channel for easy autoloop")
@@ -1651,7 +1653,7 @@ func (m *Manager) waitForSwapPayment(ctx context.Context, swapHash lntypes.Hash,
16511653
// swap conflicts.
16521654
func (m *Manager) pickEasyAutoloopChannel(channels []lndclient.ChannelInfo,
16531655
restrictions *Restrictions, loopOut []*loopdb.LoopOut,
1654-
loopIn []*loopdb.LoopIn) *lndclient.ChannelInfo {
1656+
loopIn []*loopdb.LoopIn, satsPerAsset float64) *lndclient.ChannelInfo {
16551657

16561658
traffic := m.currentSwapTraffic(loopOut, loopIn)
16571659

0 commit comments

Comments
 (0)