mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Vote locks for all reasons except RESERVE (#13914)
* Vote locks tip * except reserve * reason for delegate * fix tests --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -639,7 +639,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
},
|
||||
}
|
||||
});
|
||||
T::Currency::extend_lock(CONVICTION_VOTING_ID, who, amount, WithdrawReasons::TRANSFER);
|
||||
T::Currency::extend_lock(
|
||||
CONVICTION_VOTING_ID,
|
||||
who,
|
||||
amount,
|
||||
WithdrawReasons::except(WithdrawReasons::RESERVE),
|
||||
);
|
||||
}
|
||||
|
||||
/// Rejig the lock on an account. It will never get more stringent (since that would indicate
|
||||
@@ -669,7 +674,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
CONVICTION_VOTING_ID,
|
||||
who,
|
||||
lock_needed,
|
||||
WithdrawReasons::TRANSFER,
|
||||
WithdrawReasons::except(WithdrawReasons::RESERVE),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1308,7 +1308,12 @@ impl<T: Config> Pallet<T> {
|
||||
})?;
|
||||
// Extend the lock to `balance` (rather than setting it) since we don't know what other
|
||||
// votes are in place.
|
||||
T::Currency::extend_lock(DEMOCRACY_ID, who, vote.balance(), WithdrawReasons::TRANSFER);
|
||||
T::Currency::extend_lock(
|
||||
DEMOCRACY_ID,
|
||||
who,
|
||||
vote.balance(),
|
||||
WithdrawReasons::except(WithdrawReasons::RESERVE),
|
||||
);
|
||||
ReferendumInfoOf::<T>::insert(ref_index, ReferendumInfo::Ongoing(status));
|
||||
Ok(())
|
||||
}
|
||||
@@ -1454,7 +1459,12 @@ impl<T: Config> Pallet<T> {
|
||||
let votes = Self::increase_upstream_delegation(&target, conviction.votes(balance));
|
||||
// Extend the lock to `balance` (rather than setting it) since we don't know what other
|
||||
// votes are in place.
|
||||
T::Currency::extend_lock(DEMOCRACY_ID, &who, balance, WithdrawReasons::TRANSFER);
|
||||
T::Currency::extend_lock(
|
||||
DEMOCRACY_ID,
|
||||
&who,
|
||||
balance,
|
||||
WithdrawReasons::except(WithdrawReasons::RESERVE),
|
||||
);
|
||||
Ok(votes)
|
||||
})?;
|
||||
Self::deposit_event(Event::<T>::Delegated { who, target });
|
||||
@@ -1499,7 +1509,12 @@ impl<T: Config> Pallet<T> {
|
||||
if lock_needed.is_zero() {
|
||||
T::Currency::remove_lock(DEMOCRACY_ID, who);
|
||||
} else {
|
||||
T::Currency::set_lock(DEMOCRACY_ID, who, lock_needed, WithdrawReasons::TRANSFER);
|
||||
T::Currency::set_lock(
|
||||
DEMOCRACY_ID,
|
||||
who,
|
||||
lock_needed,
|
||||
WithdrawReasons::except(WithdrawReasons::RESERVE),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ fn nay(x: u8, balance: u64) -> AccountVote<u64> {
|
||||
}
|
||||
|
||||
fn the_lock(amount: u64) -> BalanceLock<u64> {
|
||||
BalanceLock { id: DEMOCRACY_ID, amount, reasons: pallet_balances::Reasons::Misc }
|
||||
BalanceLock { id: DEMOCRACY_ID, amount, reasons: pallet_balances::Reasons::All }
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user