Skip to content

Commit

Permalink
Difficulty for explorer in f_block_short_response
Browse files Browse the repository at this point in the history
  • Loading branch information
aivve committed May 1, 2017
1 parent 93a06e4 commit c8a318f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Rpc/CoreRpcServerCommandsDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,15 @@ struct f_block_short_response {
std::string hash;
uint64_t tx_count;
uint64_t cumul_size;
difficulty_type difficulty;

void serialize(ISerializer &s) {
KV_MEMBER(timestamp)
KV_MEMBER(height)
KV_MEMBER(hash)
KV_MEMBER(cumul_size)
KV_MEMBER(tx_count)
KV_MEMBER(difficulty)
}
};

Expand Down
3 changes: 3 additions & 0 deletions src/Rpc/RpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ bool RpcServer::f_on_blocks_list_json(const F_COMMAND_RPC_GET_BLOCKS_LIST::reque
m_core.getBlockSize(block_hash, tx_cumulative_block_size);
size_t blokBlobSize = getObjectBinarySize(blk);
size_t minerTxBlobSize = getObjectBinarySize(blk.baseTransaction);
difficulty_type blockDiff;
m_core.getBlockDifficulty(static_cast<uint32_t>(i), blockDiff);

f_block_short_response block_short;
block_short.cumul_size = blokBlobSize + tx_cumulative_block_size - minerTxBlobSize;
Expand All @@ -544,6 +546,7 @@ bool RpcServer::f_on_blocks_list_json(const F_COMMAND_RPC_GET_BLOCKS_LIST::reque
block_short.hash = Common::podToHex(block_hash);
block_short.cumul_size = blokBlobSize + tx_cumulative_block_size - minerTxBlobSize;
block_short.tx_count = blk.transactionHashes.size() + 1;
block_short.difficulty = blockDiff;

res.blocks.push_back(block_short);

Expand Down

0 comments on commit c8a318f

Please sign in to comment.