rust-electrum-client
rust-electrum-client copied to clipboard
server_features hangs on certain versions of electrs
Calling server_features() usually works without any problems when called against the electrs server hosted by blockstream, or regular instances of the official electrs (https://github.com/romanz/electrs). But the call hangs indefinitely when called against a self hosted instance of the blockstream fork (https://github.com/Blockstream/electrs) #rev a808b51d0d9301fa82390b985c57551966001f9b running at:
- ax101.blockeng.ch:50002
- ax101.blockeng.ch:60002
- ulrichard.ch:50002
It would be cool, if the call timed out after a certain time.
I wanted to also open an issue at (https://github.com/Blockstream/electrs), but opening issues is disabled there.
There's an option to set the timeout in the client builder, does it still timeout even when that is set to some value?
See: https://docs.rs./electrum-client/0.11.0/electrum_client/struct.ConfigBuilder.html#method.timeout
I tried to reproduce the problem with
extern crate electrsd;
extern crate electrum_client;
use electrum_client::{Client, ElectrumApi};
use electrsd::bitcoind;
#[test]
fn test_server_features_electrsd() {
let bitcoind_exe =
bitcoind::downloaded_exe_path().expect("bitcoind version feature must be enabled");
let bitcoind = bitcoind::BitcoinD::new(bitcoind_exe).unwrap();
let electrs_exe =
electrsd::downloaded_exe_path().expect("electrs version feature must be enabled");
let mut electrs_conf = electrsd::Conf::default();
electrs_conf.view_stderr = true;
let electrsd = electrsd::ElectrsD::with_conf(&electrs_exe, &bitcoind, &electrs_conf).unwrap();
let url = &electrsd.electrum_url;
let client = Client::new(&url).unwrap();
if let Err(err) = client.server_features() {
panic!("electrum server error {} : {:?}", url, err);
}
}
#[test]
fn test_server_features_ulrichard() {
let url = "ssl://ulrichard.ch:50002";
let client = Client::new(&url).unwrap();
if let Err(err) = client.server_features() {
panic!("electrum server error {} : {:?}", url, err);
}
}
It doesn't hang, but gives the following error: connection handling failed: Error: unknown method server.features []
In our production system I am using ping() instead of server_features() to determine which servers to use. Hence, this issue can be closed.