mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
other validations
This commit is contained in:
parent
32213ed56c
commit
e3aad2306b
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user