Skip to content

Commit 332d1e1

Browse files
committed
don't support direct payments to bolt12
1 parent e803efe commit 332d1e1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

api/paidAction/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,15 +264,16 @@ async function performDirectAction (actionType, args, incomingContext) {
264264
invoiceObject = await createUserInvoice(userId, {
265265
msats: cost,
266266
description,
267-
expiry: INVOICE_EXPIRE_SECS
267+
expiry: INVOICE_EXPIRE_SECS,
268+
supportBolt12: false // direct payment is not supported to bolt12 for compatibility reasons
268269
}, { models, lnd })
269270
} catch (e) {
270271
console.error('failed to create outside invoice', e)
271272
throw new NonInvoiceablePeerError()
272273
}
273274

274275
const { invoice, wallet } = invoiceObject
275-
const hash = await parseBolt11({ request: invoice }).id // direct payments are always to bolt11 invoices
276+
const hash = await parseBolt11({ request: invoice }).id
276277

277278
const payment = await models.directPayment.create({
278279
data: {

wallets/server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async function checkInvoice (invoice, { msats }, { lnd, logger }) {
4747
}
4848
}
4949

50-
export async function createInvoice (userId, { msats, description, descriptionHash, expiry = 360 }, { predecessorId, models, lnd }) {
50+
export async function createInvoice (userId, { msats, description, descriptionHash, expiry = 360, supportBolt12 = true }, { predecessorId, models, lnd }) {
5151
// get the wallets in order of priority
5252
const wallets = await getInvoiceableWallets(userId, { predecessorId, models })
5353

@@ -74,6 +74,7 @@ export async function createInvoice (userId, { msats, description, descriptionHa
7474
}
7575

7676
if (!isBolt12Offer(invoice)) {
77+
if (!supportBolt12) continue
7778
checkInvoice(invoice, { msats }, { lnd, logger })
7879
}
7980

0 commit comments

Comments
 (0)