Migrate pieces of x/genutil missed in #6734 (#6860)

* Migrate pieces of x/genutil missed in 6734

* Fix tests

* Fix lint

* Add test
This commit is contained in:
Aaron Craelius
2020-07-27 15:41:20 +00:00
committed by GitHub
parent 359e9a031c
commit bb8aabd4e1
5 changed files with 19 additions and 30 deletions
+4
View File
@@ -60,6 +60,10 @@ func newBuilder(pubkeyCodec types.PublicKeyCodec) *builder {
}
func (t *builder) GetMsgs() []sdk.Msg {
if t.tx == nil || t.tx.Body == nil {
return nil
}
anys := t.tx.Body.Messages
res := make([]sdk.Msg, len(anys))
for i, any := range anys {
+5
View File
@@ -110,6 +110,11 @@ func TestTxBuilder(t *testing.T) {
require.Equal(t, len(msgs), len(tx.GetMsgs()))
require.Equal(t, 1, len(tx.GetPubKeys()))
require.Equal(t, pubkey.Bytes(), tx.GetPubKeys()[0].Bytes())
tx = &builder{}
require.NotPanics(t, func() {
_ = tx.GetMsgs()
})
}
func TestBuilderValidateBasic(t *testing.T) {