Skip to content

Commit

Permalink
p2p fallbacks and lnurlp
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Nov 9, 2024
1 parent 9f9804a commit 707826c
Show file tree
Hide file tree
Showing 39 changed files with 1,077 additions and 563 deletions.
4 changes: 2 additions & 2 deletions api/paidAction/boost.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export async function perform ({ invoiceId, sats, id: itemId, ...args }, { me, c
}

export async function retry ({ invoiceId, newInvoiceId }, { tx, cost }) {
await tx.itemAct.updateMany({ where: { invoiceId }, data: { invoiceId: newInvoiceId, invoiceActionState: 'PENDING' } })
const [{ id, path }] = await tx.$queryRaw`
SELECT "Item".id, ltree2text(path) as path
FROM "Item"
JOIN "ItemAct" ON "Item".id = "ItemAct"."itemId"
WHERE "ItemAct"."invoiceId" = ${newInvoiceId}::INTEGER`
WHERE "ItemAct"."invoiceId" = ${invoiceId}::INTEGER`
await tx.itemAct.updateMany({ where: { invoiceId }, data: { invoiceId: newInvoiceId, invoiceActionState: 'PENDING' } })
return { id, sats: msatsToSats(cost), act: 'BOOST', path }
}

Expand Down
4 changes: 2 additions & 2 deletions api/paidAction/downZap.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export async function perform ({ invoiceId, sats, id: itemId }, { me, cost, tx }
}

export async function retry ({ invoiceId, newInvoiceId }, { tx, cost }) {
await tx.itemAct.updateMany({ where: { invoiceId }, data: { invoiceId: newInvoiceId, invoiceActionState: 'PENDING' } })
const [{ id, path }] = await tx.$queryRaw`
SELECT "Item".id, ltree2text(path) as path
FROM "Item"
JOIN "ItemAct" ON "Item".id = "ItemAct"."itemId"
WHERE "ItemAct"."invoiceId" = ${newInvoiceId}::INTEGER`
WHERE "ItemAct"."invoiceId" = ${invoiceId}::INTEGER`
await tx.itemAct.updateMany({ where: { invoiceId }, data: { invoiceId: newInvoiceId, invoiceActionState: 'PENDING' } })
return { id, sats: msatsToSats(cost), act: 'DONT_LIKE_THIS', path }
}

Expand Down
Loading

0 comments on commit 707826c

Please sign in to comment.