Skip to content

Commit

Permalink
Merge pull request Agoric#22 from Agoric/21-must-marshal-json
Browse files Browse the repository at this point in the history
msgs.go: use MustMarshalJSON
  • Loading branch information
michaelfig authored Jun 15, 2019
2 parents e2fe21b + da82ca0 commit 2698360
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 3 additions & 0 deletions x/swingset/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
)

var ModuleCdc *codec.Codec

// RegisterCodec registers concrete types on the Amino codec
func RegisterCodec(cdc *codec.Codec) {
ModuleCdc = cdc
cdc.RegisterConcrete(MsgDeliverInbound{}, "swingset/DeliverInbound", nil)
}
8 changes: 1 addition & 7 deletions x/swingset/msgs.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package swingset

import (
"encoding/json"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand Down Expand Up @@ -65,11 +63,7 @@ func (msg MsgDeliverInbound) GetSignBytes() []byte {
if msg.Nums == nil {
msg.Nums = []int{}
}
b, err := json.Marshal(msg)
if err != nil {
panic(err)
}
return sdk.MustSortJSON(b)
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg))
}

// GetSigners defines whose signature is required
Expand Down

0 comments on commit 2698360

Please sign in to comment.