mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p/simulations/adapters: Add bootnode & lightnode flags to NodeConfig, to allow for configuration of their respective services during simulations
This commit is contained in:
parent
7300365956
commit
1e53cdc9b5
1 changed files with 12 additions and 0 deletions
|
|
@ -89,6 +89,12 @@ type NodeConfig struct {
|
||||||
// Enable peer events for Msgs
|
// Enable peer events for Msgs
|
||||||
EnableMsgEvents bool
|
EnableMsgEvents bool
|
||||||
|
|
||||||
|
// Node will run services as a bootnode
|
||||||
|
BootNode bool
|
||||||
|
|
||||||
|
// Node will run services as a lightnode
|
||||||
|
LightNode bool
|
||||||
|
|
||||||
// Name is a human friendly name for the node like "node01"
|
// Name is a human friendly name for the node like "node01"
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
|
@ -121,6 +127,8 @@ type nodeConfigJSON struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Services []string `json:"services"`
|
Services []string `json:"services"`
|
||||||
EnableMsgEvents bool `json:"enable_msg_events"`
|
EnableMsgEvents bool `json:"enable_msg_events"`
|
||||||
|
BootNode bool `json:"bootnode"`
|
||||||
|
LightNode bool `json:"lightnode"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,6 +141,8 @@ func (n *NodeConfig) MarshalJSON() ([]byte, error) {
|
||||||
Services: n.Services,
|
Services: n.Services,
|
||||||
Port: n.Port,
|
Port: n.Port,
|
||||||
EnableMsgEvents: n.EnableMsgEvents,
|
EnableMsgEvents: n.EnableMsgEvents,
|
||||||
|
BootNode: n.BootNode,
|
||||||
|
LightNode: n.LightNode,
|
||||||
}
|
}
|
||||||
if n.PrivateKey != nil {
|
if n.PrivateKey != nil {
|
||||||
confJSON.PrivateKey = hex.EncodeToString(crypto.FromECDSA(n.PrivateKey))
|
confJSON.PrivateKey = hex.EncodeToString(crypto.FromECDSA(n.PrivateKey))
|
||||||
|
|
@ -170,6 +180,8 @@ func (n *NodeConfig) UnmarshalJSON(data []byte) error {
|
||||||
n.Services = confJSON.Services
|
n.Services = confJSON.Services
|
||||||
n.Port = confJSON.Port
|
n.Port = confJSON.Port
|
||||||
n.EnableMsgEvents = confJSON.EnableMsgEvents
|
n.EnableMsgEvents = confJSON.EnableMsgEvents
|
||||||
|
n.BootNode = confJSON.BootNode
|
||||||
|
n.LightNode = confJSON.LightNode
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue