Fix TypeError on item creation if JIT invoicing is used (#744)

* Fix TypeError on item creation if JIT invoicing is used

* Fix bad if body

---------

Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
ekzyis 2024-01-11 02:24:49 +01:00 committed by GitHub
parent c267bf92fd
commit 39c9775c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,8 +85,9 @@ export async function serializeInvoicable (query, { models, lnd, hash, hmac, me,
let results = await serialize(models, ...trx) let results = await serialize(models, ...trx)
if (hash) { if (hash) {
if (invoice?.isHeld) await settleHodlInvoice({ secret: invoice.preimage, lnd }) if (invoice?.isHeld) { await settleHodlInvoice({ secret: invoice.preimage, lnd }) }
results = results.slice(1, -1) // remove first element since that is the confirmed invoice
[, ...results] = results
} }
// if there is only one result, return it directly, else the array // if there is only one result, return it directly, else the array