From 7ca65341e61e48361b0e99d6a34c871465e14aea Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Mon, 13 Jul 2020 14:45:38 -0600 Subject: [PATCH] Factor locked portion of Bank::update_recent_blockhashes() out to helper (cherry picked from commit 9cc379af6c7a99dbf5bb68c04fcd694159eb0b52) --- runtime/src/bank.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 2d034c0dd8..676013727e 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -829,10 +829,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, @@ -840,6 +839,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_values(