Skip to content

Commit

Permalink
fix: get time after gRPC request
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Jan 9, 2024
1 parent 741db57 commit a6d23ae
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,32 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {

results := []Result{}

Check failure on line 271 in discord/discord.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
for i := 0; i < 2030; i++ {
val, err := b.cm.GetValidatorInfoByNumber(int32(i))
if err != nil {
continue

Check failure on line 272 in discord/discord.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default (gci)
info, err := b.cm.GetNetworkInfo()
if err != nil {
msg := "error getting network info"
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
}

for _, p := range info.ConnectedPeers {
r := Result{}
r.Agent = p.Agent
r.RemoteAddress = p.Address
r.IsActive = true
if p.Height < 673_000 {
r.IsActive = false
}
result := Result{
ValidatorAddress: val.Validator.Address,
PIP19Score: val.Validator.AvailabilityScore,
for _, v := range p.ConsensusKeys {
val, err := b.cm.GetValidatorInfo(v)
if err != nil {
continue
}
r.PIP19Score = val.Validator.AvailabilityScore
r.ValidatorAddress = v

results = append(results, r)
}

results = append(results, result)
total += 1
scoresSum += val.Validator.AvailabilityScore
}

data, err := json.Marshal(results)
Expand Down

0 comments on commit a6d23ae

Please sign in to comment.