mirror of
https://github.com/monero-project/monero.git
synced 2025-07-26 03:45:22 -04:00
Add an RPC call and daemon command to get info on hard fork voting
This commit is contained in:
parent
d06713199e
commit
e546f3724a
13 changed files with 169 additions and 5 deletions
|
@ -946,4 +946,35 @@ bool t_rpc_command_executor::stop_save_graph()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::hard_fork_info(uint8_t version)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_HARD_FORK_INFO::request req;
|
||||
cryptonote::COMMAND_RPC_HARD_FORK_INFO::response res;
|
||||
std::string fail_message = "Unsuccessful";
|
||||
epee::json_rpc::error error_resp;
|
||||
|
||||
req.version = version;
|
||||
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->json_rpc_request(req, res, "/hard_fork_info", fail_message.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_hard_fork_info(req, res, error_resp))
|
||||
{
|
||||
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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}// namespace daemonize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue