restored chain_new_blocks

This commit is contained in:
Nikolay Volf 2016-05-31 20:58:33 +02:00
parent f5ed31792f
commit 10d914d6c6

View File

@ -1272,6 +1272,18 @@ impl ChainSync {
pub fn maintain_sync(&mut self, io: &mut SyncIo) { pub fn maintain_sync(&mut self, io: &mut SyncIo) {
self.check_resume(io); self.check_resume(io);
} }
/// called when block is imported to chain, updates transactions queue and propagates the blocks
pub fn chain_new_blocks(&mut self, io: &mut SyncIo, _imported: &[H256], invalid: &[H256], _enacted: &[H256], _retracted: &[H256]) {
if io.is_chain_queue_empty() {
// Propagate latests blocks
self.propagate_latest_blocks(io);
}
if !invalid.is_empty() {
trace!(target: "sync", "Bad blocks in the queue, restarting");
self.restart_on_bad_block(io);
}
}
} }
#[cfg(test)] #[cfg(test)]