From 1e53cdc9b5ca1d4bebf64ac76635b2e85c0e5694 Mon Sep 17 00:00:00 2001 From: Ross Chadwick Date: Thu, 12 Sep 2019 12:54:42 +0200 Subject: [PATCH] p2p/simulations/adapters: Add bootnode & lightnode flags to NodeConfig, to allow for configuration of their respective services during simulations --- p2p/simulations/adapters/types.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/p2p/simulations/adapters/types.go b/p2p/simulations/adapters/types.go index f65ce7b605..3aabe2c1bd 100644 --- a/p2p/simulations/adapters/types.go +++ b/p2p/simulations/adapters/types.go @@ -89,6 +89,12 @@ type NodeConfig struct { // Enable peer events for Msgs 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 string @@ -121,6 +127,8 @@ type nodeConfigJSON struct { Name string `json:"name"` Services []string `json:"services"` EnableMsgEvents bool `json:"enable_msg_events"` + BootNode bool `json:"bootnode"` + LightNode bool `json:"lightnode"` Port uint16 `json:"port"` } @@ -133,6 +141,8 @@ func (n *NodeConfig) MarshalJSON() ([]byte, error) { Services: n.Services, Port: n.Port, EnableMsgEvents: n.EnableMsgEvents, + BootNode: n.BootNode, + LightNode: n.LightNode, } if n.PrivateKey != nil { confJSON.PrivateKey = hex.EncodeToString(crypto.FromECDSA(n.PrivateKey)) @@ -170,6 +180,8 @@ func (n *NodeConfig) UnmarshalJSON(data []byte) error { n.Services = confJSON.Services n.Port = confJSON.Port n.EnableMsgEvents = confJSON.EnableMsgEvents + n.BootNode = confJSON.BootNode + n.LightNode = confJSON.LightNode return nil }