File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "crypto/sha256"
55 "encoding/json"
66 "errors"
7+ "reflect"
78
9+ "github.com/cosmos/gogoproto/proto"
810 gogoproto "github.com/cosmos/gogoproto/types"
911
1012 "cosmossdk.io/core/transaction"
@@ -69,7 +71,12 @@ func (t *Tx) Decode(b []byte) {
6971 if err != nil {
7072 panic (err )
7173 }
72- var msg transaction.Msg
74+ msgName , err := gogoproto .AnyMessageName (rawTx .Msg )
75+ msgType := proto .MessageType (msgName ).Elem ()
76+ if err != nil {
77+ panic (err )
78+ }
79+ msg := reflect .New (msgType ).Interface ().(proto.Message )
7380 if err := gogoproto .UnmarshalAny (rawTx .Msg , msg ); err != nil {
7481 panic (err )
7582 }
@@ -84,7 +91,12 @@ func (t *Tx) DecodeJSON(b []byte) {
8491 if err != nil {
8592 panic (err )
8693 }
87- var msg transaction.Msg
94+ msgName , err := gogoproto .AnyMessageName (rawTx .Msg )
95+ msgType := proto .MessageType (msgName ).Elem ()
96+ if err != nil {
97+ panic (err )
98+ }
99+ msg := reflect .New (msgType ).Interface ().(proto.Message )
88100 if err := gogoproto .UnmarshalAny (rawTx .Msg , msg ); err != nil {
89101 panic (err )
90102 }
You can’t perform that action at this time.
0 commit comments