Proper light client informant and more verification of imported headers (#5897)
* do more validation of imported headers in light client * generalize informant with traits * informant implementation for light client * make comment into TODO * fix broken test * disable full checking of headers in light client in sync tests
This commit is contained in:
committed by
Arkadiy Paronyan
parent
f0a6b5d401
commit
67c1f71b6e
@@ -112,6 +112,22 @@ impl ClientReport {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::std::ops::Sub<&'a ClientReport> for ClientReport {
|
||||
type Output = Self;
|
||||
|
||||
fn sub(mut self, other: &'a ClientReport) -> Self {
|
||||
let higher_mem = ::std::cmp::max(self.state_db_mem, other.state_db_mem);
|
||||
let lower_mem = ::std::cmp::min(self.state_db_mem, other.state_db_mem);
|
||||
|
||||
self.blocks_imported -= other.blocks_imported;
|
||||
self.transactions_applied -= other.transactions_applied;
|
||||
self.gas_processed = self.gas_processed - other.gas_processed;
|
||||
self.state_db_mem = higher_mem - lower_mem;
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
struct SleepState {
|
||||
last_activity: Option<Instant>,
|
||||
last_autosleep: Option<Instant>,
|
||||
|
||||
Reference in New Issue
Block a user