fix(store/commitment/iavl): honor tree.Remove error firstly (#18651)

This commit is contained in:
Emmanuel T Odeke 2023-12-08 05:59:12 -08:00 committed by GitHub
parent 112f6cbdae
commit 1e216af3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -33,6 +33,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#17158](https://github.com/cosmos/cosmos-sdk/pull/17158) Start the goroutine after need to create a snapshot.
### Bug fixes
* [#18651](https://github.com/cosmos/cosmos-sdk/pull/18651) Propagate iavl.MutableTree.Remove errors firstly to the caller instead of returning a synthesized error firstly.
## [v1.0.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv1.0.0-alpha.1) - 2023-07-11
@ -54,7 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes
* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propogate the Snapshotter's failure to the caller, (it will create a empty snapshot silently before).
* [#16588](https://github.com/cosmos/cosmos-sdk/pull/16588) Propagate the Snapshotter's failure to the caller, (it will create a empty snapshot silently before).
## [v0.1.0-alpha.1](https://github.com/cosmos/cosmos-sdk/releases/tag/store%2Fv0.1.0-alpha.1) - 2023-03-17

View File

@ -29,10 +29,13 @@ func NewIavlTree(db dbm.DB, logger log.Logger, cfg *Config) *IavlTree {
// Remove removes the given key from the tree.
func (t *IavlTree) Remove(key []byte) error {
_, res, err := t.tree.Remove(key)
if err != nil {
return err
}
if !res {
return fmt.Errorf("key %x not found", key)
}
return err
return nil
}
// Set sets the given key-value pair in the tree.