other validations

This commit is contained in:
Federico Kunze 2020-05-11 19:10:14 -04:00
parent 32213ed56c
commit e3aad2306b
No known key found for this signature in database
GPG Key ID: 655F93A970080A30
2 changed files with 4 additions and 10 deletions

View File

@ -1,9 +1,6 @@
package types
import (
"errors"
"strings"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
@ -36,10 +33,7 @@ func (msg MsgClaimReward) ValidateBasic() error {
if msg.Sender.Empty() {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty")
}
if strings.TrimSpace(msg.Denom) == "" {
return errors.New("invalid (empty) denom")
}
return nil
return sdk.ValidateDenom(msg.Denom)
}
// GetSignBytes gets the canonical byte representation of the Msg.

View File

@ -2,7 +2,7 @@ package types
import (
"bytes"
"fmt"
"errors"
"time"
tmtime "github.com/tendermint/tendermint/types/time"
@ -39,8 +39,8 @@ func (data GenesisState) IsEmpty() bool {
// ValidateGenesis returns nil because accounts are validated by auth
func ValidateGenesis(data GenesisState) error {
if data.PreviousBlockTime.Unix() < 0 {
return fmt.Errorf("Previous block time should be positive, is set to %v", data.PreviousBlockTime.Unix())
if data.PreviousBlockTime.IsZero() {
return errors.New("previous block time cannot be zero")
}
return nil
}