Skip to content

Commit

Permalink
msgs.go: use MustMarshalJSON
Browse files Browse the repository at this point in the history
fixes Agoric#21
  • Loading branch information
michaelfig committed Jun 13, 2019
1 parent 502ff53 commit da82ca0
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 da82ca0

Please sign in to comment.