Beispiel #1
0
        public async Task <ActionResult> Top()
        {
            try
            {
                var top = await _addressService.GetTopList();

                var stats = await _addressService.GetStats();

                var lastBlock = await _blockService.GetLastBlock();

                int indexerHeight = stats.Item1;
                if (indexerHeight > lastBlock.Height) // best blockheight is cached and may thus lag indexer height
                {
                    indexerHeight = (int)lastBlock.Height;
                }

                ViewData["BestHeight"]         = indexerHeight;
                ViewData["IndexerLastSeenAgo"] = (DateTime.UtcNow - stats.Item2).TotalMinutes.ToString("0.0");
                ViewData["BestBlockHeight"]    = lastBlock.Height;
                return(View(top));
            }
            catch (Exception e)
            {
                return(View("Error"));
            }
        }
Beispiel #2
0
 async Task RefreshCache()
 {
     try
     {
         var data = new TopListData()
         {
             TopList   = await _addressService.GetTopList(),
             Stats     = await _addressService.GetStats(),
             LastBlock = await _blockService.GetLastBlock()
         };
         TopListCache.SetData(data);
     }
     catch (Exception e)
     {
         TopListCache.SetData(null);
         _logger.LogError(e.Message);
     }
 }
        public async Task <ActionResult> Top()
        {
            try
            {
                var top = await _addressService.GetTopList();

                var stats = await _addressService.GetStats();

                var lastBlock = await _blockService.GetLastBlock();

                ViewData["BestHeight"]         = stats.Item1;
                ViewData["IndexerLastSeenAgo"] = (DateTime.UtcNow - stats.Item2).TotalMinutes.ToString("0.0");
                ViewData["BestBlockHeight"]    = lastBlock.Height;
                return(View(top));
            }
            catch (Exception e)
            {
                return(View("Error"));
            }
        }
Beispiel #4
0
 public IActionResult GetLastBlock()
 {
     return(Ok(_blockService.GetLastBlock()));
 }