network > chain_id, put in genesis.json

This commit is contained in:
Ethan Buchman
2015-05-29 14:13:45 -04:00
parent bb67fe0356
commit 8a2d9525f0
22 changed files with 139 additions and 60 deletions

View File

@@ -18,7 +18,7 @@ type PrivNodeID struct {
type NodeGreeting struct {
NodeID
Version string
Network string
ChainID string
Message string
Time time.Time
}

View File

@@ -56,6 +56,8 @@ func NewNode() *Node {
state = sm.MakeGenesisStateFromFile(stateDB, config.GetString("genesis_file"))
state.Save()
}
// add the chainid to the global config
config.Set("chain_id", state.ChainID)
// Get PrivValidator
var privValidator *sm.PrivValidator
@@ -212,7 +214,7 @@ func (n *Node) EventSwitch() *events.EventSwitch {
func makeNodeInfo(sw *p2p.Switch) *types.NodeInfo {
nodeInfo := &types.NodeInfo{
Network: config.GetString("network"),
ChainID: config.GetString("chain_id"),
Moniker: config.GetString("moniker"),
Version: config.GetString("version"),
}