Skip to content

Commit

Permalink
Prevent panic in Keyper.ShortInfo
Browse files Browse the repository at this point in the history
When starting up, MainChain.ActiveConfigIndex panics.
  • Loading branch information
schmir committed May 18, 2021
1 parent cb2fdd4 commit eb7c693
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions shuttermint/keyper/keyper.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ func (kpr *Keyper) dkginfo() string {

func (kpr *Keyper) ShortInfo() string {
world := kpr.CurrentWorld()
configIndex := world.MainChain.ActiveConfigIndex(world.MainChain.CurrentBlock)
batchConfig := world.MainChain.BatchConfigs[configIndex]
var notAKeyper string
if !batchConfig.IsKeyper(kpr.Config.Address()) {
notAKeyper = fmt.Sprintf("not configured as keyper in config %d, ", configIndex)
if len(world.MainChain.BatchConfigs) > 0 {
configIndex := world.MainChain.ActiveConfigIndex(world.MainChain.CurrentBlock)
batchConfig := world.MainChain.BatchConfigs[configIndex]
if !batchConfig.IsKeyper(kpr.Config.Address()) {
notAKeyper = fmt.Sprintf("not configured as keyper in config %d, ", configIndex)
}
}
return fmt.Sprintf(
"%sshutter block %d, main chain %d, %s, last eon started %d, num half steps: %d%s",
Expand Down

0 comments on commit eb7c693

Please sign in to comment.