diff --git a/docs/autoloop.md b/docs/autoloop.md index 2a25232..ae9e244 100644 --- a/docs/autoloop.md +++ b/docs/autoloop.md @@ -224,8 +224,4 @@ in manually dispatched swaps - for loop out, this would mean the channel is specified in the outgoing channel swap, and for loop in the channel's peer is specified as the last hop for an ongoing swap. This check is put in place to prevent the autolooper from interfering with swaps you have created yourself. -If there is an ongoing swap that does not have a restriction placed on it (no -outgoing channel set, or last hop), then the autolooper will take no action -until it has resolved, because it does not know how that swap will affect -liquidity balances. diff --git a/liquidity/liquidity.go b/liquidity/liquidity.go index ab276a8..b9a8f9c 100644 --- a/liquidity/liquidity.go +++ b/liquidity/liquidity.go @@ -930,8 +930,6 @@ func (m *Manager) checkExistingAutoLoops(ctx context.Context, // getEligibleChannels takes lists of our existing loop out and in swaps, and // gets a list of channels that are not currently being utilized for a swap. -// If an unrestricted swap is ongoing, we return an empty set of channels -// because we don't know which channels balances it will affect. func (m *Manager) getEligibleChannels(ctx context.Context, loopOut []*loopdb.LoopOut, loopIn []*loopdb.LoopIn) ( []lndclient.ChannelInfo, error) { @@ -988,13 +986,6 @@ func (m *Manager) getEligibleChannels(ctx context.Context, continue } - if len(chanSet) == 0 { - log.Debugf("Ongoing unrestricted loop out: "+ - "%v, no suggestions at present", out.Hash) - - return nil, nil - } - for _, id := range chanSet { chanID := lnwire.NewShortChanIDFromInt(id) existingOut[chanID] = true @@ -1007,11 +998,9 @@ func (m *Manager) getEligibleChannels(ctx context.Context, continue } + // Skip over swaps that may come through any peer. if in.Contract.LastHop == nil { - log.Debugf("Ongoing unrestricted loop in: "+ - "%v, no suggestions at present", in.Hash) - - return nil, nil + continue } existingIn[*in.Contract.LastHop] = true diff --git a/liquidity/liquidity_test.go b/liquidity/liquidity_test.go index 7bbe1f7..168eefc 100644 --- a/liquidity/liquidity_test.go +++ b/liquidity/liquidity_test.go @@ -299,7 +299,7 @@ func TestRestrictedSuggestions(t *testing.T) { { name: "unrestricted loop out", channels: []lndclient.ChannelInfo{ - channel1, channel2, + channel1, }, loopOut: []*loopdb.LoopOut{ { @@ -308,12 +308,14 @@ func TestRestrictedSuggestions(t *testing.T) { }, }, }, - expected: nil, + expected: []loop.OutRequest{ + chan1Rec, + }, }, { name: "unrestricted loop in", channels: []lndclient.ChannelInfo{ - channel1, channel2, + channel1, }, loopIn: []*loopdb.LoopIn{ { @@ -322,7 +324,9 @@ func TestRestrictedSuggestions(t *testing.T) { }, }, }, - expected: nil, + expected: []loop.OutRequest{ + chan1Rec, + }, }, { name: "restricted loop out", diff --git a/release_notes.md b/release_notes.md index acc5120..e0af837 100644 --- a/release_notes.md +++ b/release_notes.md @@ -24,6 +24,10 @@ This file tracks release notes for the loop client. baked one with the exact permissions needed for Loop. If the now deprecated flag/option `--lnd.macaroondir` is used, it will fall back to use only the `admin.macaroon` from that directory. +* The rules used for autoloop have been relaxed to allow autoloop to dispatch + swaps even if there are manually initiated swaps that are not limited to a + single channel in progress. This change was made to allow autoloop to coexist + with manual swaps. #### Breaking Changes * The `AutoOut`, `AutoOutBudgetSat` and `AutoOutBudgetStartSec` fields in the