We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f278c76 commit b39e64fCopy full SHA for b39e64f
rewards/src/lib.rs
@@ -85,12 +85,14 @@ decl_module! {
85
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
86
87
fn on_initialize(now: T::BlockNumber) -> Weight {
88
+ let mut count = 0;
89
T::Handler::accumulate_reward(now, | pool, reward_to_accumulate | {
90
if !reward_to_accumulate.is_zero() {
91
+ count += 1;
92
Pools::<T>::mutate(pool, | pool_info | pool_info.total_rewards = pool_info.total_rewards.saturating_add(reward_to_accumulate));
93
}
94
});
- T::WeightInfo::on_initialize(Pools::<T>::iter().count() as u32)
95
+ T::WeightInfo::on_initialize(count)
96
97
98
0 commit comments