manually retry wallet polling on ln errors

This commit is contained in:
keyan 2022-01-07 10:41:53 -06:00
parent c3e6627cea
commit cca43f1b2e
1 changed files with 12 additions and 2 deletions

View File

@ -65,7 +65,15 @@ async function repin ({ name }) {
} }
async function checkInvoice ({ data: { hash } }) { async function checkInvoice ({ data: { hash } }) {
const inv = await getInvoice({ id: hash, lnd }) let inv
try {
inv = await getInvoice({ id: hash, lnd })
} catch (err) {
console.log(err)
// on lnd related errors, we manually retry which so we don't exponentially backoff
await boss.send('checkInvoice', { hash }, walletOptions)
return
}
console.log(inv) console.log(inv)
if (inv.is_confirmed) { if (inv.is_confirmed) {
@ -98,7 +106,9 @@ async function checkWithdrawal ({ data: { id, hash } }) {
if (err[1] === 'SentPaymentNotFound') { if (err[1] === 'SentPaymentNotFound') {
notFound = true notFound = true
} else { } else {
throw err // on lnd related errors, we manually retry which so we don't exponentially backoff
await boss.send('checkWithdrawal', { id, hash }, walletOptions)
return
} }
} }
console.log(wdrwl) console.log(wdrwl)