diff options
| author | Adam Soltys <[email protected]> | 2026-02-04 14:05:09 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-06 08:59:46 -0800 |
| commit | c0481268da25eed1f25281508b5c4777d26c2b03 (patch) | |
| tree | f04cd4feacd920029dc5cfcb145a9debe329cad6 /routes | |
| parent | 384c4778ca5421c091a7d282b90b00965f3596cd (diff) | |
| download | coinos-server-c0481268da25eed1f25281508b5c4777d26c2b03.tar.gz coinos-server-c0481268da25eed1f25281508b5c4777d26c2b03.zip | |
remove reconcile payments
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/payments.ts | 6 | ||||
| -rw-r--r-- | routes/users.ts | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/routes/payments.ts b/routes/payments.ts index b14dc588..f9225b87 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -497,6 +497,12 @@ export default { const invoice = await getInvoice(address); if (!hot && aid !== invoice?.aid) continue; if (sats(amount) < 300) continue; + + const lockKey = `lock:${txid}:${vout}`; + const locked = await db.setNX(lockKey, "1"); + if (!locked) continue; + await db.expire(lockKey, 60); + await credit({ hash: address, amount: sats(amount), diff --git a/routes/users.ts b/routes/users.ts index a7188552..3d9602cf 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -21,7 +21,7 @@ import { authenticator } from "otplib"; import { v4 } from "uuid"; import { PaymentType } from "$lib/types"; -import { reconcile } from "$lib/payments"; +import { importAccountHistory } from "$lib/payments"; import type { ProfilePointer } from "nostr-tools/nip19"; const { host } = new URL(process.env.URL); @@ -834,6 +834,9 @@ export default { for (const id of await db.lRange(`${user.id}:accounts`, 0, -1)) { const account = await g(`account:${id}`); if (account) { + if (account.seed && account.pubkey && !account.importedAt) { + await importAccountHistory(account); + } account.balance = await g(`balance:${id}`); accounts.push(account); } @@ -884,6 +887,7 @@ export default { nextIndex: 0, arkAddress, accountIndex, + importedAt: seed ? Date.now() : undefined, }; // ARK accounts don't need Bitcoin Core wallet setup @@ -940,8 +944,6 @@ export default { .lPush(`${user.id}:accounts`, id) .exec(); - reconcile(account, true); - res.send(account); } catch (e) { bail(res, e.message); |
