Skip to content

Commit

Permalink
Correct block size in explorer method
Browse files Browse the repository at this point in the history
  • Loading branch information
aivve committed Jul 4, 2022
1 parent 6244ad7 commit f8086c0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Rpc/RpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1645,12 +1645,11 @@ bool RpcServer::on_get_explorer_block_by_hash(const COMMAND_EXPLORER_GET_BLOCK_D
body += "NO\n";
body += " </li>\n";
body += " <li>\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 += " </li>\n";
body += " <li>\n";
Expand Down

0 comments on commit f8086c0

Please sign in to comment.