Skip to content

Add --daemon-rpc-fallback-addr for backup bitcoind RPC#216

Open
EddieHouston wants to merge 1 commit into
Blockstream:new-indexfrom
EddieHouston:feat/dual-daemon-rpc
Open

Add --daemon-rpc-fallback-addr for backup bitcoind RPC#216
EddieHouston wants to merge 1 commit into
Blockstream:new-indexfrom
EddieHouston:feat/dual-daemon-rpc

Conversation

@EddieHouston
Copy link
Copy Markdown
Collaborator

@EddieHouston EddieHouston commented May 20, 2026

Summary

  • Adds a new --daemon-rpc-fallback-addr CLI flag (optional) that specifies a backup bitcoind JSON-RPC endpoint.
  • When the primary --daemon-rpc-addr is unreachable, electrs immediately tries the fallback before entering the 3-second backoff loop.
  • On every reconnect the primary is attempted first, so electrs automatically migrates back once the primary recovers.

Motivation

Allows running electrs against a pair of bitcoind nodes (e.g. primary + warm standby) so that transient restarts or maintenance on the primary don't stall indexing.

Changes

  • config.rs — new daemon_rpc_fallback_addr: Option<SocketAddr> field and CLI arg
  • daemon.rstcp_connect tries primary then fallback; Connection stores and propagates the fallback through reconnect()
  • electrs.rs, tx-fingerprint-stats.rs — pass the new field through to Daemon::new

Test plan

  • Start electrs with only --daemon-rpc-addr (no fallback) — verify behavior is unchanged
  • Start electrs with --daemon-rpc-fallback-addr pointing to a second bitcoind, stop the primary — verify electrs connects to fallback
  • Restart the primary — verify electrs reconnects to primary on next reconnect cycle

  When the primary bitcoind is unreachable, electrs will immediately
  attempt the fallback address before backing off.  On reconnect the
  primary is always tried first so electrs migrates back automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants