diff options
| author | Adam Soltys <[email protected]> | 2025-05-11 16:31:42 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-05-11 16:31:42 -0700 |
| commit | bed887ae567acd4f8480bd3e2726474f79021714 (patch) | |
| tree | 72545f4a532792cc0ced2370a1f7512886bfcf10 /lib/payments.ts | |
| parent | c7b93725a08333516c89bdb64f4b4149f6b0da2b (diff) | |
| download | coinos-server-bed887ae567acd4f8480bd3e2726474f79021714.tar.gz coinos-server-bed887ae567acd4f8480bd3e2726474f79021714.zip | |
check frozen balance
Diffstat (limited to 'lib/payments.ts')
| -rw-r--r-- | lib/payments.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/payments.ts b/lib/payments.ts index a0611c51..38e8eab6 100644 --- a/lib/payments.ts +++ b/lib/payments.ts @@ -1,6 +1,6 @@ import config from "$config"; import api from "$lib/api"; -import { db, g, s } from "$lib/db"; +import { db, g, ga, s } from "$lib/db"; import { generate } from "$lib/invoices"; import ln from "$lib/ln"; import { err, l, warn } from "$lib/logging"; @@ -120,6 +120,7 @@ export const debit = async ({ : 0; if (aid && aid !== uid) ourfee = 0; + const frozenBalance = await ga(`balance:${uid}`); ourfee = await db.debit( `balance:${aid || uid}`, @@ -128,8 +129,10 @@ export const debit = async ({ tip || 0, fee || 0, ourfee || 0, + frozenBalance, + t(user).insufficientFunds, ); - + if (ourfee.err) fail(ourfee.err); const id = v4(); |
