Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Mar 29, 2022
1 parent 0b93914 commit 1b36270
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions testutil/testdata/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
tx "github.com/cosmos/cosmos-sdk/types/tx"
)

func NewTestInterfaceRegistry() types.InterfaceRegistry {
Expand All @@ -31,6 +32,10 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
(*HasHasAnimalI)(nil),
&HasHasAnimal{},
)
registry.RegisterImplementations(
(*tx.TxExtensionOptionI)(nil),
&Cat{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}
Expand Down
4 changes: 2 additions & 2 deletions types/tx/ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// TxExtensionOptionI defines the interface for tx extension options
type TxExtensionOptionI interface{}

// UnpackExtensionOptionsI unpacks Any's to TxExtensionOptionI's.
func UnpackTxExtensionOptionsI(unpacker types.AnyUnpacker, anys []*types.Any) error {
// unpackTxExtensionOptionsI unpacks Any's to TxExtensionOptionI's.
func unpackTxExtensionOptionsI(unpacker types.AnyUnpacker, anys []*types.Any) error {
for _, any := range anys {
var opt TxExtensionOptionI
err := unpacker.UnpackAny(any, &opt)
Expand Down
4 changes: 2 additions & 2 deletions types/tx/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ func (m *TxBody) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error {
return err
}

if err := UnpackTxExtensionOptionsI(unpacker, m.ExtensionOptions); err != nil {
if err := unpackTxExtensionOptionsI(unpacker, m.ExtensionOptions); err != nil {
return err
}

if err := UnpackTxExtensionOptionsI(unpacker, m.NonCriticalExtensionOptions); err != nil {
if err := unpackTxExtensionOptionsI(unpacker, m.NonCriticalExtensionOptions); err != nil {
return err
}

Expand Down

0 comments on commit 1b36270

Please sign in to comment.