Filter out outdated slots (#22450)
* Filter out outdated slots * Fixup error
This commit is contained in:
@ -609,6 +609,9 @@ impl ClusterInfoVoteListener {
|
||||
|
||||
// The last vote slot, which is the greatest slot in the stack
|
||||
// of votes in a vote transaction, qualifies for optimistic confirmation.
|
||||
// We cannot count any other slots in this vote toward optimistic confirmation because:
|
||||
// 1) There may have been a switch between the earlier vote and the last vote
|
||||
// 2) We do not know the hash of the earlier slot
|
||||
if slot == last_vote_slot {
|
||||
let vote_accounts = epoch_stakes.stakes().vote_accounts();
|
||||
let stake = vote_accounts
|
||||
|
@ -366,7 +366,7 @@ impl Tower {
|
||||
last_voted_slot_in_bank: Option<Slot>,
|
||||
) -> Vote {
|
||||
let vote = Vote::new(vec![slot], hash);
|
||||
local_vote_state.process_vote_unchecked(&vote);
|
||||
local_vote_state.process_vote_unchecked(vote);
|
||||
let slots = if let Some(last_voted_slot) = last_voted_slot_in_bank {
|
||||
local_vote_state
|
||||
.votes
|
||||
@ -2276,7 +2276,7 @@ pub mod test {
|
||||
hash: Hash::default(),
|
||||
timestamp: None,
|
||||
};
|
||||
local.process_vote_unchecked(&vote);
|
||||
local.process_vote_unchecked(vote);
|
||||
assert_eq!(local.votes.len(), 1);
|
||||
let vote =
|
||||
Tower::apply_vote_and_generate_vote_diff(&mut local, 1, Hash::default(), Some(0));
|
||||
@ -2292,7 +2292,7 @@ pub mod test {
|
||||
hash: Hash::default(),
|
||||
timestamp: None,
|
||||
};
|
||||
local.process_vote_unchecked(&vote);
|
||||
local.process_vote_unchecked(vote);
|
||||
assert_eq!(local.votes.len(), 1);
|
||||
|
||||
// First vote expired, so should be evicted from tower. Thus even with
|
||||
|
Reference in New Issue
Block a user