@@ -175,7 +175,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
175
175
let base_reward_per_increment =
176
176
BaseRewardPerIncrement :: new ( total_active_balance, spec) ?;
177
177
178
- for effective_balance_eth in 1 ..=self . max_effective_balance_increment_steps ( ) ? {
178
+ for effective_balance_eth in
179
+ 1 ..=self . max_effective_balance_increment_steps ( previous_epoch) ?
180
+ {
179
181
let effective_balance =
180
182
effective_balance_eth. safe_mul ( spec. effective_balance_increment ) ?;
181
183
let base_reward =
@@ -321,11 +323,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
321
323
} )
322
324
}
323
325
324
- fn max_effective_balance_increment_steps ( & self ) -> Result < u64 , BeaconChainError > {
326
+ fn max_effective_balance_increment_steps (
327
+ & self ,
328
+ rewards_epoch : Epoch ,
329
+ ) -> Result < u64 , BeaconChainError > {
325
330
let spec = & self . spec ;
326
- let max_steps = spec
327
- . max_effective_balance
328
- . safe_div ( spec. effective_balance_increment ) ?;
331
+ let fork_name = spec. fork_name_at_epoch ( rewards_epoch ) ;
332
+ let max_effective_balance = spec . max_effective_balance_for_fork ( fork_name ) ;
333
+ let max_steps = max_effective_balance . safe_div ( spec. effective_balance_increment ) ?;
329
334
Ok ( max_steps)
330
335
}
331
336
@@ -386,7 +391,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
386
391
387
392
let mut ideal_attestation_rewards_list = Vec :: new ( ) ;
388
393
let sqrt_total_active_balance = SqrtTotalActiveBalance :: new ( total_balances. current_epoch ( ) ) ;
389
- for effective_balance_step in 1 ..=self . max_effective_balance_increment_steps ( ) ? {
394
+ for effective_balance_step in
395
+ 1 ..=self . max_effective_balance_increment_steps ( previous_epoch) ?
396
+ {
390
397
let effective_balance =
391
398
effective_balance_step. safe_mul ( spec. effective_balance_increment ) ?;
392
399
let base_reward =
0 commit comments