catch wrap invoice error as noninvoiceable
This commit is contained in:
parent
67a0565c04
commit
09bacdc016
|
@ -198,24 +198,30 @@ async function performP2PAction (actionType, args, incomingContext) {
|
||||||
throw new NonInvoiceablePeerError()
|
throw new NonInvoiceablePeerError()
|
||||||
}
|
}
|
||||||
|
|
||||||
await assertBelowMaxPendingInvoices(incomingContext)
|
let context
|
||||||
|
try {
|
||||||
|
await assertBelowMaxPendingInvoices(incomingContext)
|
||||||
|
|
||||||
const description = await paidActions[actionType].describe(args, incomingContext)
|
const description = await paidActions[actionType].describe(args, incomingContext)
|
||||||
const { invoice, wrappedInvoice, wallet, maxFee } = await createWrappedInvoice(userId, {
|
const { invoice, wrappedInvoice, wallet, maxFee } = await createWrappedInvoice(userId, {
|
||||||
msats: cost,
|
msats: cost,
|
||||||
feePercent: sybilFeePercent,
|
feePercent: sybilFeePercent,
|
||||||
description,
|
description,
|
||||||
expiry: INVOICE_EXPIRE_SECS
|
expiry: INVOICE_EXPIRE_SECS
|
||||||
}, { models, me, lnd })
|
}, { models, me, lnd })
|
||||||
|
|
||||||
const context = {
|
context = {
|
||||||
...incomingContext,
|
...incomingContext,
|
||||||
invoiceArgs: {
|
invoiceArgs: {
|
||||||
bolt11: invoice,
|
bolt11: invoice,
|
||||||
wrappedBolt11: wrappedInvoice,
|
wrappedBolt11: wrappedInvoice,
|
||||||
wallet,
|
wallet,
|
||||||
maxFee
|
maxFee
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('failed to create wrapped invoice', e)
|
||||||
|
throw new NonInvoiceablePeerError()
|
||||||
}
|
}
|
||||||
|
|
||||||
return me
|
return me
|
||||||
|
|
Loading…
Reference in New Issue