public FetchingBackgroundService(IDistributedCache distributedCache, DefaultEndpointsSettings defaultEndpointsSettings, IHubContext <DataUpdaterHub> hubContext, ILoggerFactory loggerFactory, ApiRequester apiRequester, IConfiguration configuration)
        {
            this.defaultEndpointsSettings = defaultEndpointsSettings;
            this.distributedCache         = distributedCache;
            this.updaterHub    = hubContext;
            this.loggerFactory = loggerFactory;
            this.logger        = loggerFactory.CreateLogger <FetchingBackgroundService>();
            this.apiRequester  = apiRequester;

            if (this.defaultEndpointsSettings.SidechainNodeType == NodeTypes.TenK)
            {
                this.multiSigNode = false;
            }

            this.logger.LogInformation("Default settings {settings}", defaultEndpointsSettings);
            if (this.multiSigNode)
            {
                nodeDataServiceMainchain = new MultiSigMainChainService(this.apiRequester, this.defaultEndpointsSettings, this.loggerFactory);
                nodeDataServiceSidechain = new MultiSigSideChainService(this.apiRequester, this.defaultEndpointsSettings, this.loggerFactory);
            }
            else
            {
                nodeDataServiceMainchain = new MasterNodeMainChainService(this.apiRequester, this.defaultEndpointsSettings, this.loggerFactory);
                nodeDataServiceSidechain = new MasterNodeSideChainService(this.apiRequester, this.defaultEndpointsSettings, this.loggerFactory);
            }
        }
        private void ParsePeers(NodeDataService dataService, List <Peer> peers)
        {
            if (dataService.StatusResponse.Content.outboundPeers is JArray outboundPeers)
            {
                this.LoadPeers(outboundPeers, "outbound", peers);
            }

            if (dataService.StatusResponse.Content.inboundPeers is JArray inboundPeers)
            {
                this.LoadPeers(inboundPeers, "inbound", peers);
            }
        }
        private void ParsePeers(NodeDataService dataService, List <Peer> peers, List <Peer> federationMembers)
        {
            string fedEndpoints = dataService.FedInfoResponse?.Content?.endpoints?.ToString() ?? string.Empty;

            if (dataService.StatusResponse.Content.outboundPeers is JArray outboundPeers)
            {
                this.LoadPeers(fedEndpoints, outboundPeers, "outbound", peers, federationMembers);
            }

            if (dataService.StatusResponse.Content.inboundPeers is JArray inboundPeers)
            {
                this.LoadPeers(fedEndpoints, inboundPeers, "inbound", peers, federationMembers);
            }
        }
        public ActionResult Home()
        {
            NodeDataService dataService = new NodeDataService(Request.MapPath(NodeDataService.DataUri));

            return(View("Timeline", dataService.Get().GroupBy(n => n.When.Year)));
        }