Staking: Add dest to Rewarded to aid in reward calculations (#1602)

Addresses https://github.com/paritytech/polkadot-sdk/issues/129.

Returns `Self:payee()` from `make_payout` in a tuple alongside an
imbalance & adds it to `Rewarded` event.
This commit is contained in:
Ross Bulat
2023-09-18 18:32:30 +01:00
committed by GitHub
parent a181ced46b
commit ffe5db0f76
3 changed files with 31 additions and 10 deletions
+10
View File
@@ -3759,6 +3759,16 @@ fn test_payout_stakers() {
);
assert!(RewardOnUnbalanceWasCalled::get());
// `Rewarded` events are being executed.
assert!(matches!(
staking_events_since_last_call().as_slice(),
&[
..,
Event::Rewarded { stash: 1037, dest: RewardDestination::Controller, amount: 108 },
Event::Rewarded { stash: 1036, dest: RewardDestination::Controller, amount: 108 }
]
));
// Top 64 nominators of validator 11 automatically paid out, including the validator
// Validator payout goes to controller.
assert!(Balances::free_balance(&11) > balance);