Skip to content

Commit

Permalink
fix: display invalid validators correctly in bot (#16)
Browse files Browse the repository at this point in the history
* fix: display invalid validators correctly in bot

* chore: add comment
  • Loading branch information
freak12techno authored Sep 5, 2022
1 parent 3bb911d commit 60b7b99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,13 @@ func (r *TelegramReporter) getValidatorsStatus(message *tb.Message, getOnlyMissi
r.Logger.Error().
Err(err).
Msg("Could not get validator missed block group")
return !s.Jailed
return s.Active
}

return !s.Jailed && group.Start != 0
return s.Active && group.Start != 0
}

return !s.Jailed
return s.Active
})

stateArray := MapToSlice(state)
Expand Down
2 changes: 2 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type ValidatorState struct {
ConsensusAddress string
MissedBlocks int64
Jailed bool
Active bool
Tombstoned bool
}

Expand All @@ -48,6 +49,7 @@ func NewValidatorState(
ConsensusAddress: info.Address,
MissedBlocks: info.MissedBlocksCounter,
Jailed: validator.Jailed,
Active: validator.Status == 3, // BOND_STATUS_BONDED
Tombstoned: info.Tombstoned,
}
}
Expand Down

0 comments on commit 60b7b99

Please sign in to comment.