diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/ark.js | 5 | ||||
| -rw-r--r-- | src/nostr.js | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/features/ark.js b/src/features/ark.js index 1c0ad1b..ff0dd13 100644 --- a/src/features/ark.js +++ b/src/features/ark.js @@ -136,7 +136,10 @@ export function slimArkForSync(s) { actions: (s.actions || []) .filter((a) => a.step === 'done' && ['board', 'offboard', 'exit'].includes(a.type)) .map((a) => { const c = { ...a }; for (const k of HEAVY) delete c[k]; return c; }), - movements: (s.movements || []).slice(-300), + movements: (s.movements || []).slice(-200).map((m, i, arr) => + // Older rows only need to render a history line; the bolt11 (~400 chars + // each) and preimage are what pushed snapshots past relay size limits. + (arr.length - i <= 50 ? m : (({ invoice, preimage, ...rest }) => rest)(m))), gifts: s.gifts, }; } diff --git a/src/nostr.js b/src/nostr.js index 37bd62d..05ae723 100644 --- a/src/nostr.js +++ b/src/nostr.js @@ -213,7 +213,14 @@ export class NostrSync { const content = nip44.encrypt(JSON.stringify(stateObj), this.ck); evt = finalizeEvent({ kind: 30078, created_at: Math.floor(Date.now() / 1000), tags: [['d', dtag]], content }, this.sk); } catch { return; } - await Promise.allSettled(pool.publish(this.relays, evt)); + const results = await Promise.allSettled(pool.publish(this.relays, evt)); + // A refused snapshot means devices silently stop syncing — the failure + // that once hid behind "my other device shows no history". Say so. + results.forEach((r, i) => { + if (r.status === 'rejected') { + console.warn(`nostr: state snapshot (${evt.content.length}b) refused by ${this.relays[i]}:`, r.reason?.message || r.reason); + } + }); } // Deliver an encrypted DM (a locked gift's claim code) as a NIP-17 gift wrap |
