Skip to content

Commit

Permalink
remove superfluous conditional (solana-labs#1449)
Browse files Browse the repository at this point in the history
  • Loading branch information
waitfreemaxi authored May 23, 2024
1 parent 097aa8e commit 1eaa5cf
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions core/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,18 +1174,16 @@ impl Tower {
fork_stake,
total_stake
);
if threshold_vote.confirmation_count() as usize > threshold_depth {
for old_vote in &vote_state_before_applying_vote.votes {
if old_vote.slot() == threshold_vote.slot()
&& old_vote.confirmation_count() == threshold_vote.confirmation_count()
{
// If you bounce back to voting on the main fork after not
// voting for a while, your latest vote N on the main fork
// might pop off a lot of the stake of votes in the tower.
// This stake would have rolled up to earlier votes in the
// tower, so skip the stake check.
return ThresholdDecision::PassedThreshold;
}
for old_vote in &vote_state_before_applying_vote.votes {
if old_vote.slot() == threshold_vote.slot()
&& old_vote.confirmation_count() == threshold_vote.confirmation_count()
{
// If you bounce back to voting on the main fork after not
// voting for a while, your latest vote N on the main fork
// might pop off a lot of the stake of votes in the tower.
// This stake would have rolled up to earlier votes in the
// tower, so skip the stake check.
return ThresholdDecision::PassedThreshold;
}
}
if lockout > threshold_size {
Expand Down

0 comments on commit 1eaa5cf

Please sign in to comment.