Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/resolvers/serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ export async function serializeInvoicable (query, { models, lnd, hash, hmac, me,
let results = await serialize(models, ...trx)

if (hash) {
if (invoice?.isHeld) await settleHodlInvoice({ secret: invoice.preimage, lnd })
results = results.slice(1, -1)
if (invoice?.isHeld) { await settleHodlInvoice({ secret: invoice.preimage, lnd }) }
// remove first element since that is the confirmed invoice
[, ...results] = results
Comment on lines +89 to +90
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't know what the first element is but it should be the confirmed invoice. But it's a 1, not a 0 which is what confirm_invoice should return. 🤔

}

// if there is only one result, return it directly, else the array
Expand Down