make wait_for_best_rpc work for private/4337/groups without head subscriptions

This commit is contained in:
Bryan Stitt 2023-09-02 10:59:07 -07:00
parent 2cf688cc68
commit 633abc0d60
2 changed files with 24 additions and 14 deletions

@ -1340,20 +1340,18 @@ impl Web3ProxyApp {
| "eth_supportedEntryPoints"
| "web3_bundlerVersion") => match self.bundler_4337_rpcs.as_ref() {
Some(bundler_4337_rpcs) => {
// let x = bundler_4337_rpcs
// .try_send_all_synced_connections::<Box<RawValue>>(
// method,
// params,
// Some(request_metadata),
// None,
// None,
// Some(Duration::from_secs(30)),
// Some(Level::DEBUG.into()),
// Some(1),
// )
// .await?;
// x.into()
todo!("wip");
let x = bundler_4337_rpcs
.try_proxy_connection::<_, Box<RawValue>>(
method,
params,
Some(request_metadata),
Some(Duration::from_secs(30)),
None,
None,
)
.await?;
x.into()
}
None => {
// TODO: stats even when we error!

@ -538,6 +538,18 @@ impl Web3Rpcs {
.and_then(|x| x.authorization.clone())
.unwrap_or_default();
if self.watch_head_block.is_none() {
// if this group of servers is not watching the head block, we don't know what is "best" based on block height
// TODO: do this without cloning here
let potential_rpcs = self.by_name.read().values().cloned().collect::<Vec<_>>();
let x = self
._best_available_rpc(&authorization, error_handler, &potential_rpcs, skip_rpcs)
.await;
return Ok(x);
}
let mut watch_ranked_rpcs = self.watch_ranked_rpcs.subscribe();
let mut potential_rpcs = Vec::new();