From a762a7ea401096deded2afc876fa681fe50893ad Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 22 Jun 2026 15:43:09 +0200 Subject: [PATCH] fix(machine): guard the availability beacon sign against bunker blips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The beacon's createSignedEvent (a bunker round-trip) sat OUTSIDE its try/catch, and publish() is fire-and-forget — so a transient BunkerTimeoutError / BunkerRejectedError during the periodic sign surfaced as an uncaught promise rejection (seen on the Sintra after a bunker watchdog blip during the cash-in smoke). Move the sign inside the try; the beacon re-publishes every interval, so swallow + log is correct. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../composables/useAvailabilityBroadcast.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/machine/src/composables/useAvailabilityBroadcast.ts b/apps/machine/src/composables/useAvailabilityBroadcast.ts index a4968f7..20517e9 100644 --- a/apps/machine/src/composables/useAvailabilityBroadcast.ts +++ b/apps/machine/src/composables/useAvailabilityBroadcast.ts @@ -73,19 +73,22 @@ export function useAvailabilityBroadcast(options: UseAvailabilityBroadcastOption model, }) - const event = await createSignedEvent(signer, { - kind: 30078, - created_at: Math.floor(Date.now() / 1000), - tags: [['d', 'atm-availability']], - content, - }) - + // Signing goes through the bunker, so it can throw BunkerTimeoutError / + // BunkerRejectedError — keep it INSIDE the try so a transient signer blip + // is swallowed (the beacon re-publishes every interval) rather than + // surfacing as an uncaught rejection. `publish()` is fire-and-forget. try { + const event = await createSignedEvent(signer, { + kind: 30078, + created_at: Math.floor(Date.now() / 1000), + tags: [['d', 'atm-availability']], + content, + }) await nostrClient.publish(event) lastSnapshot = snap console.log('[Availability] Published:', content) } catch (e) { - console.warn('[Availability] Failed to publish:', e) + console.warn('[Availability] Publish failed (sign or relay):', e) } }