migrate all JSON to new JSON encoder (#4975)

Uses new JSON encoder in #4955 for all JSON. Branched off of #4968.
This commit is contained in:
Erik Grinaker
2020-06-08 14:22:59 +02:00
committed by GitHub
parent ba3a2dde37
commit db8f1b3df3
23 changed files with 89 additions and 79 deletions

View File

@@ -1,13 +0,0 @@
package commands
import (
amino "github.com/tendermint/go-amino"
cryptoamino "github.com/tendermint/tendermint/crypto/encoding/amino"
)
var cdc = amino.NewCodec()
func init() {
cryptoamino.RegisterAmino(cdc)
}

View File

@@ -5,6 +5,7 @@ import (
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/privval"
)
@@ -18,7 +19,7 @@ var GenValidatorCmd = &cobra.Command{
func genValidator(cmd *cobra.Command, args []string) {
pv := privval.GenFilePV("", "")
jsbz, err := cdc.MarshalJSON(pv)
jsbz, err := tmjson.Marshal(pv)
if err != nil {
panic(err)
}

View File

@@ -5,6 +5,7 @@ import (
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/p2p/upnp"
)
@@ -21,7 +22,7 @@ func probeUpnp(cmd *cobra.Command, args []string) error {
fmt.Println("Probe failed: ", err)
} else {
fmt.Println("Probe success!")
jsonBytes, err := cdc.MarshalJSON(capabilities)
jsonBytes, err := tmjson.Marshal(capabilities)
if err != nil {
return err
}

View File

@@ -5,6 +5,7 @@ import (
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
tmos "github.com/tendermint/tendermint/libs/os"
"github.com/tendermint/tendermint/privval"
)
@@ -29,7 +30,7 @@ func showValidator(cmd *cobra.Command, args []string) error {
return fmt.Errorf("can't get pubkey: %w", err)
}
bz, err := cdc.MarshalJSON(pubKey)
bz, err := tmjson.Marshal(pubKey)
if err != nil {
return fmt.Errorf("failed to marshal private validator pubkey: %w", err)
}