deps: bump tm-db to 0.6.0 (#5058)

This commit is contained in:
Erik Grinaker
2020-06-29 16:07:37 +02:00
committed by GitHub
parent a0bd5e7ddd
commit 04b8cf7879
16 changed files with 195 additions and 100 deletions

View File

@@ -49,7 +49,10 @@ func saveState(state State) {
if err != nil {
panic(err)
}
state.db.Set(stateKey, stateBytes)
err = state.db.Set(stateKey, stateBytes)
if err != nil {
panic(err)
}
}
func prefixKey(key []byte) []byte {
@@ -92,7 +95,10 @@ func (app *Application) DeliverTx(req types.RequestDeliverTx) types.ResponseDeli
key, value = req.Tx, req.Tx
}
app.state.db.Set(prefixKey(key), value)
err := app.state.db.Set(prefixKey(key), value)
if err != nil {
panic(err)
}
app.state.Size++
events := []types.Event{

View File

@@ -189,6 +189,9 @@ func (app *PersistentKVStoreApplication) Validators() (validators []types.Valida
validators = append(validators, *validator)
}
}
if err = itr.Error(); err != nil {
panic(err)
}
return
}
@@ -259,7 +262,9 @@ func (app *PersistentKVStoreApplication) updateValidator(v types.ValidatorUpdate
Code: code.CodeTypeUnauthorized,
Log: fmt.Sprintf("Cannot remove non-existent validator %s", pubStr)}
}
app.app.state.db.Delete(key)
if err = app.app.state.db.Delete(key); err != nil {
panic(err)
}
delete(app.valAddrToPubKeyMap, string(pubkey.Address()))
} else {
// add or update validator
@@ -269,7 +274,9 @@ func (app *PersistentKVStoreApplication) updateValidator(v types.ValidatorUpdate
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Error encoding validator: %v", err)}
}
app.app.state.db.Set(key, value.Bytes())
if err = app.app.state.db.Set(key, value.Bytes()); err != nil {
panic(err)
}
app.valAddrToPubKeyMap[string(pubkey.Address())] = v.PubKey
}