@@ -39,13 +39,13 @@ func (p Plan) ValidateBasic() error {
39
39
if p .Height < 0 {
40
40
return sdkerrors .Wrap (sdkerrors .ErrInvalidRequest , "height cannot be negative" )
41
41
}
42
- if p .Time .IsZero () && p .Height == 0 {
42
+ if p .Time .Unix () <= 0 && p .Height == 0 {
43
43
return sdkerrors .Wrap (sdkerrors .ErrInvalidRequest , "must set either time or height" )
44
44
}
45
- if ! p .Time .IsZero () && p .Height != 0 {
45
+ if p .Time .Unix () > 0 && p .Height != 0 {
46
46
return sdkerrors .Wrap (sdkerrors .ErrInvalidRequest , "cannot set both time and height" )
47
47
}
48
- if ! p .Time .IsZero () && p .UpgradedClientState != nil {
48
+ if p .Time .Unix () > 0 && p .UpgradedClientState != nil {
49
49
return sdkerrors .Wrap (sdkerrors .ErrInvalidRequest , "IBC chain upgrades must only set height" )
50
50
}
51
51
@@ -54,7 +54,7 @@ func (p Plan) ValidateBasic() error {
54
54
55
55
// ShouldExecute returns true if the Plan is ready to execute given the current context
56
56
func (p Plan ) ShouldExecute (ctx sdk.Context ) bool {
57
- if ! p .Time .IsZero () {
57
+ if p .Time .Unix () > 0 {
58
58
return ! ctx .BlockTime ().Before (p .Time )
59
59
}
60
60
if p .Height > 0 {
@@ -65,7 +65,7 @@ func (p Plan) ShouldExecute(ctx sdk.Context) bool {
65
65
66
66
// DueAt is a string representation of when this plan is due to be executed
67
67
func (p Plan ) DueAt () string {
68
- if ! p .Time .IsZero () {
68
+ if p .Time .Unix () > 0 {
69
69
return fmt .Sprintf ("time: %s" , p .Time .UTC ().Format (time .RFC3339 ))
70
70
}
71
71
return fmt .Sprintf ("height: %d" , p .Height )
0 commit comments