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

View File

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

View File

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