-
Notifications
You must be signed in to change notification settings - Fork 49
cuprated: add pop blocks command #545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if self.seeds.len() < RX_SEEDS_CACHED { | ||
let seed_heights = get_last_rx_seed_heights(new_height, RX_SEEDS_CACHED) | ||
.split_at(self.seeds.len()) | ||
.1 | ||
.to_vec(); | ||
let seed_hashes = get_block_hashes(seed_heights.clone(), database).await?; | ||
|
||
self.seeds.extend(seed_heights.into_iter().zip(seed_hashes)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RX cache would panic if too many blocks were popped as it would have no seeds, this adds the seeds
consensus/context/src/weight.rs
Outdated
let old_long_term_weights = if let Some(new_long_term_start_height) = | ||
chain_height.checked_sub(self.config.long_term_window + numb_blocks) | ||
{ | ||
get_long_term_weight_in_range( | ||
new_long_term_start_height..(new_long_term_start_height + numb_blocks), | ||
database.clone(), | ||
Chain::Main, | ||
) | ||
.await? | ||
} else { | ||
vec![] | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the old way to do this for the weight cache was completely wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
although it was only a problem for reorgs over the short term window
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No comments, no nits. good job
No description provided.