-
Notifications
You must be signed in to change notification settings - Fork 150
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: add Kusama chain check in historic blocks #1415
Conversation
@@ -104,17 +104,18 @@ export default class AccountsStakingPayoutsController extends AbstractController | |||
const earlyErasBlockInfo: IEarlyErasBlockInfo = kusamaEarlyErasBlockInfo; | |||
let hash = await this.getHashFromAt(at); | |||
let apiAt = await this.api.at(hash); | |||
const runtimeInfo = await this.api.rpc.state.getRuntimeVersion(hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's right a variable here that is:
const isKusama = runtimeInfo.specName.toString().toLowerCase() === 'kusama';
This should clean the rest up a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beat me to it
? historicApi.query.staking.validators(validatorId) | ||
: historicApi.query.staking.erasValidatorPrefs(era, validatorId); | ||
commissionPromise = | ||
ancient && specName.toLowerCase() === 'kusama' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do the isKusama
variable here as well if you'd like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nits and questions. But overall LGTM
Co-authored-by: Alberto Nicolas Penayo <74352651+bee344@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mighty fine to me
Description
Added a check to determine if we are connected in the Kusama chain, as the calculations are
Kusama
specific.Credits & Thanks