use None if on head block

This commit is contained in:
Bryan Stitt 2023-01-04 12:12:44 -08:00
parent 045065986a
commit 664ecf5924
2 changed files with 47 additions and 46 deletions

@ -10,7 +10,6 @@ use axum::{response::IntoResponse, Extension, Json};
use axum_client_ip::ClientIp;
use axum_macros::debug_handler;
use itertools::Itertools;
use log::debug;
use std::sync::Arc;
/// POST /rpc -- Public entrypoint for HTTP JSON-RPC requests. Web3 wallets use this.

@ -415,8 +415,10 @@ impl Web3Connections {
skip: &[Arc<Web3Connection>],
min_block_needed: Option<&U64>,
) -> anyhow::Result<OpenRequestResult> {
let usable_rpcs_by_head_num_and_weight: BTreeMap<(U64, u64), Vec<Arc<Web3Connection>>> =
if let Some(min_block_needed) = min_block_needed {
let usable_rpcs_by_head_num_and_weight: BTreeMap<
(Option<U64>, u64),
Vec<Arc<Web3Connection>>,
> = if let Some(min_block_needed) = min_block_needed {
// need a potentially old block. check all the rpcs
let mut m = BTreeMap::new();