remove buried default max_lag_block_number

This commit is contained in:
Bryan Stitt 2023-11-01 12:06:26 -07:00
parent 361df4342f
commit 422c006468
2 changed files with 5 additions and 6 deletions

View File

@ -196,7 +196,7 @@ impl Web3Rpcs {
// TODO: should this be spawned and then we just hold onto the handle here?
let mut consensus_finder =
ConsensusFinder::new(Some(self.max_head_block_age), Some(self.max_head_block_lag));
ConsensusFinder::new(Some(self.max_head_block_age), self.max_head_block_lag);
// TODO: what timeout on block receiver? we want to keep consensus_finder fresh so that server tiers are correct
let triple_block_time = average_block_interval(self.chain_id).mul_f32(3.0);

View File

@ -354,14 +354,14 @@ pub struct ConsensusFinder {
rpc_heads: HashMap<Arc<Web3Rpc>, Web3ProxyBlock>,
/// no consensus if the best known block is too old
max_head_block_age: Option<Duration>,
/// tier 0 will be prefered as long as the distance between it and the other tiers is <= max_tier_lag
max_head_block_lag: Option<U64>,
/// no consensus if the best consensus block is too far behind the best known
max_head_block_lag: U64,
/// Block Hash -> First Seen Instant. used to track rpc.head_delay. The same cache should be shared between all ConnectionsGroups
first_seen: FirstSeenCache,
}
impl ConsensusFinder {
pub fn new(max_head_block_age: Option<Duration>, max_head_block_lag: Option<U64>) -> Self {
pub fn new(max_head_block_age: Option<Duration>, max_head_block_lag: U64) -> Self {
// TODO: what's a good capacity for this? it shouldn't need to be very large
let first_seen = Cache::new(16);
@ -782,8 +782,7 @@ impl ConsensusFinder {
// TODO: move this default. should be in config, not here
// TODO: arbitrum needs more slack
let max_lag_block_number = highest_block_number
.saturating_sub(self.max_head_block_lag.unwrap_or_else(|| U64::from(5)));
let max_lag_block_number = highest_block_number.saturating_sub(self.max_head_block_lag);
trace!("max_lag_block_number: {}", max_lag_block_number);