mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 19:33:28 +01:00
print top block hash in daemon diff command
and add top block hash in get_info RPC
This commit is contained in:
parent
f7d41d6e28
commit
0ab56b80db
@ -241,6 +241,7 @@ bool t_rpc_command_executor::show_difficulty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tools::success_msg_writer() << "BH: " << res.height
|
tools::success_msg_writer() << "BH: " << res.height
|
||||||
|
<< ", TH: " << res.top_block_hash
|
||||||
<< ", DIFF: " << res.difficulty
|
<< ", DIFF: " << res.difficulty
|
||||||
<< ", HR: " << (int) res.difficulty / res.target << " H/s";
|
<< ", HR: " << (int) res.difficulty / res.target << " H/s";
|
||||||
|
|
||||||
|
@ -117,7 +117,14 @@ namespace cryptonote
|
|||||||
bool core_rpc_server::on_get_info(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res)
|
bool core_rpc_server::on_get_info(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res)
|
||||||
{
|
{
|
||||||
CHECK_CORE_BUSY();
|
CHECK_CORE_BUSY();
|
||||||
res.height = m_core.get_current_blockchain_height();
|
crypto::hash top_hash;
|
||||||
|
if (!m_core.get_blockchain_top(res.height, top_hash))
|
||||||
|
{
|
||||||
|
res.status = "Failed";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
++res.height; // turn top block height into blockchain height
|
||||||
|
res.top_block_hash = string_tools::pod_to_hex(top_hash);
|
||||||
res.target_height = m_core.get_target_blockchain_height();
|
res.target_height = m_core.get_target_blockchain_height();
|
||||||
res.difficulty = m_core.get_blockchain_storage().get_difficulty_for_next_block();
|
res.difficulty = m_core.get_blockchain_storage().get_difficulty_for_next_block();
|
||||||
res.target = m_core.get_blockchain_storage().get_current_hard_fork_version() < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET;
|
res.target = m_core.get_blockchain_storage().get_current_hard_fork_version() < 2 ? DIFFICULTY_TARGET_V1 : DIFFICULTY_TARGET;
|
||||||
|
@ -282,6 +282,7 @@ namespace cryptonote
|
|||||||
uint64_t white_peerlist_size;
|
uint64_t white_peerlist_size;
|
||||||
uint64_t grey_peerlist_size;
|
uint64_t grey_peerlist_size;
|
||||||
bool testnet;
|
bool testnet;
|
||||||
|
std::string top_block_hash;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(status)
|
KV_SERIALIZE(status)
|
||||||
@ -296,6 +297,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(white_peerlist_size)
|
KV_SERIALIZE(white_peerlist_size)
|
||||||
KV_SERIALIZE(grey_peerlist_size)
|
KV_SERIALIZE(grey_peerlist_size)
|
||||||
KV_SERIALIZE(testnet)
|
KV_SERIALIZE(testnet)
|
||||||
|
KV_SERIALIZE(top_block_hash)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user