-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: update send packet api #3573
Conversation
…go into charly/timeout_util_function
// NewTimeout creates a new Timeout instance. | ||
func NewTimeout(height clienttypes.Height, timestamp uint64) Timeout { | ||
return Timeout{ | ||
Height: height, | ||
Timestamp: timestamp, | ||
} | ||
} | ||
|
||
// AfterHeight returns true if Timeout height is greater than the provided height. | ||
func (t Timeout) AfterHeight(height clienttypes.Height) bool { | ||
return t.Height.GT(height) | ||
} | ||
|
||
// AfterTimestamp returns true is Timeout timestamp is greater than the provided timestamp. | ||
func (t Timeout) AfterTimestamp(timestamp uint64) bool { | ||
return t.Timestamp > timestamp | ||
} | ||
|
||
// IsValid validates the Timeout. It ensures that either height or timestamp is set. | ||
func (t Timeout) IsValid() bool { | ||
return !t.ZeroHeight() || !t.ZeroTimestamp() | ||
} | ||
|
||
// ZeroHeight returns true if Timeout height is zero, otherwise false. | ||
func (t Timeout) ZeroHeight() bool { | ||
return t.Height.IsZero() | ||
} | ||
|
||
// ZeroTimestamp returns true if Timeout timestamp is zero, otherwise false. | ||
func (t Timeout) ZeroTimestamp() bool { | ||
return t.Timestamp == 0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to add a timeout.go
file maybe, as Timeout
will be used for both packets and upgrades
@@ -431,7 +431,8 @@ func (endpoint *Endpoint) SendPacket( | |||
channelCap := endpoint.Chain.GetChannelCapability(endpoint.ChannelConfig.PortID, endpoint.ChannelID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding here now so I don't forget about it: there's also SendPacket
in endpoint.go
which might need to be updated to match SendPacket
in packet.go
.
closing in favour of #3732 |
Description
this pr updates the SendPacket API to use the new Timeout struct
closes: #3551
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
).godoc
comments.Files changed
in the Github PR explorer.Codecov Report
in the comment section below once CI passes.