mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 13:31:04 +00:00
Removes the Default implementation for RewardDestination (#2402)
This PR removes current default for `RewardDestination`, which may cause confusion since a ledger should not have a default reward destination: either it has a reward destination, or something is wrong. It also changes the `Payee`'s reward destination in storage from `ValueQuery` to `OptionQuery`. In addition, it adds a `try_state` check to make sure each bonded ledger have a valid reward destination. Closes https://github.com/paritytech/polkadot-sdk/issues/2063 --------- Co-authored-by: command-bot <> Co-authored-by: Ross Bulat <ross@parity.io>
This commit is contained in:
@@ -339,7 +339,7 @@ pub mod pallet {
|
||||
/// TWOX-NOTE: SAFE since `AccountId` is a secure hash.
|
||||
#[pallet::storage]
|
||||
pub type Payee<T: Config> =
|
||||
StorageMap<_, Twox64Concat, T::AccountId, RewardDestination<T::AccountId>, ValueQuery>;
|
||||
StorageMap<_, Twox64Concat, T::AccountId, RewardDestination<T::AccountId>, OptionQuery>;
|
||||
|
||||
/// The map from (wannabe) validator stash key to the preferences of that validator.
|
||||
///
|
||||
@@ -1911,7 +1911,7 @@ pub mod pallet {
|
||||
ensure!(
|
||||
(Payee::<T>::get(&ledger.stash) == {
|
||||
#[allow(deprecated)]
|
||||
RewardDestination::Controller
|
||||
Some(RewardDestination::Controller)
|
||||
}),
|
||||
Error::<T>::NotController
|
||||
);
|
||||
@@ -1948,7 +1948,7 @@ pub mod pallet {
|
||||
// `Controller` variant, skip deprecating this account.
|
||||
let payee_deprecated = Payee::<T>::get(&ledger.stash) == {
|
||||
#[allow(deprecated)]
|
||||
RewardDestination::Controller
|
||||
Some(RewardDestination::Controller)
|
||||
};
|
||||
|
||||
if ledger.stash != *controller && !payee_deprecated {
|
||||
|
||||
Reference in New Issue
Block a user