diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index d3e77002f..ad13eac6d 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -27,6 +27,7 @@ const ( NewNode ClientNode WalletNode + BackupNode ) func (role Role) String() string { @@ -47,6 +48,8 @@ func (role Role) String() string { return "ClientNode" case WalletNode: return "WalletNode" + case BackupNode: + return "BackupNode" } return "Unknown" } diff --git a/node/service_setup.go b/node/service_setup.go index 4f9367428..6db45d669 100644 --- a/node/service_setup.go +++ b/node/service_setup.go @@ -105,6 +105,15 @@ func (node *Node) setupForWalletNode() { node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, p2p.GroupIDBeacon, chanPeer, nil)) } +func (node *Node) setupForBackupNode() { + nodeConfig, chanPeer := node.initNodeConfiguration() + // Register peer discovery service. + node.serviceManager.RegisterService(service.PeerDiscovery, discovery.New(node.host, nodeConfig, chanPeer, node.AddBeaconPeer)) + // Register networkinfo service. "0" is the beacon shard ID + node.serviceManager.RegisterService(service.NetworkInfo, networkinfo.New(node.host, p2p.GroupIDBeacon, chanPeer, nil)) + //TODO: Add Syncing as a service. +} + // ServiceManagerSetup setups service store. func (node *Node) ServiceManagerSetup() { node.serviceManager = &service.Manager{} @@ -124,6 +133,8 @@ func (node *Node) ServiceManagerSetup() { node.setupForClientNode() case nodeconfig.WalletNode: node.setupForWalletNode() + case nodeconfig.BackupNode: + node.setupForBackupNode() } node.serviceManager.SetupServiceMessageChan(node.serviceMessageChan) }