This repository was archived by the owner on Mar 18, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +5
-10
lines changed
scorekeeper/jobs/specificJobs Expand file tree Collapse file tree 4 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -187,10 +187,10 @@ export const getValidatorActiveEras = async (
187187// return the number of eras
188188export const getIdentityValidatorActiveEras = async (
189189 address : string ,
190+ validatorSets : ValidatorSet [ ] ,
190191) : Promise < number > => {
191192 const identityAddresses = await getIdentityAddresses ( address ) ;
192193 let count = 0 ;
193- const validatorSets = await getAllValidatorSets ( ) ;
194194 for ( const era of validatorSets ) {
195195 if (
196196 era . validators . some ( ( validator ) => identityAddresses . includes ( validator ) )
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ export const eraStatsJob = async (
7676 updated : Date . now ( ) ,
7777 } ) ;
7878
79- for ( let i = currentEra ; i > 20 ; i -- ) {
79+ for ( let i = currentEra ; i > currentEra - 20 ; i -- ) {
8080 if ( await queries . validatorSetExistsForEra ( i ) ) {
8181 continue ;
8282 }
Original file line number Diff line number Diff line change 1- import { allCandidates , setRank } from "../db/queries" ;
1+ import { allCandidates , getAllValidatorSets , setRank } from "../db/queries" ;
22import { queries } from "../index" ;
33
44// Sets all validators ranks
55export const setValidatorRanks = async ( ) => {
66 const candidates = await allCandidates ( ) ;
7+ const validatorSets = await getAllValidatorSets ( ) ;
78 for ( const candidate of candidates ) {
89 const identityRank = await queries . getIdentityValidatorActiveEras (
910 candidate . stash ,
11+ validatorSets ,
1012 ) ;
1113 await setRank ( candidate . stash , identityRank ) ;
1214 }
Original file line number Diff line number Diff line change @@ -31,10 +31,3 @@ export const getValidatorsNumActiveEras = async (
3131 const eras = await queries . getValidatorActiveEras ( stash ) ;
3232 return eras ;
3333} ;
34-
35- export const getIdentityValidatorNumActiveEras = async (
36- stash : string ,
37- ) : Promise < any > => {
38- const eras = await queries . getIdentityValidatorActiveEras ( stash ) ;
39- return eras ;
40- } ;
You can’t perform that action at this time.
0 commit comments