diff options
| author | Adam Soltys <[email protected]> | 2026-08-01 18:00:51 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-01 18:00:51 -0700 |
| commit | 711807cb81f85408451b843e1a53e9616fd6df3b (patch) | |
| tree | 9ab1b8cc2bcb0084cb4cbe613c8da77173356e96 /src | |
| parent | 4ca5dd0afa7848d100f0b99be7b53f5dcb2fd061 (diff) | |
| download | coinosv3-711807cb81f85408451b843e1a53e9616fd6df3b.tar.gz coinosv3-711807cb81f85408451b843e1a53e9616fd6df3b.zip | |
Keep sync snapshots under relay size limits, and say when they bounce
Tonight's payments pushed the encrypted snapshot past strfry's 64KB
maxEventSize and every publish after the first zap was silently
refused — the other device just showed no history, with nothing logged
anywhere. The relay's limit is raised to 256KB; client-side, movements
older than the last 50 now drop their bolt11/preimage (~half a KB per
ln-send) and the cap tightens to 200, and a refused snapshot publish
logs the relay's reason.
Co-Authored-By: Claude Fable 5 <[email protected]>
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 |
