Skip to content

Commit d24a1b4

Browse files
committed
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.
1 parent 54999ff commit d24a1b4

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- fixed: Use HTTP fallback for transaction broadcast when WebSocket connections are unavailable
6+
57
## 3.8.9 (2025-12-04)
68

79
- fixed: Change PIVX blockbook server list.

src/common/utxobased/engine/ServerStates.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,6 @@ export function makeServerStates(config: ServerStateConfig): ServerStates {
375375
uri => serverStatesCache[uri].blockbook != null
376376
)
377377

378-
// If there are no blockbook instances, reject the promise
379-
if (wsUris.length < 1) {
380-
reject(new Error('Unexpected error. Missing WebSocket connections.'))
381-
// Exit early if there are blockbook instances
382-
return
383-
}
384-
385378
// Determine if there are any connected blockbook instances
386379
const isAnyBlockbookConnected = wsUris.some(
387380
uri => serverStatesCache[uri].blockbook.isConnected
@@ -430,9 +423,7 @@ export function makeServerStates(config: ServerStateConfig): ServerStates {
430423
if (nowNodeUris.length < 1) {
431424
// If no HTTP servers are available, and we had no connected blockbook
432425
// instances, reject the promise with a message indicating no
433-
// available connections. It's clear we have some connection instances
434-
// if we gotten to this point, but we just don't have any of those
435-
// instances connected at this time.
426+
// available connections.
436427
reject(
437428
new Error('No available connections. Check your internet signal.')
438429
)

0 commit comments

Comments
 (0)