On the SNS the votes have to be saved until rewards are distributed because they are the system of record. This code only runs, as far as I can tell, when the round time configured the SNS passes.
/// Returns `true` if enough time has passed since the end of the last reward round.
///
/// The end of the last reward round is recorded in self.latest_reward_event.
///
/// The (current) length of a reward round is specified in
/// self.nervous_system_parameters.voting_reward_parameters
fn should_distribute_rewards(&self) -> bool {
let now = self.env.now();
let voting_rewards_parameters = match &self
.nervous_system_parameters_or_panic()
.voting_rewards_parameters
{
None => return false,
Some(ok) => ok,
};
let seconds_since_last_reward_event = now.saturating_sub(
self.latest_reward_event()
.end_timestamp_seconds
.unwrap_or_default(),
);
let round_duration_seconds = match voting_rewards_parameters.round_duration_seconds {
Some(s) => s,
None => {
log!(
ERROR,
"round_duration_seconds unset:\n{:#?}",
voting_rewards_parameters,
);
return false;
}
};
seconds_since_last_reward_event > round_duration_seconds
}
The ballots are only cleared…as far as I can tell in the distribut_rewards function: