aboutsummaryrefslogtreecommitdiffstats
path: root/test/forward.test.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-09 01:19:33 -0800
committerAdam Soltys <[email protected]>2026-02-09 01:19:33 -0800
commit6f933c6e989f934364a276815826364fec5a85b4 (patch)
tree54e5b7818250a8cadcbb20111f24c9a5ee4bc674 /test/forward.test.ts
parent3cde20ead47bf2fc895ea37789b824098b984f7a (diff)
downloadcoinos-server-6f933c6e989f934364a276815826364fec5a85b4.tar.gz
coinos-server-6f933c6e989f934364a276815826364fec5a85b4.zip
ark fixes
Diffstat (limited to 'test/forward.test.ts')
-rw-r--r--test/forward.test.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/forward.test.ts b/test/forward.test.ts
index c387c489..1e0cd566 100644
--- a/test/forward.test.ts
+++ b/test/forward.test.ts
@@ -296,12 +296,12 @@ describe("arkReceive", () => {
describe("arkSync", () => {
beforeEach(resetAll);
- test("skips received/change VTXOs (positive amounts)", async () => {
+ test("records received VTXOs (positive amounts)", async () => {
const req = {
body: {
aid: arkAccountId,
transactions: [
- { hash: "change-vtxo-hash", amount: 9000, settled: true, createdAt: Date.now() },
+ { hash: "recv-vtxo-hash", amount: 9000, settled: true, createdAt: Date.now() },
],
},
user: makeUser(),
@@ -311,8 +311,9 @@ describe("arkSync", () => {
await routes.arkSync(req as any, res as any);
const sent = (res as any).getSent();
- expect(sent.synced).toBe(0);
- expect(store().listStore[`${arkAccountId}:payments`] ?? []).toHaveLength(0);
+ expect(sent.synced).toBe(1);
+ expect(sent.received).toBe(9000);
+ expect(store().listStore[`${arkAccountId}:payments`] ?? []).toHaveLength(1);
});
test("records sent transactions (negative amounts)", async () => {
@@ -335,7 +336,8 @@ describe("arkSync", () => {
});
test("deduplicates known transactions", async () => {
- // Pre-store a known tx hash
+ // Pre-store a known tx hash and its sync lock
+ store().kvStore[`arksync:${arkAccountId}:known-hash`] = "1";
store().kvStore[`payment:${arkAccountId}:known-hash`] = JSON.stringify("existing-id");
store().kvStore["payment:existing-id"] = JSON.stringify({ id: "existing-id", confirmed: false });