Skip to content

Commit

Permalink
ff cleanup: vote_state_update_credit_per_deque
Browse files Browse the repository at this point in the history
  • Loading branch information
AshwinSekar committed Aug 24, 2023
1 parent a8be70f commit 6c6f98b
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions programs/vote/src/vote_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ pub fn process_new_vote_state(
new_root: Option<Slot>,
timestamp: Option<i64>,
epoch: Epoch,
feature_set: Option<&FeatureSet>,
_feature_set: Option<&FeatureSet>,
) -> Result<(), VoteError> {
assert!(!new_state.is_empty());
if new_state.len() > MAX_LOCKOUT_HISTORY {
Expand Down Expand Up @@ -683,18 +683,9 @@ pub fn process_new_vote_state(
// our state.
if vote_state.root_slot != new_root {
// Award vote credits based on the number of slots that were voted on and have reached finality
if feature_set
.map(|feature_set| {
feature_set.is_active(&feature_set::vote_state_update_credit_per_dequeue::id())
})
.unwrap_or(false)
{
// For each finalized slot, there was one voted-on slot in the new vote state that was responsible for
// finalizing it. Each of those votes is awarded 1 credit.
vote_state.increment_credits(epoch, finalized_slot_count);
} else {
vote_state.increment_credits(epoch, 1);
}
// For each finalized slot, there was one voted-on slot in the new vote state that was responsible for
// finalizing it. Each of those votes is awarded 1 credit.
vote_state.increment_credits(epoch, finalized_slot_count);
}
if let Some(timestamp) = timestamp {
let last_slot = new_state.back().unwrap().slot();
Expand Down Expand Up @@ -1670,8 +1661,7 @@ mod tests {
vec![227, 228, 229, 230, 231, 232, 233, 234, 235, 236],
];

let mut feature_set = FeatureSet::default();
feature_set.activate(&feature_set::vote_state_update_credit_per_dequeue::id(), 1);
let feature_set = FeatureSet::default();

for vote_group in test_vote_groups {
// Duplicate vote_state so that the new vote can be applied
Expand Down

0 comments on commit 6c6f98b

Please sign in to comment.