Skip to content

Commit 5739fa5

Browse files
authored
Merge pull request #636 from hieblmi/loopin-settlement-fix
auto loopin: consider settled invoices swap succeeded
2 parents 57c9537 + fd6a9cf commit 5739fa5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

liquidity/liquidity.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,14 @@ func (m *Manager) currentSwapTraffic(loopOut []*loopdb.LoopOut,
12051205
pubkey := *in.Contract.LastHop
12061206

12071207
switch {
1208-
// Include any pending swaps in our ongoing set of swaps.
1209-
case in.State().State.Type() == loopdb.StateTypePending:
1208+
// Include any pending swaps in our ongoing set of swaps. Swaps
1209+
// that reached InvoiceSettled are not considered ongoing since
1210+
// from the client's perspective the swap is complete. This
1211+
// consideration allows the client to dispatch the next autoloop
1212+
// in once an invoice for a previous swap is settled.
1213+
case in.State().State.Type() == loopdb.StateTypePending &&
1214+
in.State().State != loopdb.StateInvoiceSettled:
1215+
12101216
traffic.ongoingLoopIn[pubkey] = true
12111217

12121218
// If a swap failed with an on-chain timeout, the server could

0 commit comments

Comments
 (0)