Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion frame/democracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,9 +1519,14 @@ impl<T: Config> Pallet<T> {
};
sp_std::mem::swap(&mut old, voting);
match old {
Voting::Delegating { balance, target, conviction, delegations, prior, .. } => {
Voting::Delegating {
balance, target, conviction, delegations, mut prior, ..
} => {
// remove any delegation votes to our current target.
Self::reduce_upstream_delegation(&target, conviction.votes(balance));
let now = frame_system::Pallet::<T>::block_number();
let lock_periods = conviction.lock_periods().into();
prior.accumulate(now + T::VoteLockingPeriod::get() * lock_periods, balance);
voting.set_common(delegations, prior);
},
Voting::Direct { votes, delegations, prior } => {
Expand Down
2 changes: 1 addition & 1 deletion frame/democracy/src/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ impl<Balance: Saturating + Ord + Zero + Copy, BlockNumber: Ord + Copy + Zero, Ac
match self {
Voting::Direct { votes, prior, .. } =>
votes.iter().map(|i| i.1.balance()).fold(prior.locked(), |a, i| a.max(i)),
Voting::Delegating { balance, .. } => *balance,
Voting::Delegating { balance, prior, .. } => *balance.max(&prior.locked()),
}
}

Expand Down