status added to network_info
This commit is contained in:
parent
1fe5a2185f
commit
f41de0956c
|
@ -232,6 +232,7 @@ MempoolStatus::read_network_info()
|
||||||
|
|
||||||
network_info local_copy;
|
network_info local_copy;
|
||||||
|
|
||||||
|
local_copy.status = network_info::get_status_uint(rpc_network_info.status);
|
||||||
local_copy.height = rpc_network_info.height;
|
local_copy.height = rpc_network_info.height;
|
||||||
local_copy.target_height = rpc_network_info.target_height;
|
local_copy.target_height = rpc_network_info.target_height;
|
||||||
local_copy.difficulty = rpc_network_info.difficulty;
|
local_copy.difficulty = rpc_network_info.difficulty;
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct MempoolStatus
|
||||||
// the current info timesout.
|
// the current info timesout.
|
||||||
struct network_info
|
struct network_info
|
||||||
{
|
{
|
||||||
|
uint64_t status {0};
|
||||||
uint64_t height {0};
|
uint64_t height {0};
|
||||||
uint64_t target_height {0};
|
uint64_t target_height {0};
|
||||||
uint64_t difficulty {0};
|
uint64_t difficulty {0};
|
||||||
|
@ -72,6 +73,32 @@ struct MempoolStatus
|
||||||
uint64_t info_timestamp {0};
|
uint64_t info_timestamp {0};
|
||||||
|
|
||||||
bool current {false};
|
bool current {false};
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
get_status_uint(const string& status)
|
||||||
|
{
|
||||||
|
if (status == CORE_RPC_STATUS_OK)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (status == CORE_RPC_STATUS_BUSY)
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
// default
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static string
|
||||||
|
get_status_string(const uint64_t& status)
|
||||||
|
{
|
||||||
|
if (status == 1)
|
||||||
|
return CORE_RPC_STATUS_OK;
|
||||||
|
|
||||||
|
if (status == 2)
|
||||||
|
return CORE_RPC_STATUS_BUSY;
|
||||||
|
|
||||||
|
// default
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static boost::thread m_thread;
|
static boost::thread m_thread;
|
||||||
|
|
|
@ -5447,7 +5447,7 @@ namespace xmreg
|
||||||
= MempoolStatus::current_network_info;
|
= MempoolStatus::current_network_info;
|
||||||
|
|
||||||
j_info = json {
|
j_info = json {
|
||||||
{"status" , local_copy_network_info.current},
|
{"status" , MempoolStatus::network_info::get_status_string(local_copy_network_info.status)},
|
||||||
{"current" , local_copy_network_info.current},
|
{"current" , local_copy_network_info.current},
|
||||||
{"height" , local_copy_network_info.height},
|
{"height" , local_copy_network_info.height},
|
||||||
{"target_height" , local_copy_network_info.target_height},
|
{"target_height" , local_copy_network_info.target_height},
|
||||||
|
|
Loading…
Reference in New Issue