mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(rpc): add eth_syncing implementation (#1859)
This commit is contained in:
@ -40,6 +40,9 @@ pub trait NetworkInfo: Send + Sync {
|
||||
|
||||
/// Returns the chain id
|
||||
fn chain_id(&self) -> u64;
|
||||
|
||||
/// Returns `true` if the network is undergoing sync.
|
||||
fn is_syncing(&self) -> bool;
|
||||
}
|
||||
|
||||
/// Provides general purpose information about Peers in the network.
|
||||
|
||||
@ -35,6 +35,10 @@ impl NetworkInfo for NoopNetwork {
|
||||
fn chain_id(&self) -> u64 {
|
||||
Mainnet.into()
|
||||
}
|
||||
|
||||
fn is_syncing(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
impl PeersInfo for NoopNetwork {
|
||||
|
||||
@ -229,6 +229,10 @@ impl NetworkInfo for NetworkHandle {
|
||||
fn chain_id(&self) -> u64 {
|
||||
self.inner.chain_id.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
fn is_syncing(&self) -> bool {
|
||||
SyncStateProvider::is_syncing(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl StatusUpdater for NetworkHandle {
|
||||
|
||||
Reference in New Issue
Block a user