Skip to content

Commit

Permalink
fix: fix status command daemon
Browse files Browse the repository at this point in the history
Fix status commmand in daemon not working due to removing mining stuff. fixes #29
  • Loading branch information
zachhildreth committed Mar 23, 2022
1 parent f70f755 commit 6f3445a
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/daemon/rpc_command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,6 @@ bool t_rpc_command_executor::show_status() {
cryptonote::COMMAND_RPC_GET_INFO::response ires;
cryptonote::COMMAND_RPC_HARD_FORK_INFO::request hfreq;
cryptonote::COMMAND_RPC_HARD_FORK_INFO::response hfres;
cryptonote::COMMAND_RPC_MINING_STATUS::request mreq;
cryptonote::COMMAND_RPC_MINING_STATUS::response mres;
epee::json_rpc::error error_resp;
bool has_mining_info = true;

Expand All @@ -409,8 +407,6 @@ bool t_rpc_command_executor::show_status() {
{
return true;
}
// mining info is only available non unrestricted RPC mode
has_mining_info = m_rpc_client->rpc_request(mreq, mres, "/mining_status", fail_message.c_str());
}
else
{
Expand All @@ -424,16 +420,6 @@ bool t_rpc_command_executor::show_status() {
tools::fail_msg_writer() << make_error(fail_message, hfres.status);
return true;
}

if (mres.status == CORE_RPC_STATUS_BUSY)
{
mining_busy = true;
}
else if (mres.status != CORE_RPC_STATUS_OK)
{
tools::fail_msg_writer() << make_error(fail_message, mres.status);
return true;
}
}

std::time_t uptime = std::time(nullptr) - ires.start_time;
Expand All @@ -453,14 +439,12 @@ bool t_rpc_command_executor::show_status() {
}

std::stringstream str;
str << boost::format("Height: %llu/%llu (%.1f%%) on %s%s, %s, net hash %s, v%u%s, %s, %u(out)+%u(in) connections")
str << boost::format("Height: %llu/%llu (%.1f%%) on %s%s, v%u%s, %s, %u(out)+%u(in) connections")
% (unsigned long long)ires.height
% (unsigned long long)net_height
% get_sync_percentage(ires)
% (ires.testnet ? "testnet" : ires.stagenet ? "stagenet" : "mainnet")
% bootstrap_msg
% (!has_mining_info ? "mining info unavailable" : mining_busy ? "syncing" : mres.active ? ( ( mres.is_background_mining_enabled ? "smart " : "" ) + std::string("mining at ") + get_mining_speed(mres.speed) ) : "not mining")
% get_mining_speed(ires.difficulty / ires.target)
% (unsigned)hfres.version
% get_fork_extra_info(hfres.earliest_height, net_height, ires.target)
% (hfres.state == cryptonote::HardFork::Ready ? "up to date" : hfres.state == cryptonote::HardFork::UpdateNeeded ? "update needed" : "out of date, likely forked")
Expand Down

0 comments on commit 6f3445a

Please sign in to comment.