Skip to content

Commit

Permalink
rpc: rm PeerCount usage (paradigmxyz#10271)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Aug 12, 2024
1 parent b8a6f87 commit 269ba89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/rpc/rpc-api/src/net.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_rpc_types::PeerCount;
use reth_primitives::U64;

/// Net rpc interface.
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "net"))]
Expand All @@ -11,7 +11,7 @@ pub trait NetApi {

/// Returns number of peers connected to node.
#[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.
/// Otherwise false.
Expand Down
5 changes: 2 additions & 3 deletions crates/rpc/rpc/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use reth_network_api::PeersInfo;
use reth_primitives::U64;
use reth_rpc_api::NetApiServer;
use reth_rpc_eth_api::helpers::EthApiSpec;
use reth_rpc_types::PeerCount;

/// `Net` API implementation.
///
Expand Down Expand Up @@ -37,8 +36,8 @@ where
}

/// Handler for `net_peerCount`
fn peer_count(&self) -> Result<PeerCount> {
Ok(PeerCount::Hex(U64::from(self.network.num_connected_peers())))
fn peer_count(&self) -> Result<U64> {
Ok(U64::from(self.network.num_connected_peers()))
}

/// Handler for `net_listening`
Expand Down

0 comments on commit 269ba89

Please sign in to comment.