Skip to content

Commit

Permalink
Sort validators by index in chain info.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Mar 4, 2024
1 parent c548058 commit 697b6d4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions beacon/chaininfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"sort"
"strconv"
"strings"

Expand Down Expand Up @@ -270,6 +271,10 @@ func ObtainChainInfoFromNode(ctx context.Context,
State: validator.Status,
})
}
// Order validators by index.
sort.Slice(res.Validators, func(i int, j int) bool {
return res.Validators[i].Index < res.Validators[j].Index
})

// Genesis validators root obtained from beacon node.
genesisResponse, err := consensusClient.(consensusclient.GenesisProvider).Genesis(ctx, &api.GenesisOpts{})
Expand Down

0 comments on commit 697b6d4

Please sign in to comment.