예제 #1
0
        public async Task <IActionResult> GetPoolInfoAsync()
        {
            var poolInfo = new PoolInfo()
            {
                Name              = CustomizationOptions.PoolName,
                TotalMinerCount   = await DbContext.Miners.CountAsync(),
                TotalPlotterCount = await DbContext.Plotters.CountAsync(),

                ActiveMinerCount   = MinerService.GetActiveMinerCount(),
                ActivePlotterCount = PlotterService.GetActivePlotterCount(),

                PlotterCapactity = PlotterService.GetPlottingCapacity(),

                PlotterPlots = PlotterService.GetAvailablePlotCount(),
                MinerPlots   = MinerService.GetActivePlotCount(),

                TotalPlotMinutes = PlotService.GetTotalPlotMinutes(),
            };

            return(Ok(poolInfo));
        }
예제 #2
0
        public async Task <IActionResult> GetPoolInfoAsync()
        {
            var minimumActiveTime = DateTimeOffset.UtcNow - TimeSpan.FromMinutes(1);

            var poolInfo = new PoolInfo()
            {
                Name              = CustomizationOptions.PoolName,
                TotalMinerCount   = await DbContext.Miners.CountAsync(),
                TotalPlotterCount = await DbContext.Plotters.CountAsync(),

                ActiveMinerCount   = await DbContext.Miners.CountAsync(x => x.NextIncrement >= minimumActiveTime),
                ActivePlotterCount = PlotterService.GetActivePlotterCount(),

                PlotterCapactity = PlotterService.GetPlottingCapacity(),

                PlotterPlots = PlotterService.GetAvailablePlotCount(),
                MinerPlots   = await DbContext.Miners.Where(x => x.NextIncrement >= minimumActiveTime).SumAsync(x => x.LastPlotCount),

                TotalPlotMinutes = PlotService.GetTotalPlotMinutes(),
            };

            return(Ok(poolInfo));
        }