Skip to content

Commit

Permalink
booted-status to show booted for elected/signing validator, not boote…
Browse files Browse the repository at this point in the history
…d for never elected (#2884)
  • Loading branch information
gupadhyaya authored Apr 25, 2020
1 parent 044c2dc commit 9bbc3d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions hmy/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ func (b *APIBackend) GetValidatorInformation(

stats, err := bc.ReadValidatorStats(addr)
if err != nil {
// when validator has no stats, default boot-status to not booted
notBooted := effective.NotBooted.String()
defaultReply.BootedStatus = &notBooted
return defaultReply, nil
}

Expand Down
6 changes: 5 additions & 1 deletion staking/effective/eligible.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ func ValidatorStatus(currentlyInCommittee bool, status Eligibility) Candidacy {
type BootedStatus byte

const (
// Booted ..
Booted BootedStatus = iota
// NotBooted ..
NotBooted BootedStatus = iota
NotBooted
// LostEPoSAuction ..
LostEPoSAuction
// TurnedInactiveOrInsufficientUptime ..
Expand All @@ -90,6 +92,8 @@ const (

func (r BootedStatus) String() string {
switch r {
case Booted:
return "booted"
case LostEPoSAuction:
return "lost epos auction"
case TurnedInactiveOrInsufficientUptime:
Expand Down
2 changes: 1 addition & 1 deletion staking/types/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func NewEmptyStats() *ValidatorStats {
numeric.ZeroDec(),
numeric.ZeroDec(),
[]VoteWithCurrentEpochEarning{},
effective.NotBooted,
effective.Booted,
}
}

Expand Down

0 comments on commit 9bbc3d0

Please sign in to comment.