diff --git a/src/MempoolStatus.cpp b/src/MempoolStatus.cpp index bd5193a..d562401 100644 --- a/src/MempoolStatus.cpp +++ b/src/MempoolStatus.cpp @@ -232,6 +232,7 @@ MempoolStatus::read_network_info() 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.target_height = rpc_network_info.target_height; local_copy.difficulty = rpc_network_info.difficulty; diff --git a/src/MempoolStatus.h b/src/MempoolStatus.h index 04248a7..44607ea 100644 --- a/src/MempoolStatus.h +++ b/src/MempoolStatus.h @@ -50,6 +50,7 @@ struct MempoolStatus // the current info timesout. struct network_info { + uint64_t status {0}; uint64_t height {0}; uint64_t target_height {0}; uint64_t difficulty {0}; @@ -72,6 +73,32 @@ struct MempoolStatus uint64_t info_timestamp {0}; 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; diff --git a/src/page.h b/src/page.h index 52b0b44..8c80da2 100644 --- a/src/page.h +++ b/src/page.h @@ -5447,7 +5447,7 @@ namespace xmreg = MempoolStatus::current_network_info; 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}, {"height" , local_copy_network_info.height}, {"target_height" , local_copy_network_info.target_height},