liquidity: relax restriction which requires no unrestricted swaps

In practice, this restriction has proven to be too strict. Autoloop will
now only hold off on a swap for a channel if a manual swap is
specifically using that channel.
pull/332/head
carla 3 years ago
parent 7ba1821696
commit d5096cdc21
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -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.

@ -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

@ -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",

@ -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

Loading…
Cancel
Save