dep: update tm-db to 0.4.0 (#4289)

* dep: update tm-db to 0.4.0

- update 0.4.0 as it is a breaking change and cannot be handled by depndabot

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

*  more work towards error handling

* error and emtpy bytes handling

* work on tests

* add changelog entry, change some error handling

* address some pr comments

* panic in a few more places

* move error higher up

* redo some error handling

* fix some bz == nil to len(bz) == 0

* change statebytes
This commit is contained in:
Marko
2020-01-13 18:45:16 +01:00
committed by GitHub
parent faf783331d
commit 6b71b928be
14 changed files with 190 additions and 123 deletions

View File

@@ -1158,12 +1158,15 @@ func LoadStateFromDBOrGenesisDocProvider(
// panics if failed to unmarshal bytes
func loadGenesisDoc(db dbm.DB) (*types.GenesisDoc, error) {
b := db.Get(genesisDocKey)
b, err := db.Get(genesisDocKey)
if err != nil {
panic(err)
}
if len(b) == 0 {
return nil, errors.New("genesis doc not found")
}
var genDoc *types.GenesisDoc
err := cdc.UnmarshalJSON(b, &genDoc)
err = cdc.UnmarshalJSON(b, &genDoc)
if err != nil {
panic(fmt.Sprintf("Failed to load genesis doc due to unmarshaling error: %v (bytes: %X)", err, b))
}