Skip to content

Commit 8e29637

Browse files
committed
fix: use correct epoch for pool refund rewards
Signed-off-by: William Hankins <[email protected]>
1 parent 06512fd commit 8e29637

File tree

1 file changed

+9
-3
lines changed
  • modules/historical_accounts_state/src

1 file changed

+9
-3
lines changed

modules/historical_accounts_state/src/state.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use acropolis_common::{
1010
queries::accounts::{
1111
AccountReward, AccountWithdrawal, DelegationUpdate, RegistrationStatus, RegistrationUpdate,
1212
},
13-
BlockInfo, InstantaneousRewardTarget, PoolId, ShelleyAddress, StakeAddress, TxCertificate,
14-
TxIdentifier,
13+
BlockInfo, InstantaneousRewardTarget, PoolId, RewardType, ShelleyAddress, StakeAddress,
14+
TxCertificate, TxIdentifier,
1515
};
1616
use tracing::warn;
1717

@@ -108,8 +108,14 @@ impl State {
108108
let volatile = self.volatile.window.back_mut().expect("window should never be empty");
109109
for reward in reward_deltas.deltas.iter() {
110110
let entry = volatile.entry(reward.stake_address.clone()).or_default();
111+
112+
let reward_epoch = match reward.reward_type {
113+
RewardType::PoolRefund => epoch,
114+
_ => epoch.saturating_sub(2),
115+
};
116+
111117
let update = AccountReward {
112-
epoch: epoch - 2,
118+
epoch: reward_epoch,
113119
amount: reward.delta,
114120
pool: reward.pool.clone(),
115121
reward_type: reward.reward_type.clone(),

0 commit comments

Comments
 (0)