hard fork version added to network info

master
moneroexamples 7 years ago
parent 599ad61706
commit 98571672fe

@ -249,10 +249,13 @@ MempoolStatus::read_network_info()
local_copy.block_size_limit = rpc_network_info.block_size_limit; local_copy.block_size_limit = rpc_network_info.block_size_limit;
local_copy.start_time = rpc_network_info.start_time; local_copy.start_time = rpc_network_info.start_time;
epee::string_tools::hex_to_pod(rpc_network_info.top_block_hash, local_copy.top_block_hash); epee::string_tools::hex_to_pod(rpc_network_info.top_block_hash, local_copy.top_block_hash);
local_copy.fee_per_kb = fee_estimated; local_copy.fee_per_kb = fee_estimated;
local_copy.info_timestamp = static_cast<uint64_t>(std::time(nullptr)); local_copy.info_timestamp = static_cast<uint64_t>(std::time(nullptr));
local_copy.current_hf_version = core_storage->get_current_hard_fork_version();
local_copy.current = true; local_copy.current = true;
current_network_info = local_copy; current_network_info = local_copy;

@ -71,6 +71,7 @@ struct MempoolStatus
uint64_t cumulative_difficulty {0}; uint64_t cumulative_difficulty {0};
uint64_t block_size_limit {0}; uint64_t block_size_limit {0};
uint64_t start_time {0}; uint64_t start_time {0};
uint64_t current_hf_version {0};
uint64_t hash_rate {0}; uint64_t hash_rate {0};
uint64_t fee_per_kb {0}; uint64_t fee_per_kb {0};

@ -747,6 +747,7 @@ namespace xmreg
{"block_size_limit" , block_size_limit}, {"block_size_limit" , block_size_limit},
{"is_current_info" , current_network_info.current}, {"is_current_info" , current_network_info.current},
{"is_pool_size_zero" , (current_network_info.tx_pool_size == 0)}, {"is_pool_size_zero" , (current_network_info.tx_pool_size == 0)},
{"current_hf_version", current_network_info.current_hf_version},
{"age" , network_info_age.first}, {"age" , network_info_age.first},
{"age_format" , network_info_age.second}, {"age_format" , network_info_age.second},
}; };
@ -6069,7 +6070,8 @@ namespace xmreg
{"cumulative_difficulty" , local_copy_network_info.cumulative_difficulty}, {"cumulative_difficulty" , local_copy_network_info.cumulative_difficulty},
{"block_size_limit" , local_copy_network_info.block_size_limit}, {"block_size_limit" , local_copy_network_info.block_size_limit},
{"start_time" , local_copy_network_info.start_time}, {"start_time" , local_copy_network_info.start_time},
{"fee_per_kb" , local_copy_network_info.fee_per_kb} {"fee_per_kb" , local_copy_network_info.fee_per_kb},
{"current_hf_version" , local_copy_network_info.current_hf_version}
}; };
return local_copy_network_info.current; return local_copy_network_info.current;

@ -37,6 +37,7 @@
{{#network_info}} {{#network_info}}
<h3 style="font-size: 12px; margin-top: 5px; margin-bottom: 3"> <h3 style="font-size: 12px; margin-top: 5px; margin-bottom: 3">
Network difficulty: {{difficulty}} Network difficulty: {{difficulty}}
| Hard fork: v{{current_hf_version}}
| Hash rate: {{hash_rate}} | Hash rate: {{hash_rate}}
| Fee per kb: {{fee_per_kb}} | Fee per kb: {{fee_per_kb}}
| Median block size limit: {{block_size_limit}} kB | Median block size limit: {{block_size_limit}} kB

@ -332,10 +332,11 @@ void chunks(Iterator begin,
* Remove all characters in in_str that match the given * Remove all characters in in_str that match the given
* regular expression * regular expression
*/ */
template <typename T>
inline string inline string
remove_bad_chars(string const& in_str, std::regex const& rgx = std::regex ("[^a-zA-Z0-9]")) remove_bad_chars(T&& in_str, std::regex const& rgx = std::regex ("[^a-zA-Z0-9]"))
{ {
return std::regex_replace(in_str, rgx, ""); return std::regex_replace(std::forward<T>(in_str), rgx, "");
} }

Loading…
Cancel
Save