mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Stop authoring blocks when offline (#1655)
* Don't author blocks when offline * Increased canonicalization delay * Fixed test
This commit is contained in:
committed by
Gav Wood
parent
2155e44e13
commit
641bb7cb46
@@ -88,6 +88,9 @@ pub trait SyncOracle {
|
||||
/// Whether the synchronization service is undergoing major sync.
|
||||
/// Returns true if so.
|
||||
fn is_major_syncing(&self) -> bool;
|
||||
/// Whether the synchronization service is offline.
|
||||
/// Returns true if so.
|
||||
fn is_offline(&self) -> bool;
|
||||
}
|
||||
|
||||
/// A synchronization oracle for when there is no network.
|
||||
@@ -96,10 +99,14 @@ pub struct NoNetwork;
|
||||
|
||||
impl SyncOracle for NoNetwork {
|
||||
fn is_major_syncing(&self) -> bool { false }
|
||||
fn is_offline(&self) -> bool { false }
|
||||
}
|
||||
|
||||
impl<T: SyncOracle> SyncOracle for Arc<T> {
|
||||
fn is_major_syncing(&self) -> bool {
|
||||
T::is_major_syncing(&*self)
|
||||
}
|
||||
fn is_offline(&self) -> bool {
|
||||
T::is_offline(&*self)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user