mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
Society: Ensure all votes are removed after tally (#4666)
* Ensure all votes are removed after tally * Fix comment
This commit is contained in:
committed by
Gavin Wood
parent
5f80929dce
commit
bd0e72ffad
@@ -1324,6 +1324,9 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
}
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
// Clean up all votes.
|
||||
<Votes<T, I>>::remove_all();
|
||||
|
||||
// Reward one of the voters who voted the right way.
|
||||
if !total_slash.is_zero() {
|
||||
if let Some(winner) = pick_item(&mut rng, &rewardees) {
|
||||
@@ -1472,7 +1475,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
let mut rejection_count = 0;
|
||||
// Tallies total number of approve and reject votes for the defender.
|
||||
members.iter()
|
||||
.filter_map(|m| <DefenderVotes<T, I>>::get(m))
|
||||
.filter_map(|m| <DefenderVotes<T, I>>::take(m))
|
||||
.for_each(|v| {
|
||||
match v {
|
||||
Vote::Approve => approval_count += 1,
|
||||
@@ -1485,6 +1488,9 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
Self::suspend_member(&defender);
|
||||
*members = Self::members();
|
||||
}
|
||||
|
||||
// Clean up all votes.
|
||||
<DefenderVotes<T, I>>::remove_all();
|
||||
}
|
||||
|
||||
// Start a new defender rotation
|
||||
|
||||
Reference in New Issue
Block a user