Add hard_fork to get_info rpc request

It's simple to add and saves a call to HARD_FORK_INFO when all you care
about is the hf number (and not the other hard fork details).
This commit is contained in:
Jason Rhinelander 2022-05-25 22:19:43 -03:00
parent 6f6505278c
commit b6fdd9d90f
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
3 changed files with 4 additions and 0 deletions

View File

@ -373,6 +373,8 @@ namespace cryptonote { namespace rpc {
res.top_block_hash = tools::type_to_hex(top_hash);
res.target_height = m_core.get_target_blockchain_height();
res.hard_fork = m_core.get_blockchain_storage().get_network_version();
bool next_block_is_pulse = false;
if (pulse::timings t; pulse::get_round_timings(m_core.get_blockchain_storage(), res.height, prev_ts, t)) {
res.pulse_ideal_timestamp = tools::to_seconds(t.ideal_timestamp.time_since_epoch());

View File

@ -299,6 +299,7 @@ KV_SERIALIZE_MAP_CODE_BEGIN(GET_INFO::response)
KV_SERIALIZE(pulse_target_timestamp)
KV_SERIALIZE(difficulty)
KV_SERIALIZE(target)
KV_SERIALIZE_ENUM(hard_fork)
KV_SERIALIZE(tx_count)
KV_SERIALIZE(tx_pool_size)
KV_SERIALIZE(alt_blocks_count)

View File

@ -622,6 +622,7 @@ namespace rpc {
uint64_t pulse_target_timestamp; // For pulse blocks this is the target timestamp of the next block, which targets 2 minutes after the previous block but will be slightly faster/slower if the previous block is behind/ahead of the ideal timestamp.
uint64_t difficulty; // Network difficulty (analogous to the strength of the network).
uint64_t target; // Current target for next proof of work.
hf hard_fork; // Current network hard fork version
uint64_t tx_count; // Total number of non-coinbase transaction in the chain.
uint64_t tx_pool_size; // Number of transactions that have been broadcast but not included in a block.
std::optional<uint64_t> alt_blocks_count; // Number of alternative blocks to main chain.