Verify testCreateInvoice returns a payment request (#2063)

* Verify testCreateInvoice returns a payment request

* Use GqlInputError
This commit is contained in:
ekzyis 2025-04-03 20:39:29 +02:00 committed by GitHub
parent b617ac0a56
commit 78f7e006d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -854,7 +854,10 @@ async function upsertWallet (
if (testCreateInvoice) {
try {
await testCreateInvoice(data)
const pr = await testCreateInvoice(data)
if (!pr || typeof pr !== 'string' || !pr.startsWith('lnbc')) {
throw new GqlInputError('not a valid payment request')
}
} catch (err) {
const message = 'failed to create test invoice: ' + (err.message || err.toString?.())
logger.error(message)