mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
Merge pull request #1902 from tendermint/1766-wrong-field-access
fix wrong field access in LoadConsensusParams
This commit is contained in:
commit
99e982669e
@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
cmn "github.com/tendermint/tendermint/libs/common"
|
||||
dbm "github.com/tendermint/tendermint/libs/db"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
@ -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 {
|
||||
cmn.PanicSanity(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
|
||||
}
|
||||
@ -239,11 +244,17 @@ func LoadConsensusParams(db dbm.DB, height int64) (types.ConsensusParams, error)
|
||||
}
|
||||
|
||||
if paramsInfo.ConsensusParams == empty {
|
||||
paramsInfo = loadConsensusParamsInfo(db, paramsInfo.LastHeightChanged)
|
||||
if paramsInfo == nil {
|
||||
cmn.PanicSanity(fmt.Sprintf(`Couldn't find consensus params at height %d as
|
||||
last changed from height %d`, paramsInfo.LastHeightChanged, height))
|
||||
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,
|
||||
),
|
||||
)
|
||||
}
|
||||
paramsInfo = paramsInfo2
|
||||
}
|
||||
|
||||
return paramsInfo.ConsensusParams, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user