@@ -2980,9 +2980,18 @@ impl ReplayStage {
2980
2980
) ;
2981
2981
}
2982
2982
2983
- // Given a heaviest bank, `heaviest_bank` and the next votable bank
2984
- // `heaviest_bank_on_same_voted_fork` as the validator's last vote, return
2985
- // a bank to vote on, a bank to reset to,
2983
+ /// Given a `heaviest_bank` and a `heaviest_bank_on_same_voted_fork`, return
2984
+ /// a bank to vote on, a bank to reset to, and a list of switch failure
2985
+ /// reasons.
2986
+ ///
2987
+ /// If `heaviest_bank_on_same_voted_fork` is `None` due to that fork no
2988
+ /// longer being valid to vote on, it's possible that a validator will not
2989
+ /// be able to reset away from the invalid fork that they last voted on. To
2990
+ /// resolve this scenario, validators need to wait until they can create a
2991
+ /// switch proof for another fork or until the invalid fork is be marked
2992
+ /// valid again if it was confirmed by the cluster.
2993
+ /// Until this is resolved, leaders will build each of their
2994
+ /// blocks from the last reset bank on the invalid fork.
2986
2995
pub fn select_vote_and_reset_forks (
2987
2996
heaviest_bank : & Arc < Bank > ,
2988
2997
// Should only be None if there was no previous vote
@@ -5925,7 +5934,7 @@ pub(crate) mod tests {
5925
5934
& mut vote_simulator. latest_validator_votes_for_frozen_banks ,
5926
5935
) ;
5927
5936
assert ! ( vote_fork. is_none( ) ) ;
5928
- assert_eq ! ( reset_fork. unwrap ( ) , 3 ) ;
5937
+ assert_eq ! ( reset_fork, Some ( 3 ) ) ;
5929
5938
5930
5939
// Now mark 2, an ancestor of 4, as duplicate
5931
5940
blockstore. store_duplicate_slot ( 2 , vec ! [ ] , vec ! [ ] ) . unwrap ( ) ;
@@ -7026,7 +7035,6 @@ pub(crate) mod tests {
7026
7035
) ;
7027
7036
let ( heaviest_bank, heaviest_bank_on_same_fork) = heaviest_subtree_fork_choice
7028
7037
. select_forks ( & frozen_banks, tower, progress, ancestors, bank_forks) ;
7029
- assert ! ( heaviest_bank_on_same_fork. is_none( ) ) ;
7030
7038
let SelectVoteAndResetForkResult {
7031
7039
vote_bank,
7032
7040
reset_bank,
0 commit comments