From f8086c0722e90d63f6616c1320f9967497632200 Mon Sep 17 00:00:00 2001 From: Aiwe Date: Mon, 4 Jul 2022 21:45:34 +0300 Subject: [PATCH] Correct block size in explorer method --- src/Rpc/RpcServer.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Rpc/RpcServer.cpp b/src/Rpc/RpcServer.cpp index 75366f103a..db4eb76b4f 100755 --- a/src/Rpc/RpcServer.cpp +++ b/src/Rpc/RpcServer.cpp @@ -1645,12 +1645,11 @@ bool RpcServer::on_get_explorer_block_by_hash(const COMMAND_EXPLORER_GET_BLOCK_D body += "NO\n"; body += " \n"; body += "
  • \n"; - size_t blockSize = 0; - if (!m_core.getBlockSize(blockHash, blockSize)) { - throw JsonRpc::JsonRpcError{ - CORE_RPC_ERROR_CODE_INTERNAL_ERROR, - "Internal error: can't get size of block " + req.hash + '.' }; - } + size_t tx_cumulative_block_size; + m_core.getBlockSize(blockHash, tx_cumulative_block_size); + size_t blokBlobSize = getObjectBinarySize(blk); + size_t minerTxBlobSize = getObjectBinarySize(blk.baseTransaction); + size_t blockSize = blokBlobSize + tx_cumulative_block_size - minerTxBlobSize; body += " Size: " + std::to_string(blockSize) + "\n"; body += "
  • \n"; body += "
  • \n";