Skip to content

Commit

Permalink
Removing syncing tower from bank on old local tower
Browse files Browse the repository at this point in the history
  • Loading branch information
AshwinSekar committed Aug 18, 2023
1 parent 427b8b1 commit dcf80a7
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3016,7 +3016,6 @@ impl ReplayStage {
.computed;
if !is_computed {
// Check if our tower is behind, if so (and the feature migration flag is in use)
// overwrite with the newer bank.
if let (true, Some(vote_account)) = (
Tower::is_direct_vote_state_update_enabled(bank),
bank.get_vote_account(my_vote_pubkey),
Expand All @@ -3028,7 +3027,9 @@ impl ReplayStage {
info!(
"Frozen bank vote state slot {:?}
is newer than our local vote state slot {:?},
adopting the bank vote state as our own.
If this is your primary voting validator this indicates
that your local state is missing later votes observed by the chain.
This could be due to a recent restart.
Bank votes: {:?}, root: {:?},
Local votes: {:?}, root: {:?}",
bank_vote_state.last_voted_slot(),
Expand All @@ -3038,42 +3039,6 @@ impl ReplayStage {
tower.vote_state.votes,
tower.vote_state.root_slot
);

if let Some(local_root) = tower.vote_state.root_slot {
if bank_vote_state
.root_slot
.map(|bank_root| local_root > bank_root)
.unwrap_or(true)
{
// If the local root is larger than this on chain vote state
// root (possible due to supermajority roots being set on
// startup), then we need to adjust the tower
bank_vote_state.root_slot = Some(local_root);
bank_vote_state
.votes
.retain(|lockout| lockout.slot() > local_root);
info!(
"Local root is larger than on chain root,
overwrote bank root {:?} and updated votes {:?}",
bank_vote_state.root_slot, bank_vote_state.votes
);

if let Some(first_vote) = bank_vote_state.votes.front() {
assert!(ancestors
.get(&first_vote.slot())
.expect(
"Ancestors map must contain an
entry for all slots on this fork
greater than `local_root` and less
than `bank_slot`"
)
.contains(&local_root));
}
}
}

tower.vote_state.root_slot = bank_vote_state.root_slot;
tower.vote_state.votes = bank_vote_state.votes;
}
}
}
Expand Down

0 comments on commit dcf80a7

Please sign in to comment.