diff --git a/chain/src/chain.rs b/chain/src/chain.rs index c34b5409b..78a78232e 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -129,6 +129,13 @@ impl Chain { let mut head = chain_head.lock().unwrap(); *head = tip.clone(); } + + // notifying other parts of the system of the update + if !opts.intersects(SYNC) { + // broadcast the block + let adapter = self.adapter.clone(); + adapter.block_accepted(&b); + } self.check_orphans(); } Ok(None) => {} @@ -140,7 +147,7 @@ impl Chain { Err(ref e) => { info!( LOGGER, - "Rejected block {} at {} : {:?}", + "Rejected block {} at {}: {:?}", b.hash(), b.header.height, e @@ -177,7 +184,6 @@ impl Chain { pipe::BlockContext { opts: opts_in, store: self.store.clone(), - adapter: self.adapter.clone(), head: head, pow_verifier: self.pow_verifier, sumtrees: self.sumtrees.clone(), diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index 8247ca831..5e7a4baba 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -36,8 +36,6 @@ pub struct BlockContext { pub opts: Options, /// The store pub store: Arc, - /// The adapter - pub adapter: Arc, /// The head pub head: Tip, /// The POW verification function @@ -294,11 +292,6 @@ fn validate_block(b: &Block, fn add_block(b: &Block, ctx: &mut BlockContext) -> Result<(), Error> { ctx.store.save_block(b).map_err(&Error::StoreErr)?; - if !ctx.opts.intersects(SYNC) { - // broadcast the block - let adapter = ctx.adapter.clone(); - adapter.block_accepted(b); - } Ok(()) }