state: Format panics

This commit is contained in:
Alexander Simmerl 2018-07-04 14:59:50 +02:00
parent e565e348d5
commit 48a1f6f9b3
No known key found for this signature in database
GPG Key ID: 4694E95C9CC61BDA
1 changed files with 14 additions and 4 deletions

View File

@ -175,8 +175,13 @@ func LoadValidators(db dbm.DB, height int64) (*types.ValidatorSet, error) {
if valInfo.ValidatorSet == nil {
valInfo2 := loadValidatorsInfo(db, valInfo.LastHeightChanged)
if valInfo2 == nil {
panic(fmt.Sprintf(`Couldn't find validators at height %d as
last changed from height %d`, valInfo.LastHeightChanged, height))
panic(
fmt.Sprintf(
"Couldn't find validators at height %d as last changed from height %d",
valInfo.LastHeightChanged,
height,
),
)
}
valInfo = valInfo2
}
@ -241,8 +246,13 @@ func LoadConsensusParams(db dbm.DB, height int64) (types.ConsensusParams, error)
if paramsInfo.ConsensusParams == empty {
paramsInfo2 := loadConsensusParamsInfo(db, paramsInfo.LastHeightChanged)
if paramsInfo2 == nil {
panic(fmt.Sprintf(`Couldn't find consensus params at height %d as
last changed from height %d`, paramsInfo.LastHeightChanged, height))
panic(
fmt.Sprintf(
"Couldn't find consensus params at height %d as last changed from height %d",
paramsInfo.LastHeightChanged,
height,
),
)
}
paramsInfo = paramsInfo2
}