From 9932a782b278a2ba257eac5ee2a3b1442b56af29 Mon Sep 17 00:00:00 2001 From: k00b Date: Sun, 18 Aug 2024 14:06:17 -0500 Subject: [PATCH] improve autowithdraw recent failure check --- worker/autowithdraw.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/worker/autowithdraw.js b/worker/autowithdraw.js index 0805619e..ef8d49e3 100644 --- a/worker/autowithdraw.js +++ b/worker/autowithdraw.js @@ -27,13 +27,11 @@ export async function autoWithdraw ({ data: { id }, models, lnd }) { SELECT EXISTS( SELECT * FROM "Withdrawl" - WHERE "userId" = ${id} AND "autoWithdraw" - AND (status IS NULL - OR ( - status <> 'CONFIRMED' AND - now() < created_at + interval '1 hour' AND - "msatsFeePaying" >= ${maxFeeMsats} - )) + WHERE "userId" = ${id} + AND "autoWithdraw" + AND status IS DISTINCT FROM 'CONFIRMED' + AND now() < created_at + interval '1 hour' + AND "msatsFeePaying" >= ${maxFeeMsats} )` if (pendingOrFailed.exists) return