rpc: rm PeerCount usage (#10271)

This commit is contained in:
Thomas Coratger
2024-08-12 09:55:48 -07:00
committed by GitHub
parent b8a6f87884
commit 269ba89636
2 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,5 @@
use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_rpc_types::PeerCount; use reth_primitives::U64;
/// Net rpc interface. /// Net rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "net"))] #[cfg_attr(not(feature = "client"), rpc(server, namespace = "net"))]
@ -11,7 +11,7 @@ pub trait NetApi {
/// Returns number of peers connected to node. /// Returns number of peers connected to node.
#[method(name = "peerCount")] #[method(name = "peerCount")]
fn peer_count(&self) -> RpcResult<PeerCount>; fn peer_count(&self) -> RpcResult<U64>;
/// Returns true if client is actively listening for network connections. /// Returns true if client is actively listening for network connections.
/// Otherwise false. /// Otherwise false.

View File

@ -3,7 +3,6 @@ use reth_network_api::PeersInfo;
use reth_primitives::U64; use reth_primitives::U64;
use reth_rpc_api::NetApiServer; use reth_rpc_api::NetApiServer;
use reth_rpc_eth_api::helpers::EthApiSpec; use reth_rpc_eth_api::helpers::EthApiSpec;
use reth_rpc_types::PeerCount;
/// `Net` API implementation. /// `Net` API implementation.
/// ///
@ -37,8 +36,8 @@ where
} }
/// Handler for `net_peerCount` /// Handler for `net_peerCount`
fn peer_count(&self) -> Result<PeerCount> { fn peer_count(&self) -> Result<U64> {
Ok(PeerCount::Hex(U64::from(self.network.num_connected_peers()))) Ok(U64::from(self.network.num_connected_peers()))
} }
/// Handler for `net_listening` /// Handler for `net_listening`