Skip to content

Commit

Permalink
fix total rewards computation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill-K-1 committed Nov 17, 2024
1 parent a27b24f commit c0f2f8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gov-portal-db/src/rewards_manager/rewards_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ impl RewardsCache {
let mut unclaimed_rewards = HashMap::<BatchId, HashMap<Address, Reward>>::default();

for entry in rewards {
match entry.status {
RewardStatus::Granted => (),
RewardStatus::Reverted => continue,
RewardStatus::Claimed => {
return Err(anyhow::anyhow!("Unexpected status for a batch {entry:?}").into());
}
if entry.status == RewardStatus::Claimed {
return Err(anyhow::anyhow!("Unexpected status for a batch {entry:?}").into());
}

// [`BatchId`] is a block number in which it was created
let block_number = entry.id.0;

for (wallet, reward) in entry.wallets {
match reward.status {
// If batch was reverted
RewardStatus::Granted if entry.status != RewardStatus::Granted => {
continue;
}
RewardStatus::Granted => {
unclaimed_rewards
.entry(entry.id)
Expand Down

0 comments on commit c0f2f8b

Please sign in to comment.