mirror of
https://github.com/monero-project/monero.git
synced 2025-01-28 18:56:31 +02:00
Add cumulative size to RPC block headers
This commit is contained in:
parent
f45b9efafd
commit
746af71727
@ -1055,6 +1055,11 @@ uint64_t blockchain_storage::block_cumulative_difficulty(size_t i)
|
||||
return m_blocks[i].cumulative_difficulty;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
uint64_t blockchain_storage::block_cumulative_size(size_t i)
|
||||
{
|
||||
return m_blocks[i].block_cumulative_size;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
uint64_t blockchain_storage::block_difficulty(size_t i)
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_blockchain_lock);
|
||||
@ -1093,6 +1098,7 @@ std::vector<block_header_responce> blockchain_storage::get_block_headers(uint64_
|
||||
, reward
|
||||
, blk.tx_hashes.size()
|
||||
, block_info.cumulative_difficulty
|
||||
, block_info.block_cumulative_size
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ namespace cryptonote
|
||||
uint64_t get_current_comulative_blocksize_limit();
|
||||
bool is_storing_blockchain(){return m_is_blockchain_storing;}
|
||||
uint64_t block_cumulative_difficulty(size_t i);
|
||||
uint64_t block_cumulative_size(size_t i);
|
||||
uint64_t block_difficulty(size_t i);
|
||||
std::vector<block_header_responce> get_block_headers(uint64_t start_index, uint64_t end_index);
|
||||
|
||||
|
@ -18,6 +18,7 @@ namespace cryptonote {
|
||||
uint64_t reward;
|
||||
uint64_t tx_count;
|
||||
uint64_t cumulative_difficulty;
|
||||
uint64_t cumulative_size;
|
||||
|
||||
block_header_responce() = default;
|
||||
|
||||
@ -35,6 +36,7 @@ namespace cryptonote {
|
||||
, uint64_t reward
|
||||
, uint64_t tx_count
|
||||
, uint64_t cumulative_difficulty
|
||||
, uint64_t cumulative_size
|
||||
)
|
||||
: major_version(major_version)
|
||||
, minor_version(minor_version)
|
||||
@ -49,6 +51,7 @@ namespace cryptonote {
|
||||
, reward(reward)
|
||||
, tx_count(tx_count)
|
||||
, cumulative_difficulty(cumulative_difficulty)
|
||||
, cumulative_size(cumulative_size)
|
||||
{}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
|
@ -572,6 +572,7 @@ namespace cryptonote
|
||||
responce.reward = get_block_reward(blk);
|
||||
responce.tx_count = blk.tx_hashes.size();
|
||||
responce.cumulative_difficulty = m_core.get_blockchain_storage().block_cumulative_difficulty(height);
|
||||
responce.cumulative_size = m_core.get_blockchain_storage().block_cumulative_size(height);
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user