aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/core_rpc_server.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-12-22 10:07:10 +0200
committerRiccardo Spagni <ric@spagni.net>2015-12-22 10:07:35 +0200
commitb42966aead06a4d1e791f44381a856f4e7880c24 (patch)
treef569072f1f4a1ee0e4bf1b9dc61c4c5948f9f88e /src/rpc/core_rpc_server.cpp
parent5d33b43d8d957b4ec8051f54a1d14af35226a6dd (diff)
parent0ab56b80dbf59ecc9877a055ced3c46dda501646 (diff)
downloadmonzero-core-b42966aead06a4d1e791f44381a856f4e7880c24.tar.gz
monzero-core-b42966aead06a4d1e791f44381a856f4e7880c24.tar.xz
monzero-core-b42966aead06a4d1e791f44381a856f4e7880c24.zip
Merge pull request #545
0ab56b8 print top block hash in daemon diff command (moneromooo-monero)
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r--src/rpc/core_rpc_server.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index b566e7318..945557a46 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -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)
{
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.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;