Skip to content

Commit 9e13ee0

Browse files
committed
fix sync of failed state transition when settled
1 parent d97a1a9 commit 9e13ee0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

worker/payIn.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ export async function checkPayInBolt11 ({ data: { hash, invoice }, boss, models,
134134
}
135135

136136
if (inv.is_confirmed) {
137+
// it's possible for a pending_held/forwarding invoice to settle without transitioning to held/forwarded if
138+
// the state transition is rolled back
139+
if (payIn.payInState === 'PENDING_HELD') {
140+
return await payInHeld({ data: { payInId: payIn.id, invoice: inv }, models, lnd, boss })
141+
}
142+
if (payIn.payInState === 'FORWARDING') {
143+
return await payInForwarded({ data: { payInId: payIn.id, invoice: inv }, models, lnd, boss })
144+
}
137145
return await payInPaid({ data: { payInId: payIn.id, invoice: inv }, models, lnd, boss })
138146
}
139147

0 commit comments

Comments
 (0)