mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
rpc: add block size to GET_BLOCK_HEADER RPC
and print it in print_bc
This commit is contained in:
parent
9188b3468c
commit
9731b4e54f
@ -473,8 +473,9 @@ bool t_rpc_command_executor::print_blockchain_info(uint64_t start_block_index, u
|
|||||||
if (!first)
|
if (!first)
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
std::cout
|
std::cout
|
||||||
|
<< "height: " << header.height << ", timestamp: " << header.timestamp << ", difficulty: " << header.difficulty
|
||||||
|
<< ", size: " << header.block_size << std::endl
|
||||||
<< "major version: " << (unsigned)header.major_version << ", minor version: " << (unsigned)header.minor_version << std::endl
|
<< "major version: " << (unsigned)header.major_version << ", minor version: " << (unsigned)header.minor_version << std::endl
|
||||||
<< "height: " << header.height << ", timestamp: " << header.timestamp << ", difficulty: " << header.difficulty << std::endl
|
|
||||||
<< "block id: " << header.hash << ", previous block id: " << header.prev_hash << std::endl
|
<< "block id: " << header.hash << ", previous block id: " << header.prev_hash << std::endl
|
||||||
<< "difficulty: " << header.difficulty << ", nonce " << header.nonce << ", reward " << cryptonote::print_money(header.reward) << std::endl;
|
<< "difficulty: " << header.difficulty << ", nonce " << header.nonce << ", reward " << cryptonote::print_money(header.reward) << std::endl;
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -892,6 +892,7 @@ namespace cryptonote
|
|||||||
response.hash = string_tools::pod_to_hex(hash);
|
response.hash = string_tools::pod_to_hex(hash);
|
||||||
response.difficulty = m_core.get_blockchain_storage().block_difficulty(height);
|
response.difficulty = m_core.get_blockchain_storage().block_difficulty(height);
|
||||||
response.reward = get_block_reward(blk);
|
response.reward = get_block_reward(blk);
|
||||||
|
response.block_size = m_core.get_blockchain_storage().get_db().get_block_size(height);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -49,7 +49,7 @@ namespace cryptonote
|
|||||||
// advance which version they will stop working with
|
// advance which version they will stop working with
|
||||||
// Don't go over 32767 for any of these
|
// Don't go over 32767 for any of these
|
||||||
#define CORE_RPC_VERSION_MAJOR 1
|
#define CORE_RPC_VERSION_MAJOR 1
|
||||||
#define CORE_RPC_VERSION_MINOR 1
|
#define CORE_RPC_VERSION_MINOR 3
|
||||||
#define CORE_RPC_VERSION (((CORE_RPC_VERSION_MAJOR)<<16)|(CORE_RPC_VERSION_MINOR))
|
#define CORE_RPC_VERSION (((CORE_RPC_VERSION_MAJOR)<<16)|(CORE_RPC_VERSION_MINOR))
|
||||||
|
|
||||||
struct COMMAND_RPC_GET_HEIGHT
|
struct COMMAND_RPC_GET_HEIGHT
|
||||||
@ -695,6 +695,7 @@ namespace cryptonote
|
|||||||
std::string hash;
|
std::string hash;
|
||||||
difficulty_type difficulty;
|
difficulty_type difficulty;
|
||||||
uint64_t reward;
|
uint64_t reward;
|
||||||
|
uint64_t block_size;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(major_version)
|
KV_SERIALIZE(major_version)
|
||||||
@ -708,6 +709,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(hash)
|
KV_SERIALIZE(hash)
|
||||||
KV_SERIALIZE(difficulty)
|
KV_SERIALIZE(difficulty)
|
||||||
KV_SERIALIZE(reward)
|
KV_SERIALIZE(reward)
|
||||||
|
KV_SERIALIZE(block_size)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user