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

@@ -25,6 +25,7 @@ import (
cs "github.com/tendermint/tendermint/consensus"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/evidence"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmpubsub "github.com/tendermint/tendermint/libs/pubsub"
"github.com/tendermint/tendermint/libs/service"
@@ -1293,7 +1294,7 @@ func loadGenesisDoc(db dbm.DB) (*types.GenesisDoc, error) {
return nil, errors.New("genesis doc not found")
}
var genDoc *types.GenesisDoc
err = cdc.UnmarshalJSON(b, &genDoc)
err = tmjson.Unmarshal(b, &genDoc)
if err != nil {
panic(fmt.Sprintf("Failed to load genesis doc due to unmarshaling error: %v (bytes: %X)", err, b))
}
@@ -1302,7 +1303,7 @@ func loadGenesisDoc(db dbm.DB) (*types.GenesisDoc, error) {
// panics if failed to marshal the given genesis document
func saveGenesisDoc(db dbm.DB, genDoc *types.GenesisDoc) {
b, err := cdc.MarshalJSON(genDoc)
b, err := tmjson.Marshal(genDoc)
if err != nil {
panic(fmt.Sprintf("Failed to save genesis doc due to marshaling error: %v", err))
}