Merge pull request #4373

4f81cd3a rpc: add cumulative difficulty in block header data (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-09-21 20:40:22 +02:00
commit 629db71593
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 3 additions and 0 deletions

View file

@ -1247,6 +1247,7 @@ namespace cryptonote
response.depth = m_core.get_current_blockchain_height() - height - 1;
response.hash = string_tools::pod_to_hex(hash);
response.difficulty = m_core.get_blockchain_storage().block_difficulty(height);
response.cumulative_difficulty = response.block_weight = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(height);
response.reward = get_block_reward(blk);
response.block_size = response.block_weight = m_core.get_blockchain_storage().get_db().get_block_weight(height);
response.num_txes = blk.tx_hashes.size();

View file

@ -1120,6 +1120,7 @@ namespace cryptonote
uint64_t depth;
std::string hash;
difficulty_type difficulty;
difficulty_type cumulative_difficulty;
uint64_t reward;
uint64_t block_size;
uint64_t block_weight;
@ -1137,6 +1138,7 @@ namespace cryptonote
KV_SERIALIZE(depth)
KV_SERIALIZE(hash)
KV_SERIALIZE(difficulty)
KV_SERIALIZE(cumulative_difficulty)
KV_SERIALIZE(reward)
KV_SERIALIZE(block_size)
KV_SERIALIZE_OPT(block_weight, (uint64_t)0)