final updates for state

This commit is contained in:
Ethan Buchman
2017-12-27 22:09:48 -05:00
parent bac60f2067
commit 0acca7fe69
17 changed files with 192 additions and 165 deletions

View File

@@ -36,7 +36,7 @@ func GetState(stateDB dbm.DB, genesisFile string) (State, error) {
if err != nil {
return state, err
}
SaveState(stateDB, state, state.AppHash)
SaveState(stateDB, state)
}
return state, nil
@@ -66,9 +66,7 @@ func loadState(db dbm.DB, key []byte) (state State) {
}
// SaveState persists the State, the ValidatorsInfo, and the ConsensusParamsInfo to the database.
// It sets the given appHash on the state before persisting.
func SaveState(db dbm.DB, s State, appHash []byte) {
s.AppHash = appHash
func SaveState(db dbm.DB, s State) {
nextHeight := s.LastBlockHeight + 1
saveValidatorsInfo(db, nextHeight, s.LastHeightValidatorsChanged, s.Validators)
saveConsensusParamsInfo(db, nextHeight, s.LastHeightConsensusParamsChanged, s.ConsensusParams)