Factor locked portion of Bank::update_recent_blockhashes() out to helper

This commit is contained in:
Trent Nelson 2020-07-13 14:45:38 -06:00 committed by mergify[bot]
parent 942c019d50
commit 9cc379af6c
1 changed files with 7 additions and 3 deletions

View File

@ -968,10 +968,9 @@ impl Bank {
total_validator_rewards
}
pub fn update_recent_blockhashes(&self) {
fn update_recent_blockhashes_locked(&self, locked_blockhash_queue: &BlockhashQueue) {
self.update_sysvar_account(&sysvar::recent_blockhashes::id(), |account| {
let blockhash_queue = self.blockhash_queue.read().unwrap();
let recent_blockhash_iter = blockhash_queue.get_recent_blockhashes();
let recent_blockhash_iter = locked_blockhash_queue.get_recent_blockhashes();
sysvar::recent_blockhashes::create_account_with_data(
self.inherit_sysvar_account_balance(account),
recent_blockhash_iter,
@ -979,6 +978,11 @@ impl Bank {
});
}
pub fn update_recent_blockhashes(&self) {
let blockhash_queue = self.blockhash_queue.read().unwrap();
self.update_recent_blockhashes_locked(&blockhash_queue);
}
// If the point values are not `normal`, bring them back into range and
// set them to the last value or 0.
fn check_point_value(&self, mut validator_point_value: f64) -> f64 {