Skip to content
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

testing: add function field to override SendMsgs #3767

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions testing/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ type TestChain struct {
SenderAccount authtypes.AccountI

SenderAccounts []SenderAccount

// Short-term solution to override the logic of the standard SendMsgs function.
// See issue https://github.com/cosmos/ibc-go/issues/3123 for more information.
SendMsgsOverride func(msgs ...sdk.Msg) (*sdk.Result, error)
}

// NewTestChainWithValSet initializes a new TestChain instance with the given validator set
Expand Down Expand Up @@ -314,6 +318,10 @@ func (chain *TestChain) sendMsgs(msgs ...sdk.Msg) error {
// number and updates the TestChain's headers. It returns the result and error if one
// occurred.
func (chain *TestChain) SendMsgs(msgs ...sdk.Msg) (*sdk.Result, error) {
if chain.SendMsgsOverride != nil {
return chain.SendMsgsOverride(msgs...)
}

// ensure the chain has the latest time
chain.Coordinator.UpdateTimeForChain(chain)

Expand Down