diff options
| author | Adam Soltys <[email protected]> | 2026-10-09 16:45:22 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-09 16:45:22 -0700 |
| commit | 095caadcba5a63f5969e50777d7e482c1d32174e (patch) | |
| tree | 6106cc7dd21d3328c788026c237d8310b720eda4 /tools | |
| parent | 20369cae83fe02968ac4318f3b8f4e9dcbbaa1cf (diff) | |
| download | coinosv3-095caadcba5a63f5969e50777d7e482c1d32174e.tar.gz coinosv3-095caadcba5a63f5969e50777d7e482c1d32174e.zip | |
Spending: one coin, one "Received" row — across devices. The Daniel still saw four "Received 1,000" rows and "Payment received! 4,000" for what the ASP shows is a single 1,000 sat coin (and two rows for his 1,005). A receive movement is recorded by every device or tab that sees the coin arrive, each under its own id, and the cross-device merge unions movements by id — so each kept its own row, and the registrar-receipt tagging marked some ⚡. lnFoldedIds now also folds receives of the same coin: the ⚡-tagged one stays (its icon is right), else the earliest. Same read-time derivation as the claim twins (history, celebration, arkMovements, LN tagging), so nothing is deleted and no synced copy brings a twin back.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Vps2H27rhbG9ZqseGfMrc3
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/ln-receive-twin-test.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/ln-receive-twin-test.js b/tools/ln-receive-twin-test.js index bbec971..20d4f48 100644 --- a/tools/ln-receive-twin-test.js +++ b/tools/ln-receive-twin-test.js @@ -27,5 +27,13 @@ f = lnFoldedIds([ln('L1', 500, T), ln('L2', 500, T + 5000), rcv('R1', 500, T + 1 check('two claims of one amount fold one receive each', f.has('R1') && f.has('R2') && f.size === 2); f = lnFoldedIds([rcv('R', 1005, T), rcv('S', 2000, T)]); check('plain receives with no claim stay', f.size === 0); +// the same coin recorded by two devices (each its own movement id), one of +// them tagged ⚡ by the registrar's receipts: one row, the tagged one +f = lnFoldedIds([rcv('A', 1000, T), { ...rcv('B', 1000, T + 2000), vtxoId: 'v-A', viaLn: true }, { ...rcv('C', 1000, T + 3000), vtxoId: 'v-A' }, { ...rcv('D', 1000, T + 4000), vtxoId: 'v-A', viaLn: true }]); +check('one coin recorded four times shows once, the ⚡ copy', f.size === 3 && !f.has('B'), [...f].join(',')); +f = lnFoldedIds([rcv('A', 1000, T), { ...rcv('B', 1000, T + 2000), vtxoId: 'v-A' }]); +check('...or the earliest when none is tagged', f.size === 1 && f.has('B')); +f = lnFoldedIds([rcv('A', 1000, T), rcv('B', 1000, T + 2000)]); +check('two coins of the same amount stay two rows', f.size === 0); console.log(ok ? '\n✅ a claimed LN receive is told once' : '\n❌ failed'); process.exit(ok ? 0 : 1); |
