dont check heads while waiting

this isn't great. but should work better than what we have
This commit is contained in:
Bryan Stitt 2023-05-18 13:47:00 -07:00
parent 8898ffe578
commit a92c93706b

@ -129,18 +129,19 @@ impl ConsensusWeb3Rpcs {
needed_block_num: Option<&U64>, needed_block_num: Option<&U64>,
skip_rpcs: &[Arc<Web3Rpc>], skip_rpcs: &[Arc<Web3Rpc>],
) -> ShouldWaitForBlock { ) -> ShouldWaitForBlock {
if self // TODO: i think checking synced is always a waste of time. though i guess there could be a race
.head_rpcs // if self
.iter() // .head_rpcs
.any(|rpc| self.rpc_will_work_eventually(rpc, needed_block_num, skip_rpcs)) // .iter()
{ // .any(|rpc| self.rpc_will_work_eventually(rpc, needed_block_num, skip_rpcs))
let head_num = self.head_block.number(); // {
// let head_num = self.head_block.number();
if Some(head_num) >= needed_block_num { // if Some(head_num) >= needed_block_num {
debug!("best (head) block: {}", head_num); // debug!("best (head) block: {}", head_num);
return ShouldWaitForBlock::Ready; // return ShouldWaitForBlock::Ready;
} // }
} // }
// all of the head rpcs are skipped // all of the head rpcs are skipped