From ffb554d0b3c7cadeec8351b083ebdf70af7fc7f8 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Sat, 29 Apr 2023 18:50:26 -0700 Subject: [PATCH] online editor isn't actually nice when it misses syntax errors :( --- web3_proxy/src/rpcs/many.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/web3_proxy/src/rpcs/many.rs b/web3_proxy/src/rpcs/many.rs index dca48282..6e6d121b 100644 --- a/web3_proxy/src/rpcs/many.rs +++ b/web3_proxy/src/rpcs/many.rs @@ -511,13 +511,16 @@ impl Web3Rpcs { min_block_needed: Option<&U64>, max_block_needed: Option<&U64>, ) -> Web3ProxyResult { - let usable_rpcs_by_tier_and_head_number: BTreeMap<(u64, Reverse>), Vec>> = { + let usable_rpcs_by_tier_and_head_number: BTreeMap< + (u64, Reverse>), + Vec>, + > = { let mut m = BTreeMap::new(); if self.watch_consensus_head_sender.is_none() { // pick any server - let key = (0, Reverse); + let key = (0, Reverse(None)); for x in self.by_name.read().values() { if skip.contains(x) { @@ -630,7 +633,7 @@ impl Web3Rpcs { } } - let key = (x.tier, Reverse); + let key = (x.tier, Reverse(Some(*x_head_num))); m.entry(key).or_insert_with(Vec::new).push(x); } @@ -643,7 +646,7 @@ impl Web3Rpcs { // the key doesn't matter if we are checking synced connections // they are all at the same block and it is already sized to what we need - let key = (0, Reverse); + let key = (0, Reverse(None)); for x in synced_connections.best_rpcs.iter() { if skip.contains(x) {