// This should be set in viper so it can unmarshal into this struct
RootDir string `mapstructure:"home"`
+ //The alias of the node
+ NodeAlias string `mapstructure:"node_alias"`
+
//The ID of the network to json
ChainID string `mapstructure:"chain_id"`
DBBackend: "leveldb",
DBPath: "data",
KeysPath: "keystore",
+ NodeAlias: "",
}
}
RemoteAddr string `json:"remote_addr"`
ListenAddr string `json:"listen_addr"`
Version string `json:"version"` // major.minor.revision
- Other []string `json:"other"` // other application specific data
+ // other application specific data
+ //field 0: node service flags. field 1: node alias.
+ Other []string `json:"other"`
}
func NewNodeInfo(config *cfg.Config, pubkey crypto.PubKeyEd25519, listenAddr string) *NodeInfo {
+ other := []string{strconv.FormatUint(uint64(consensus.DefaultServices), 10)}
+ if config.NodeAlias != "" {
+ other = append(other, config.NodeAlias)
+ }
return &NodeInfo{
PubKey: pubkey,
Moniker: config.Moniker,
Network: config.ChainID,
ListenAddr: listenAddr,
Version: version.Version,
- Other: []string{strconv.FormatUint(uint64(consensus.DefaultServices), 10)},
+ Other: other,
}
}