Skip to content

Commit

Permalink
Do not reward whitelisted validators for candidate inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpolaczyk committed Jan 3, 2025
1 parent f522ceb commit e4091eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion solo-chains/runtime/dancelight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,12 @@ pub struct RewardPoints;

impl pallet_authorship::EventHandler<AccountId, BlockNumberFor<Runtime>> for RewardPoints {
fn note_author(author: AccountId) {
ExternalValidatorsRewards::reward_by_ids(vec![(author, 20u32)])
let whitelisted_validators =
pallet_external_validators::WhitelistedValidatorsBackup::<Runtime>::get();
// Do not reward whitelisted validators
if !whitelisted_validators.contains(&author) {
ExternalValidatorsRewards::reward_by_ids(vec![(author, 20u32)])
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describeSuite({
.query.externalValidatorsRewards.rewardPointsForEra(0);
const totalRewards = validatorRewards.total.toBigInt();

// TODO: this test should fail because alice will not be rewarded, why doesn't it fail
const blockNumber = (await polkadotJs.rpc.chain.getHeader()).number.toBigInt();

// 20 points per block
Expand Down

0 comments on commit e4091eb

Please sign in to comment.