zmq: add restricted checks to GetInfo

This commit is contained in:
selsta
2026-04-29 19:05:35 +02:00
parent 31fbbc11bd
commit f31bb18174
+9 -9
View File
@@ -558,17 +558,17 @@ namespace rpc
res.info.tx_count = chain.get_total_transactions() - res.info.height; //without coinbase res.info.tx_count = chain.get_total_transactions() - res.info.height; //without coinbase
res.info.tx_pool_size = m_core.get_pool_transactions_count(); res.info.tx_pool_size = m_core.get_pool_transactions_count(!m_restricted);
res.info.alt_blocks_count = chain.get_alternative_blocks_count(); res.info.alt_blocks_count = m_restricted ? 0 : chain.get_alternative_blocks_count();
uint64_t total_conn = m_p2p.get_public_connections_count(); uint64_t total_conn = m_restricted ? 0 : m_p2p.get_public_connections_count();
res.info.outgoing_connections_count = m_p2p.get_public_outgoing_connections_count(); res.info.outgoing_connections_count = m_restricted ? 0 : m_p2p.get_public_outgoing_connections_count();
res.info.incoming_connections_count = total_conn - res.info.outgoing_connections_count; res.info.incoming_connections_count = m_restricted ? 0 : total_conn - res.info.outgoing_connections_count;
res.info.white_peerlist_size = m_p2p.get_public_white_peers_count(); res.info.white_peerlist_size = m_restricted ? 0 : m_p2p.get_public_white_peers_count();
res.info.grey_peerlist_size = m_p2p.get_public_gray_peers_count(); res.info.grey_peerlist_size = m_restricted ? 0 : m_p2p.get_public_gray_peers_count();
res.info.mainnet = m_core.get_nettype() == MAINNET; res.info.mainnet = m_core.get_nettype() == MAINNET;
res.info.testnet = m_core.get_nettype() == TESTNET; res.info.testnet = m_core.get_nettype() == TESTNET;
@@ -578,8 +578,8 @@ namespace rpc
res.info.block_size_limit = res.info.block_weight_limit = m_core.get_blockchain_storage().get_current_cumulative_block_weight_limit(); res.info.block_size_limit = res.info.block_weight_limit = m_core.get_blockchain_storage().get_current_cumulative_block_weight_limit();
res.info.block_size_median = res.info.block_weight_median = m_core.get_blockchain_storage().get_current_cumulative_block_weight_median(); res.info.block_size_median = res.info.block_weight_median = m_core.get_blockchain_storage().get_current_cumulative_block_weight_median();
res.info.adjusted_time = m_core.get_blockchain_storage().get_adjusted_time(res.info.height); res.info.adjusted_time = m_core.get_blockchain_storage().get_adjusted_time(res.info.height);
res.info.start_time = (uint64_t)m_core.get_start_time(); res.info.start_time = m_restricted ? 0 : (uint64_t)m_core.get_start_time();
res.info.version = MONERO_VERSION; res.info.version = m_restricted ? "" : MONERO_VERSION;
res.status = Message::STATUS_OK; res.status = Message::STATUS_OK;
res.error_details = ""; res.error_details = "";