aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-10-22 22:13:24 +0200
committerRiccardo Spagni <ric@spagni.net>2016-10-22 22:13:24 +0200
commit7426b5374ff72bc2fd3077c6c263e369ea5a49bc (patch)
tree7e888fcdbf68409a3392a5741da202525356e8be /src
parent9feb358e46980db5fb2dc11becb0f479c5e6582c (diff)
parent094f4c8cc6bf0d0d4573c9f673f05514cd25c104 (diff)
downloadmonzero-core-7426b5374ff72bc2fd3077c6c263e369ea5a49bc.tar.gz
monzero-core-7426b5374ff72bc2fd3077c6c263e369ea5a49bc.tar.xz
monzero-core-7426b5374ff72bc2fd3077c6c263e369ea5a49bc.zip
Merge pull request #1221
094f4c8 rpc: add missing top block hash to json getinfo call (moneromooo-monero)
Diffstat (limited to 'src')
-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 f5258268c..ffc7fc4e8 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -1092,7 +1092,14 @@ namespace cryptonote
return false;
}
- 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_V2;