P2P now works with Amino

This commit is contained in:
Jae Kwon
2018-03-26 06:40:02 +02:00
parent ced74251e9
commit 901b456151
22 changed files with 193 additions and 200 deletions

View File

@ -3,7 +3,6 @@ package p2p
import (
"bytes"
"encoding/hex"
"encoding/json"
"fmt"
"io/ioutil"
@ -64,7 +63,7 @@ func loadNodeKey(filePath string) (*NodeKey, error) {
return nil, err
}
nodeKey := new(NodeKey)
err = json.Unmarshal(jsonBytes, nodeKey)
err = cdc.UnmarshalJSON(jsonBytes, nodeKey)
if err != nil {
return nil, fmt.Errorf("Error reading NodeKey from %v: %v\n", filePath, err)
}
@ -72,12 +71,12 @@ func loadNodeKey(filePath string) (*NodeKey, error) {
}
func genNodeKey(filePath string) (*NodeKey, error) {
privKey := crypto.GenPrivKeyEd25519().Wrap()
privKey := crypto.GenPrivKeyEd25519()
nodeKey := &NodeKey{
PrivKey: privKey,
}
jsonBytes, err := json.Marshal(nodeKey)
jsonBytes, err := cdc.MarshalJSON(nodeKey)
if err != nil {
return nil, err
}