Skip to content

Commit

Permalink
fix: changed how claimed variable is set in staking-payouts (#1378)
Browse files Browse the repository at this point in the history
  • Loading branch information
Imod7 committed Jan 10, 2024
1 parent b2aab7d commit 0560806
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/services/accounts/AccountsStakingPayoutsService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
// Copyright 2017-2024 Parity Technologies (UK) Ltd.
// This file is part of Substrate API Sidecar.
//
// Substrate API Sidecar is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -272,12 +272,13 @@ export class AccountsStakingPayoutsService extends AbstractService {
continue;
}
// Check if the reward has already been claimed
let claimed: boolean;
let indexOfEra: number;
if (validatorLedger.legacyClaimedRewards) {
claimed = validatorLedger.legacyClaimedRewards.includes(eraIndex);
indexOfEra = validatorLedger.legacyClaimedRewards.indexOf(eraIndex);
} else {
claimed = (validatorLedger as unknown as StakingLedger).claimedRewards.includes(eraIndex);
indexOfEra = (validatorLedger as unknown as StakingLedger).claimedRewards.indexOf(eraIndex);
}
const claimed: boolean = Number.isInteger(indexOfEra) && indexOfEra !== -1;
if (unclaimedOnly && claimed) {
continue;
}
Expand Down

0 comments on commit 0560806

Please sign in to comment.