add synchronization comment to handle_new_root (#19571)

This commit is contained in:
Jeff Biseda 2021-09-02 13:52:14 -07:00 committed by GitHub
parent 8ac94b2cf4
commit 7a8eba10b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -2703,6 +2703,8 @@ impl ReplayStage {
accounts_background_request_sender, accounts_background_request_sender,
highest_confirmed_root, highest_confirmed_root,
); );
// Dropping the bank_forks write lock and reacquiring as a read lock is
// safe because updates to bank_forks are only made by a single thread.
let r_bank_forks = bank_forks.read().unwrap(); let r_bank_forks = bank_forks.read().unwrap();
let new_root_bank = &r_bank_forks[new_root]; let new_root_bank = &r_bank_forks[new_root];
if !*has_new_vote_been_rooted { if !*has_new_vote_been_rooted {