aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/ark.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-07-06 10:30:27 -0700
committerAdam Soltys <[email protected]>2026-07-06 10:30:27 -0700
commit7041fa7aee6c7cb2f3a04ac06a180e2cb5dc7336 (patch)
treeda5623bc063e413429a9c0acfd70057cfa1296cf /src/features/ark.js
parente74b576c8641627a700ffa82fd7179b8cf84993d (diff)
downloadcoinosv3-7041fa7aee6c7cb2f3a04ac06a180e2cb5dc7336.tar.gz
coinosv3-7041fa7aee6c7cb2f3a04ac06a180e2cb5dc7336.zip
Publish ark state on connect so idle devices share their balance
Cross-device ark sync only re-published on a state change (send/board), so a device holding ark funds but making no transaction never wrote its state to the relay — another device could never see those coins (and a legacy shared-tag snapshot that got clobbered to zero-ark stayed that way). connectArk now calls saveCache once on connect when there are vtxos, publishing this device's balance to its per-device slot so every device's ark funds reach the relay and get merged, no transaction needed. Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat (limited to 'src/features/ark.js')
-rw-r--r--src/features/ark.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/features/ark.js b/src/features/ark.js
index ba509aa..bf7b94f 100644
--- a/src/features/ark.js
+++ b/src/features/ark.js
@@ -177,6 +177,12 @@ export function arkFeature(ctx) {
ark = mgr;
announceArkAddress(mgr); // ark zaps: tell nostr where our mailbox lives
startNwcFunding(mgr); // NWC bridge: honor funding requests within the allowance
+ // Publish this device's ark state to its per-device sync slot on connect.
+ // Cross-device sync only re-published on a state CHANGE (a send/board), so
+ // an idle device never shared its coins — another device would never see
+ // them. Publishing on connect guarantees every device's ark balance
+ // reaches the relay (and gets merged) without needing a transaction first.
+ if (mgr.state && (mgr.state.vtxos || []).length) { try { wallet.saveCache(); } catch {} }
const tick = () => mgr.sync().catch(() => {}).then(() => driveExits(mgr)).catch(() => {});
tick();
// Reconcile once on connect: a vtxo synced in from another device (or