From 7a8eba10b2b007b191776e9c0d9e63d160ff3245 Mon Sep 17 00:00:00 2001 From: Jeff Biseda Date: Thu, 2 Sep 2021 13:52:14 -0700 Subject: [PATCH] add synchronization comment to handle_new_root (#19571) --- core/src/replay_stage.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/replay_stage.rs b/core/src/replay_stage.rs index 72b3a08eea..af2ea5cc39 100644 --- a/core/src/replay_stage.rs +++ b/core/src/replay_stage.rs @@ -2703,6 +2703,8 @@ impl ReplayStage { accounts_background_request_sender, 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 new_root_bank = &r_bank_forks[new_root]; if !*has_new_vote_been_rooted {