improve autowithdraw recent failure check
This commit is contained in:
parent
11ddbe3983
commit
9932a782b2
|
@ -27,13 +27,11 @@ export async function autoWithdraw ({ data: { id }, models, lnd }) {
|
||||||
SELECT EXISTS(
|
SELECT EXISTS(
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM "Withdrawl"
|
FROM "Withdrawl"
|
||||||
WHERE "userId" = ${id} AND "autoWithdraw"
|
WHERE "userId" = ${id}
|
||||||
AND (status IS NULL
|
AND "autoWithdraw"
|
||||||
OR (
|
AND status IS DISTINCT FROM 'CONFIRMED'
|
||||||
status <> 'CONFIRMED' AND
|
AND now() < created_at + interval '1 hour'
|
||||||
now() < created_at + interval '1 hour' AND
|
AND "msatsFeePaying" >= ${maxFeeMsats}
|
||||||
"msatsFeePaying" >= ${maxFeeMsats}
|
|
||||||
))
|
|
||||||
)`
|
)`
|
||||||
|
|
||||||
if (pendingOrFailed.exists) return
|
if (pendingOrFailed.exists) return
|
||||||
|
|
Loading…
Reference in New Issue