Do not try to synchronize from light client (#2039)

* do not try to sync from light node

* use Roles' utility methods
This commit is contained in:
Svyatoslav Nikolsky
2019-05-14 15:41:11 +03:00
committed by Gavin Wood
parent 5bde98e95a
commit a29fd10859
8 changed files with 109 additions and 34 deletions
+12
View File
@@ -73,6 +73,18 @@ bitflags! {
}
}
impl Roles {
/// Does this role represents a client that holds full chain data locally?
pub fn is_full(&self) -> bool {
self.intersects(Roles::FULL | Roles::AUTHORITY)
}
/// Does this role represents a client that does not hold full chain data locally?
pub fn is_light(&self) -> bool {
!self.is_full()
}
}
impl parity_codec::Encode for Roles {
fn encode_to<T: parity_codec::Output>(&self, dest: &mut T) {
dest.push_byte(self.bits())