From 19ca909ef50f9b6fedbee02120a1f075fa449814 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 16 Oct 2025 22:17:48 +0200 Subject: [PATCH] fix: setup pool and relays BEFORE bunker reconnection subscription - Move NostrConnectSigner.pool assignment before active account subscription - Move pool.group(RELAYS) before subscription - This ensures pool is ready when bunker signer tries to send requests - The subscription can fire immediately, so pool must be configured first - Add log to confirm pool assignment --- src/App.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 5169ff10..48faa582 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -221,6 +221,15 @@ function App() { const pool = new RelayPool() + // Setup NostrConnectSigner to use the relay pool FIRST before any reconnections + NostrConnectSigner.pool = pool + console.log('[bunker] ✅ Pool assigned to NostrConnectSigner') + + // Create a relay group for better event deduplication and management + pool.group(RELAYS) + console.log('Created relay group with', RELAYS.length, 'relays (including local)') + console.log('Relay URLs:', RELAYS) + // Reconnect bunker signers when active account changes // Keep track of which accounts we've already reconnected to avoid double-connecting const reconnectedAccounts = new Set() @@ -278,14 +287,6 @@ function App() { } }) - // Setup NostrConnectSigner to use the relay pool - NostrConnectSigner.pool = pool - - // Create a relay group for better event deduplication and management - pool.group(RELAYS) - console.log('Created relay group with', RELAYS.length, 'relays (including local)') - console.log('Relay URLs:', RELAYS) - // Keep all relay connections alive indefinitely by creating a persistent subscription // This prevents disconnection when no other subscriptions are active // Create a minimal subscription that never completes to keep connections alive