fix : Use bytes instead of string comparison in delete validator queue (#12303)
This commit is contained in:
parent
bd31b7c584
commit
84a0e7186a
@ -71,6 +71,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (x/authz) [#12184](https://github.com/cosmos/cosmos-sdk/pull/12184) Fix MsgExec not verifying the validity of nested messages.
|
||||
* (x/crisis) [#12208](https://github.com/cosmos/cosmos-sdk/pull/12208) Fix progress index of crisis invariant assertion logs.
|
||||
* (types) [#12229](https://github.com/cosmos/cosmos-sdk/pull/12229) Increase sdk.Dec maxApproxRootIterations to 300
|
||||
* (x/staking) [#12303](https://github.com/cosmos/cosmos-sdk/pull/12303) Use bytes instead of string comparison in delete validator queue
|
||||
|
||||
## [v0.46.0-rc1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.46.0-rc1) - 2022-05-23
|
||||
|
||||
|
||||
@ -380,9 +380,21 @@ func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator) {
|
||||
addrs := k.GetUnbondingValidators(ctx, val.UnbondingTime, val.UnbondingHeight)
|
||||
newAddrs := []string{}
|
||||
|
||||
// since address string may change due to Bech32 prefix change, we parse the addresses into bytes
|
||||
// format for normalization
|
||||
deletingAddr, err := sdk.ValAddressFromBech32(val.OperatorAddress)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
if addr != val.OperatorAddress {
|
||||
newAddrs = append(newAddrs, addr)
|
||||
storedAddr, err := sdk.ValAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
// even if we don't panic here, it will panic in UnbondAllMatureValidators at unbond time
|
||||
panic(err)
|
||||
}
|
||||
if !storedAddr.Equals(deletingAddr) {
|
||||
newAddrs = append(newAddrs, storedAddr.String())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user