Skip to content

Commit

Permalink
fix: return named error for write validators (backport cosmos#14919) (c…
Browse files Browse the repository at this point in the history
…osmos#14921)

Co-authored-by: mmsqe <mavis@crypto.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
  • Loading branch information
3 people authored and ankurdotb committed Feb 28, 2023
1 parent bfa9fa3 commit 04d3e67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

* (cli) [#14919](https://github.com/cosmos/cosmos-sdk/pull/#14919) Fix never assigned error when write validators.
* (store) [#14798](https://github.com/cosmos/cosmos-sdk/pull/14798) Copy btree to avoid the problem of modify while iteration.
* (cli) [#14799](https://github.com/cosmos/cosmos-sdk/pull/14799) Fix Evidence CLI query flag parsing (backport #13458)

Expand Down
4 changes: 3 additions & 1 deletion x/staking/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import (
)

// WriteValidators returns a slice of bonded genesis validators.
func WriteValidators(ctx sdk.Context, keeper keeper.Keeper) (vals []tmtypes.GenesisValidator, err error) {
func WriteValidators(ctx sdk.Context, keeper keeper.Keeper) (vals []tmtypes.GenesisValidator, returnErr error) {
keeper.IterateLastValidators(ctx, func(_ int64, validator types.ValidatorI) (stop bool) {
pk, err := validator.ConsPubKey()
if err != nil {
returnErr = err
return true
}
tmPk, err := cryptocodec.ToTmPubKeyInterface(pk)
if err != nil {
returnErr = err
return true
}

Expand Down

0 comments on commit 04d3e67

Please sign in to comment.