fix(machine): guard the availability beacon sign against bunker blips #67

Merged
padreug merged 1 commit from beacon-sign-guard into dev 2026-06-22 13:56:30 +00:00

View file

@ -73,19 +73,22 @@ export function useAvailabilityBroadcast(options: UseAvailabilityBroadcastOption
model, model,
}) })
const event = await createSignedEvent(signer, { // Signing goes through the bunker, so it can throw BunkerTimeoutError /
kind: 30078, // BunkerRejectedError — keep it INSIDE the try so a transient signer blip
created_at: Math.floor(Date.now() / 1000), // is swallowed (the beacon re-publishes every interval) rather than
tags: [['d', 'atm-availability']], // surfacing as an uncaught rejection. `publish()` is fire-and-forget.
content,
})
try { try {
const event = await createSignedEvent(signer, {
kind: 30078,
created_at: Math.floor(Date.now() / 1000),
tags: [['d', 'atm-availability']],
content,
})
await nostrClient.publish(event) await nostrClient.publish(event)
lastSnapshot = snap lastSnapshot = snap
console.log('[Availability] Published:', content) console.log('[Availability] Published:', content)
} catch (e) { } catch (e) {
console.warn('[Availability] Failed to publish:', e) console.warn('[Availability] Publish failed (sign or relay):', e)
} }
} }