diff --git a/x/bank/types/balance.go b/x/bank/types/balance.go index 2aa7967d50..78539ace6c 100644 --- a/x/bank/types/balance.go +++ b/x/bank/types/balance.go @@ -30,38 +30,12 @@ func (b Balance) GetCoins() sdk.Coins { // Validate checks for address and coins correctness. func (b Balance) Validate() error { - _, err := sdk.AccAddressFromBech32(b.Address) - if err != nil { + if _, err := sdk.AccAddressFromBech32(b.Address); err != nil { return err } - var prevDenom string - if !b.Coins.Empty() { - prevDenom = b.Coins[0].Denom - } - seenDenoms := make(map[string]bool) - - // NOTE: we perform a custom validation since the coins.Validate function - // errors on zero balance coins - for _, coin := range b.Coins { - if seenDenoms[coin.Denom] { - return fmt.Errorf("duplicate denomination %s", coin.Denom) - } - - if err := sdk.ValidateDenom(coin.Denom); err != nil { - return err - } - - if coin.Denom < prevDenom { - return fmt.Errorf("denomination %s is not sorted", coin.Denom) - } - - if coin.IsNegative() { - return fmt.Errorf("coin %s amount is cannot be negative", coin.Denom) - } - - seenDenoms[coin.Denom] = true - prevDenom = coin.Denom + if err := b.Coins.Validate(); err != nil { + return err } return nil