mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-15 06:11:20 +00:00
Pretty print JSON
This commit is contained in:
@ -3,14 +3,14 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/types"
|
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func gen_validator() {
|
func gen_validator() {
|
||||||
|
|
||||||
privValidator := types.GenPrivValidator()
|
privValidator := types.GenPrivValidator()
|
||||||
privValidatorJSONBytes := wire.JSONBytes(privValidator)
|
privValidatorJSONBytes := wire.JSONBytesPretty(privValidator)
|
||||||
fmt.Printf(`Generated a new validator!
|
fmt.Printf(`Generated a new validator!
|
||||||
Paste the following JSON into your %v file
|
Paste the following JSON into your %v file
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/tendermint/tendermint/types"
|
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func show_validator() {
|
func show_validator() {
|
||||||
privValidatorFile := config.GetString("priv_validator_file")
|
privValidatorFile := config.GetString("priv_validator_file")
|
||||||
privValidator := types.LoadOrGenPrivValidator(privValidatorFile)
|
privValidator := types.LoadOrGenPrivValidator(privValidatorFile)
|
||||||
fmt.Println(string(wire.JSONBytes(privValidator.PubKey)))
|
fmt.Println(string(wire.JSONBytesPretty(privValidator.PubKey)))
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ type GenesisDoc struct {
|
|||||||
|
|
||||||
// Utility method for saving GenensisDoc as JSON file.
|
// Utility method for saving GenensisDoc as JSON file.
|
||||||
func (genDoc *GenesisDoc) SaveAs(file string) error {
|
func (genDoc *GenesisDoc) SaveAs(file string) error {
|
||||||
genDocBytes := wire.JSONBytes(genDoc)
|
genDocBytes := wire.JSONBytesPretty(genDoc)
|
||||||
return WriteFile(file, genDocBytes, 0644)
|
return WriteFile(file, genDocBytes, 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ func (privVal *PrivValidator) save() {
|
|||||||
if privVal.filePath == "" {
|
if privVal.filePath == "" {
|
||||||
PanicSanity("Cannot save PrivValidator: filePath not set")
|
PanicSanity("Cannot save PrivValidator: filePath not set")
|
||||||
}
|
}
|
||||||
jsonBytes := wire.JSONBytes(privVal)
|
jsonBytes := wire.JSONBytesPretty(privVal)
|
||||||
err := WriteFileAtomic(privVal.filePath, jsonBytes, 0600)
|
err := WriteFileAtomic(privVal.filePath, jsonBytes, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// `@; BOOM!!!
|
// `@; BOOM!!!
|
||||||
|
Reference in New Issue
Block a user