minor improvement

This commit is contained in:
Bryan Stitt 2022-04-29 02:22:54 +00:00
parent 7510db4989
commit 1669c15a32

@ -373,6 +373,19 @@ impl Web3ProxyApp {
.ok_or_else(|| anyhow::anyhow!("no params"))? .ok_or_else(|| anyhow::anyhow!("no params"))?
.to_owned(); .to_owned();
if rpc_servers.len() == 1 {
let rpc = rpc_servers.first().unwrap();
let provider = connections.get(rpc).unwrap().clone_provider();
let response = provider.request(&method, params).await;
connections.get(rpc).unwrap().dec_active_requests();
tx.send(response.map_err(Into::into))?;
Ok(())
} else {
// TODO: lets just use a usize index or something // TODO: lets just use a usize index or something
let method = Arc::new(method); let method = Arc::new(method);
@ -435,6 +448,7 @@ impl Web3ProxyApp {
Ok(()) Ok(())
} }
} }
}
} }
#[tokio::main] #[tokio::main]