rpc: report target height as 0 when synced

since it only makes sense when syncing, and it confuses people
This commit is contained in:
moneromooo-monero 2020-12-06 16:09:28 +00:00
parent b7425c14c8
commit 47590fc80b
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 2 additions and 2 deletions

View File

@ -451,7 +451,7 @@ namespace cryptonote
m_core.get_blockchain_top(res.height, top_hash); m_core.get_blockchain_top(res.height, top_hash);
++res.height; // turn top block height into blockchain height ++res.height; // turn top block height into blockchain height
res.top_block_hash = string_tools::pod_to_hex(top_hash); res.top_block_hash = string_tools::pod_to_hex(top_hash);
res.target_height = m_core.get_target_blockchain_height(); res.target_height = m_p2p.get_payload_object().is_synchronized() ? 0 : m_core.get_target_blockchain_height();
store_difficulty(m_core.get_blockchain_storage().get_difficulty_for_next_block(), res.difficulty, res.wide_difficulty, res.difficulty_top64); store_difficulty(m_core.get_blockchain_storage().get_difficulty_for_next_block(), res.difficulty, res.wide_difficulty, res.difficulty_top64);
res.target = m_core.get_blockchain_storage().get_difficulty_target(); res.target = m_core.get_blockchain_storage().get_difficulty_target();
res.tx_count = m_core.get_blockchain_storage().get_total_transactions() - res.height; //without coinbase res.tx_count = m_core.get_blockchain_storage().get_total_transactions() - res.height; //without coinbase
@ -2905,7 +2905,7 @@ namespace cryptonote
crypto::hash top_hash; crypto::hash top_hash;
m_core.get_blockchain_top(res.height, top_hash); m_core.get_blockchain_top(res.height, top_hash);
++res.height; // turn top block height into blockchain height ++res.height; // turn top block height into blockchain height
res.target_height = m_core.get_target_blockchain_height(); res.target_height = m_p2p.get_payload_object().is_synchronized() ? 0 : m_core.get_target_blockchain_height();
res.next_needed_pruning_seed = m_p2p.get_payload_object().get_next_needed_pruning_stripe().second; res.next_needed_pruning_seed = m_p2p.get_payload_object().get_next_needed_pruning_stripe().second;
for (const auto &c: m_p2p.get_payload_object().get_connections()) for (const auto &c: m_p2p.get_payload_object().get_connections())