From 60b7b9955a9a7f181bf45ead7143ef84dfe4edf7 Mon Sep 17 00:00:00 2001 From: Techno Freak <83376337+freak12techno@users.noreply.github.com> Date: Tue, 6 Sep 2022 00:42:01 +0300 Subject: [PATCH] fix: display invalid validators correctly in bot (#16) * fix: display invalid validators correctly in bot * chore: add comment --- telegram.go | 6 +++--- types.go | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/telegram.go b/telegram.go index 1702c94..e4722a0 100644 --- a/telegram.go +++ b/telegram.go @@ -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) diff --git a/types.go b/types.go index fcd171e..3c3f4df 100644 --- a/types.go +++ b/types.go @@ -35,6 +35,7 @@ type ValidatorState struct { ConsensusAddress string MissedBlocks int64 Jailed bool + Active bool Tombstoned bool } @@ -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, } }