Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: staking-payouts for legacy kusama node #1394

Merged
merged 5 commits into from
Feb 7, 2024
Merged

fix: staking-payouts for legacy kusama node #1394

merged 5 commits into from
Feb 7, 2024

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Feb 7, 2024

This resolves an error where legacy blocks on Kusama would throw an error:

{
	"code": 500,
	"message": "Cannot read properties of undefined (reading 'indexOf')",
	"stack": "TypeError: Cannot read properties of undefined (reading 'indexOf')\n    at AccountsStakingPayoutsService.deriveEraPayouts (/Users/tarikgul/Desktop/parity/tools-team/substrate-api-sidecar/src/services/accounts/AccountsStakingPayoutsService.ts:293:79)\n    at /Users/tarikgul/Desktop/parity/tools-team/substrate-api-sidecar/src/services/accounts/AccountsStakingPayoutsService.ts:170:50\n    at Array.map (<anonymous>)\n    at AccountsStakingPayoutsService.fetchAccountStakingPayout (/Users/tarikgul/Desktop/parity/tools-team/substrate-api-sidecar/src/services/accounts/AccountsStakingPayoutsService.ts:170:28)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at AccountsStakingPayoutsController.getStakingPayoutsByAccountId (/Users/tarikgul/Desktop/parity/tools-team/substrate-api-sidecar/src/controllers/accounts/AccountsStakingPayoutsController.ts:110:4)\n    at /Users/tarikgul/Desktop/parity/tools-team/substrate-api-sidecar/src/controllers/AbstractController.ts:116:5",
	"level": "error"
}

This fix checks to make sure validatorLedger.claimedRewards exists if not we continue with the rest of the logic.

We tested with: /accounts/FXCgfz7AzQA1fNaUqubSgXxGh77sjWVVkypgueWLmAcwv79/staking-payouts?unclaimedOnly=false&at=1567404&depth=21 and we got accurate results back.

@TarikGul TarikGul requested a review from a team as a code owner February 7, 2024 14:42
@TarikGul TarikGul merged commit e91a913 into master Feb 7, 2024
15 checks passed
@TarikGul TarikGul deleted the tarik-fix-pay branch February 7, 2024 17:26
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants