public void Start() { StartNode(new ChannelsConfig { Tcp = new IPEndPoint(IPAddress.Any, Settings.Default.P2P.Port), WebSocket = new IPEndPoint(IPAddress.Any, Settings.Default.P2P.WsPort), MinDesiredConnections = Settings.Default.P2P.MinDesiredConnections, MaxConnections = Settings.Default.P2P.MaxConnections, MaxConnectionsPerAddress = Settings.Default.P2P.MaxConnectionsPerAddress }); Task.Run(async() => { while (BlockChain.Singleton == null) { await Task.Delay(100); } StartConsensus(); TheBlockchain.Tell(new BlockChain.Startup()); if (NodeService.Instance.PosWallet.AccountId == ProtocolSettings.Default.StandbyValidators[0]) { ActorSystem.Scheduler .ScheduleTellRepeatedly(TimeSpan.FromSeconds(20), TimeSpan.FromSeconds(600), Consensus, new ConsensusService.Consolidate(), ActorRefs.NoSender); //or ActorRefs.Nobody or something else } }); }
public void Start() { StartNode(new ChannelsConfig { Tcp = new IPEndPoint(IPAddress.Any, Settings.Default.P2P.Port), WebSocket = new IPEndPoint(IPAddress.Any, Settings.Default.P2P.WsPort), MinDesiredConnections = Settings.Default.P2P.MinDesiredConnections, MaxConnections = Settings.Default.P2P.MaxConnections, MaxConnectionsPerAddress = Settings.Default.P2P.MaxConnectionsPerAddress }); Task.Run(async() => { int waitCount = 60; while (Neo.Network.P2P.LocalNode.Singleton.ConnectedCount < 2) { _log.LogWarning($"{waitCount} Wait for p2p network startup. connected peer: {Neo.Network.P2P.LocalNode.Singleton.ConnectedCount}"); await Task.Delay(1000); waitCount--; if (waitCount <= 0) { break; } } _log.LogWarning($"p2p network connected peer: {Neo.Network.P2P.LocalNode.Singleton.ConnectedCount}"); while (BlockChain.Singleton == null) { await Task.Delay(100); } StartConsensus(); TheBlockchain.Tell(new BlockChain.Startup()); //if (NodeService.Instance.PosWallet.AccountId == ProtocolSettings.Default.StandbyValidators[0]) //{ // ActorSystem.Scheduler // .ScheduleTellRepeatedly(TimeSpan.FromSeconds(20), // TimeSpan.FromSeconds(600), // Consensus, new ConsensusService.Consolidate(), ActorRefs.NoSender); //or ActorRefs.Nobody or something else //} }); }