diff --git a/api/resolvers/wallet.js b/api/resolvers/wallet.js index 03945feca..daa41ab8f 100644 --- a/api/resolvers/wallet.js +++ b/api/resolvers/wallet.js @@ -482,12 +482,12 @@ const resolvers = { FROM "Withdrawl" WHERE "userId" = ${me.id} AND id = ${Number(id)} - AND now() > created_at + interval '${retention}' + AND now() > created_at + ${retention}::INTERVAL AND hash IS NOT NULL AND status IS NOT NULL ), updated_rows AS ( UPDATE "Withdrawl" - SET hash = NULL, bolt11 = NULL + SET hash = NULL, bolt11 = NULL, preimage = NULL FROM to_be_updated WHERE "Withdrawl".id = to_be_updated.id) SELECT * FROM to_be_updated;` @@ -499,7 +499,7 @@ const resolvers = { console.error(error) await models.withdrawl.update({ where: { id: invoice.id }, - data: { hash: invoice.hash, bolt11: invoice.bolt11 } + data: { hash: invoice.hash, bolt11: invoice.bolt11, preimage: invoice.preimage } }) throw new GqlInputError('failed to drop bolt11 from lnd') } diff --git a/worker/wallet.js b/worker/wallet.js index 33f6d1a7a..57156b9da 100644 --- a/worker/wallet.js +++ b/worker/wallet.js @@ -346,12 +346,12 @@ export async function autoDropBolt11s ({ models, lnd }) { SELECT id, hash, bolt11 FROM "Withdrawl" WHERE "userId" IN (SELECT id FROM users WHERE "autoDropBolt11s") - AND now() > created_at + interval '${retention}' + AND now() > created_at + ${retention}::INTERVAL AND hash IS NOT NULL AND status IS NOT NULL ), updated_rows AS ( UPDATE "Withdrawl" - SET hash = NULL, bolt11 = NULL + SET hash = NULL, bolt11 = NULL, preimage = NULL FROM to_be_updated WHERE "Withdrawl".id = to_be_updated.id) SELECT * FROM to_be_updated;` @@ -364,7 +364,7 @@ export async function autoDropBolt11s ({ models, lnd }) { console.error(`Error removing invoice with hash ${invoice.hash}:`, error) await models.withdrawl.update({ where: { id: invoice.id }, - data: { hash: invoice.hash, bolt11: invoice.bolt11 } + data: { hash: invoice.hash, bolt11: invoice.bolt11, preimage: invoice.preimage } }) } }