public NodeHealthCheck(
     INodeHealthService nodeHealthService,
     ILogManager logManager)
 {
     _nodeHealthService = nodeHealthService ?? throw new ArgumentNullException(nameof(nodeHealthService));
     _logger            = logManager.GetClassLogger();
 }
Esempio n. 2
0
        public void NodeStatus_returns_expected_results()
        {
            INodeHealthService nodeHealthService = Substitute.For <INodeHealthService>();

            nodeHealthService.CheckHealth().Returns(new CheckHealthResult()
            {
                Healthy  = false,
                Messages = new List <(string, string)>()
                {
                    { ("Still syncing", "Syncing in progress") }
                }
            });
Esempio n. 3
0
        public Task InitRpcModules()
        {
            if (_healthChecksConfig.Enabled)
            {
                IInitConfig initConfig = _api.Config <IInitConfig>();
                _nodeHealthService = new NodeHealthService(_api.SyncServer, new ReadOnlyBlockTree(_api.BlockTree), _api.BlockchainProcessor, _api.BlockProducer, _healthChecksConfig, _api.HealthHintService, initConfig.IsMining);
                HealthModule healthModule = new HealthModule(_nodeHealthService);
                _api.RpcModuleProvider !.Register(new SingletonModulePool <IHealthModule>(healthModule, true));
                if (_logger.IsInfo)
                {
                    _logger.Info("Health RPC Module has been enabled");
                }
            }

            return(Task.CompletedTask);
        }
 public HealthRpcModule(INodeHealthService nodeHealthService)
 {
     _nodeHealthService = nodeHealthService;
 }
Esempio n. 5
0
 public NodeHealthCheck(INodeHealthService nodeHealthService)
 {
     _nodeHealthService = nodeHealthService ?? throw new ArgumentNullException(nameof(nodeHealthService));
 }