feat(rpc): add eth_syncing implementation (#1859)

This commit is contained in:
Matthias Seitz
2023-03-20 12:22:17 +01:00
committed by GitHub
parent 1891e13d30
commit 2a457c7023
7 changed files with 46 additions and 6 deletions

View File

@ -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.

View File

@ -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 {

View File

@ -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 {