Merge pull request #449

87425c2 rpc: fix hard_fork_info RPC (moneromooo-monero)
33b96d8 rpc: fix a few commands not working as command line (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2015-10-26 18:04:20 +02:00
commit 6665ae4e61
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
3 changed files with 11 additions and 7 deletions

View File

@ -310,7 +310,7 @@ bool t_rpc_command_executor::print_connections() {
if (m_is_rpc)
{
if (!m_rpc_client->json_rpc_request(req, res, "/get_connections", fail_message.c_str()))
if (!m_rpc_client->json_rpc_request(req, res, "get_connections", fail_message.c_str()))
{
return true;
}
@ -933,7 +933,7 @@ bool t_rpc_command_executor::out_peers(uint64_t limit)
if (m_is_rpc)
{
if (!m_rpc_client->json_rpc_request(req, res, "/out_peers", fail_message.c_str()))
if (!m_rpc_client->json_rpc_request(req, res, "out_peers", fail_message.c_str()))
{
return true;
}
@ -1012,7 +1012,7 @@ bool t_rpc_command_executor::hard_fork_info(uint8_t version)
if (m_is_rpc)
{
if (!m_rpc_client->json_rpc_request(req, res, "/hard_fork_info", fail_message.c_str()))
if (!m_rpc_client->json_rpc_request(req, res, "hard_fork_info", fail_message.c_str()))
{
return true;
}
@ -1024,11 +1024,13 @@ bool t_rpc_command_executor::hard_fork_info(uint8_t version)
tools::fail_msg_writer() << fail_message.c_str();
return true;
}
version = version > 0 ? version : res.voting;
tools::msg_writer() << "version " << (uint32_t)version << " " << (res.enabled ? "enabled" : "not enabled") <<
", " << res.votes << "/" << res.window << " votes, threshold " << res.threshold;
tools::msg_writer() << "current version " << (uint32_t)res.version << ", voting for version " << (uint32_t)res.voting;
}
version = version > 0 ? version : res.voting;
tools::msg_writer() << "version " << (uint32_t)version << " " << (res.enabled ? "enabled" : "not enabled") <<
", " << res.votes << "/" << res.window << " votes, threshold " << res.threshold;
tools::msg_writer() << "current version " << (uint32_t)res.version << ", voting for version " << (uint32_t)res.voting;
return true;
}

View File

@ -827,6 +827,7 @@ namespace cryptonote
res.version = blockchain.get_current_hard_fork_version();
res.enabled = blockchain.get_hard_fork_voting_info(version, res.window, res.votes, res.threshold, res.voting);
res.state = blockchain.get_hard_fork_state();
res.status = CORE_RPC_STATUS_OK;
return true;
#else
error_resp.code = CORE_RPC_ERROR_CODE_UNSUPPORTED_RPC;

View File

@ -103,6 +103,7 @@ namespace cryptonote
MAP_JON_RPC_WE("getblockheaderbyheight", on_get_block_header_by_height, COMMAND_RPC_GET_BLOCK_HEADER_BY_HEIGHT)
MAP_JON_RPC_WE("get_connections", on_get_connections, COMMAND_RPC_GET_CONNECTIONS)
MAP_JON_RPC_WE("get_info", on_get_info_json, COMMAND_RPC_GET_INFO)
MAP_JON_RPC_WE("hard_fork_info", on_hard_fork_info, COMMAND_RPC_HARD_FORK_INFO)
END_JSON_RPC_MAP()
END_URI_MAP2()