From d24a1b4ccbfee2f5c6b1e49a05e939d46f5b5a09 Mon Sep 17 00:00:00 2001 From: Sam Holmes Date: Sun, 14 Dec 2025 11:28:29 -0800 Subject: [PATCH] fix: use HTTP fallback for broadcast when WebSocket connections unavailable Previously, broadcastTx would fail immediately with 'Missing WebSocket connections' error when serverStatesCache was empty, never reaching the HTTP/REST fallback code. Now the HTTP fallback via NowNodes is always attempted when WebSocket broadcast isn't possible. --- CHANGELOG.md | 2 ++ src/common/utxobased/engine/ServerStates.ts | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a405184..3b5ba2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- fixed: Use HTTP fallback for transaction broadcast when WebSocket connections are unavailable + ## 3.8.9 (2025-12-04) - fixed: Change PIVX blockbook server list. diff --git a/src/common/utxobased/engine/ServerStates.ts b/src/common/utxobased/engine/ServerStates.ts index 20a538b5..18d289ab 100644 --- a/src/common/utxobased/engine/ServerStates.ts +++ b/src/common/utxobased/engine/ServerStates.ts @@ -375,13 +375,6 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { uri => serverStatesCache[uri].blockbook != null ) - // If there are no blockbook instances, reject the promise - if (wsUris.length < 1) { - reject(new Error('Unexpected error. Missing WebSocket connections.')) - // Exit early if there are blockbook instances - return - } - // Determine if there are any connected blockbook instances const isAnyBlockbookConnected = wsUris.some( uri => serverStatesCache[uri].blockbook.isConnected @@ -430,9 +423,7 @@ export function makeServerStates(config: ServerStateConfig): ServerStates { if (nowNodeUris.length < 1) { // If no HTTP servers are available, and we had no connected blockbook // instances, reject the promise with a message indicating no - // available connections. It's clear we have some connection instances - // if we gotten to this point, but we just don't have any of those - // instances connected at this time. + // available connections. reject( new Error('No available connections. Check your internet signal.') )