mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 19:53:58 +00:00
state: don't save genesis state in database when loaded (#5231)
Fixes #5138. I don't have a strong opinion on this, but find it sort of odd that `Load` functions actually save as well.
This commit is contained in:
@@ -37,8 +37,7 @@ func calcABCIResponsesKey(height int64) []byte {
|
||||
}
|
||||
|
||||
// LoadStateFromDBOrGenesisFile loads the most recent state from the database,
|
||||
// or creates a new one from the given genesisFilePath and persists the result
|
||||
// to the database.
|
||||
// or creates a new one from the given genesisFilePath.
|
||||
func LoadStateFromDBOrGenesisFile(stateDB dbm.DB, genesisFilePath string) (State, error) {
|
||||
state := LoadState(stateDB)
|
||||
if state.IsEmpty() {
|
||||
@@ -47,15 +46,13 @@ func LoadStateFromDBOrGenesisFile(stateDB dbm.DB, genesisFilePath string) (State
|
||||
if err != nil {
|
||||
return state, err
|
||||
}
|
||||
SaveState(stateDB, state)
|
||||
}
|
||||
|
||||
return state, nil
|
||||
}
|
||||
|
||||
// LoadStateFromDBOrGenesisDoc loads the most recent state from the database,
|
||||
// or creates a new one from the given genesisDoc and persists the result
|
||||
// to the database.
|
||||
// or creates a new one from the given genesisDoc.
|
||||
func LoadStateFromDBOrGenesisDoc(stateDB dbm.DB, genesisDoc *types.GenesisDoc) (State, error) {
|
||||
state := LoadState(stateDB)
|
||||
|
||||
@@ -65,7 +62,6 @@ func LoadStateFromDBOrGenesisDoc(stateDB dbm.DB, genesisDoc *types.GenesisDoc) (
|
||||
if err != nil {
|
||||
return state, err
|
||||
}
|
||||
SaveState(stateDB, state)
|
||||
}
|
||||
|
||||
return state, nil
|
||||
|
||||
Reference in New Issue
Block a user