From 10d914d6c663a0f9bb9b2d517bebee7ae3115832 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 31 May 2016 20:58:33 +0200 Subject: [PATCH] restored chain_new_blocks --- sync/src/chain.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 42d425af9..1270f775f 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -1272,6 +1272,18 @@ impl ChainSync { pub fn maintain_sync(&mut self, io: &mut SyncIo) { 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)]