mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
rpc: rm PeerCount usage (#10271)
This commit is contained in:
@ -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.
|
||||||
|
|||||||
@ -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`
|
||||||
|
|||||||
Reference in New Issue
Block a user