From fd6a9cf3e915fe014bc99c2a6aa30fd3f26160fe Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 31 Aug 2023 15:59:15 +0200 Subject: [PATCH] loopin: consider settled invoices success --- liquidity/liquidity.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/liquidity/liquidity.go b/liquidity/liquidity.go index bd84922..64b0a6a 100644 --- a/liquidity/liquidity.go +++ b/liquidity/liquidity.go @@ -1205,8 +1205,14 @@ func (m *Manager) currentSwapTraffic(loopOut []*loopdb.LoopOut, pubkey := *in.Contract.LastHop switch { - // Include any pending swaps in our ongoing set of swaps. - case in.State().State.Type() == loopdb.StateTypePending: + // Include any pending swaps in our ongoing set of swaps. Swaps + // that reached InvoiceSettled are not considered ongoing since + // from the client's perspective the swap is complete. This + // consideration allows the client to dispatch the next autoloop + // in once an invoice for a previous swap is settled. + case in.State().State.Type() == loopdb.StateTypePending && + in.State().State != loopdb.StateInvoiceSettled: + traffic.ongoingLoopIn[pubkey] = true // If a swap failed with an on-chain timeout, the server could