public IActionResult Block(string block, int?pagenum = null) { try { uint blockHeight; string blockHash = block; ClientBlock blk; var lastBlockMongo = mainCoins.GetLastBlockMongo(); if (uint.TryParse(block, out blockHeight)) { blk = mainCoins.GetAssetBlockByIdMongo(blockHeight); } else { blk = mainCoins.GetAssetBlockMongo(blockHash); } if (blk == null) { var lastBlockWallet = mainCoins.GetLastBlock(); if (blockHeight != 0) { blockHash = mainCoins.GetBlockHashByHeight(blockHeight); } var blkUnconfirmed = mainCoins.GetBlockByHash(blockHash); if (blkUnconfirmed != null && lastBlockMongo > blockHeight) { return(View("~/Views/Home/BlockUnindexed.cshtml")); } if (blkUnconfirmed != null) { return(View("~/Views/Home/BlockUnconfirmed.cshtml")); } } blk.ConfirmationsClient = (int)lastBlockMongo - blk.Height + 1; List <ClientTransaction> trlist = new List <ClientTransaction>(); var pagenr = 1; if (pagenum != null) { pagenr = pagenum.Value; } var zPage = pagenr - 1; if (zPage < 0) { zPage = 0; pagenr = 1; } var start = (pagenr - 1) * ON_PAGE; var txs = mainCoins.GetRawAssetTransactionMongoList(blk.Height); var count = blk.Tx.Count; var maxPage = count / ON_PAGE + 1; if (zPage >= maxPage) { zPage = 0; pagenr = 1; } blk.BTCFee = 0.0m; blk.OMNIFee = 0.0m; blk.TxCount = blk.Additional != null && blk.Additional.ContainsKey(mainCoins.GetCoin().CoinID + "_assettxcount") ? Convert.ToInt32(blk.Additional[mainCoins.GetCoin().CoinID + "_assettxcount"]) : 0; foreach (var tx in txs) { var transaction = new ClientTransaction() { Amount = decimal.Parse(tx.amount, CultureInfo.InvariantCulture), block = tx.block, amount = tx.amount, blockhash = tx.blockhash, blocktime = tx.blocktime, confirmations = tx.confirmations, BlockDateTime = MainCoins.UnixTimeStampToDateTime(tx.blocktime), ConfirmationsClient = (int)lastBlockMongo - blk.Height + 1, divisible = tx.divisible, ecosystem = tx.ecosystem, fee = tx.fee, ismine = tx.ismine, positioninblock = tx.positioninblock, propertyid = tx.propertyid, referenceaddress = tx.referenceaddress, sendingaddress = tx.sendingaddress, txid = tx.txid, type = tx.type, type_int = tx.type_int, valid = tx.valid, version = tx.version }; blk.BTCFee += decimal.Parse(tx.fee, CultureInfo.InvariantCulture); blk.TotalTransfered += transaction.Amount; trlist.Add(transaction); } return(View(new BlockViewModel { Block = blk, ListTransactions = trlist, MainCoinModel = mainCoins.GetCoin(), IsConfirmed = true, Pageing = new Pageing() { MaxCount = count, OnPage = ON_PAGE, Pagenum = pagenr } })); } catch { return(View("~/Views/Shared/Error.cshtml", new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier })); } }