aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/ln-receive-twin-test.js8
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);