mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 21:01:21 +00:00
add json2wal & fix wal2json (#2196)
* add json2wal & fix wal2json * fix bug * Update main.go * add wal2JsonTest file * Delete wal2JsonTest
This commit is contained in:
committed by
Anton Kaliaev
parent
5a8fe61200
commit
785786bec4
@ -8,14 +8,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
cs "github.com/tendermint/tendermint/consensus"
|
||||
"github.com/tendermint/go-amino"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
|
||||
var cdc = amino.NewCodec()
|
||||
|
||||
func init() {
|
||||
cs.RegisterConsensusMessages(cdc)
|
||||
cs.RegisterWALMessages(cdc)
|
||||
types.RegisterBlockAmino(cdc)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("missing one argument: <path-to-wal>")
|
||||
@ -37,7 +46,7 @@ func main() {
|
||||
panic(fmt.Errorf("failed to decode msg: %v", err))
|
||||
}
|
||||
|
||||
json, err := json.Marshal(msg)
|
||||
json, err := cdc.MarshalJSON(msg)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("failed to marshal msg: %v", err))
|
||||
}
|
||||
|
Reference in New Issue
Block a user