mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-14 15:35:45 +00:00
Deprecate RewardDestination::Controller (#2380)
Deprecates `RewardDestination::Controller` variant. - [x] `RewardDestination::Controller` annotated with `#[deprecated]`. - [x] `Controller` variant is now handled the same way as `Stash` in `payout_stakers`. - [x] `set_payee` errors if `RewardDestination::Controller` is provided. - [x] Added `update_payee` call to lazily migrate `RewardDestination::Controller` `Payee` storage entries to `RewardDestination::Account(controller)` . - [x] `payout_stakers_dead_controller` has been removed from benches & weights - was not used. - [x] Tests no longer use `RewardDestination::Controller`. --------- Co-authored-by: command-bot <> Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by: georgepisaltu <52418509+georgepisaltu@users.noreply.github.com>
This commit is contained in:
@@ -338,9 +338,8 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
let dest = Self::payee(StakingAccount::Stash(stash.clone()));
|
||||
let maybe_imbalance = match dest {
|
||||
RewardDestination::Controller => Self::bonded(stash)
|
||||
.map(|controller| T::Currency::deposit_creating(&controller, amount)),
|
||||
RewardDestination::Stash => T::Currency::deposit_into_existing(stash, amount).ok(),
|
||||
RewardDestination::Stash =>
|
||||
T::Currency::deposit_into_existing(stash, amount).ok(),
|
||||
RewardDestination::Staked => Self::ledger(Stash(stash.clone()))
|
||||
.and_then(|mut ledger| {
|
||||
ledger.active += amount;
|
||||
@@ -357,6 +356,14 @@ impl<T: Config> Pallet<T> {
|
||||
RewardDestination::Account(dest_account) =>
|
||||
Some(T::Currency::deposit_creating(&dest_account, amount)),
|
||||
RewardDestination::None => None,
|
||||
#[allow(deprecated)]
|
||||
RewardDestination::Controller => Self::bonded(stash)
|
||||
.map(|controller| {
|
||||
defensive!("Paying out controller as reward destination which is deprecated and should be migrated");
|
||||
// This should never happen once payees with a `Controller` variant have been migrated.
|
||||
// But if it does, just pay the controller account.
|
||||
T::Currency::deposit_creating(&controller, amount)
|
||||
}),
|
||||
};
|
||||
maybe_imbalance
|
||||
.map(|imbalance| (imbalance, Self::payee(StakingAccount::Stash(stash.clone()))))
|
||||
|
||||
Reference in New Issue
Block a user