fix informant
This commit is contained in:
parent
dca752e9bb
commit
9ecb07434f
@ -414,8 +414,8 @@ impl Client {
|
|||||||
}
|
}
|
||||||
if let Ok(closed_block) = self.check_and_close_block(&block) {
|
if let Ok(closed_block) = self.check_and_close_block(&block) {
|
||||||
if self.engine.is_proposal(&block.header) {
|
if self.engine.is_proposal(&block.header) {
|
||||||
|
self.block_queue.mark_as_good(&[header.hash()]);
|
||||||
proposed_blocks.push(block.bytes);
|
proposed_blocks.push(block.bytes);
|
||||||
invalid_blocks.insert(header.hash());
|
|
||||||
} else {
|
} else {
|
||||||
imported_blocks.push(header.hash());
|
imported_blocks.push(header.hash());
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
|
|||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
||||||
use isatty::{stdout_isatty};
|
use isatty::{stdout_isatty};
|
||||||
use ethsync::{SyncProvider, ManageNetwork};
|
use ethsync::{SyncProvider, ManageNetwork};
|
||||||
use util::{Uint, RwLock, Mutex, H256, Colour};
|
use util::{Uint, RwLock, Mutex, H256, Colour, Bytes};
|
||||||
use ethcore::client::*;
|
use ethcore::client::*;
|
||||||
use ethcore::views::BlockView;
|
use ethcore::views::BlockView;
|
||||||
use ethcore::snapshot::service::Service as SnapshotService;
|
use ethcore::snapshot::service::Service as SnapshotService;
|
||||||
@ -176,14 +176,13 @@ impl Informant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ChainNotify for Informant {
|
impl ChainNotify for Informant {
|
||||||
fn new_blocks(&self, imported: Vec<H256>, _invalid: Vec<H256>, _enacted: Vec<H256>, _retracted: Vec<H256>, _sealed: Vec<H256>, duration: u64) {
|
fn new_blocks(&self, imported: Vec<H256>, _invalid: Vec<H256>, _enacted: Vec<H256>, _retracted: Vec<H256>, _sealed: Vec<H256>, _proposed: Vec<Bytes>, duration: u64) {
|
||||||
let mut last_import = self.last_import.lock();
|
let mut last_import = self.last_import.lock();
|
||||||
let sync_state = self.sync.as_ref().map(|s| s.status().state);
|
let sync_state = self.sync.as_ref().map(|s| s.status().state);
|
||||||
let importing = is_major_importing(sync_state, self.client.queue_info());
|
let importing = is_major_importing(sync_state, self.client.queue_info());
|
||||||
|
|
||||||
let ripe = Instant::now() > *last_import + Duration::from_secs(1) && !importing;
|
let ripe = Instant::now() > *last_import + Duration::from_secs(1) && !importing;
|
||||||
let txs_imported = imported.iter()
|
let txs_imported = imported.iter()
|
||||||
.take(imported.len() - if ripe {1} else {0})
|
.take(imported.len().saturating_sub(if ripe { 1 } else { 0 }))
|
||||||
.filter_map(|h| self.client.block(BlockID::Hash(*h)))
|
.filter_map(|h| self.client.block(BlockID::Hash(*h)))
|
||||||
.map(|b| BlockView::new(&b).transactions_count())
|
.map(|b| BlockView::new(&b).transactions_count())
|
||||||
.sum();
|
.sum();
|
||||||
|
Loading…
Reference in New Issue
Block a user