From a1c7f304bdeaf9ea05d697458337b02c405831a5 Mon Sep 17 00:00:00 2001 From: Mike Dallas Date: Tue, 16 Jul 2019 20:17:40 +0100 Subject: [PATCH] fix on_header_received hook (#2953) --- servers/src/common/adapters.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/servers/src/common/adapters.rs b/servers/src/common/adapters.rs index bdc735ca22..85b718a1f2 100644 --- a/servers/src/common/adapters.rs +++ b/servers/src/common/adapters.rs @@ -238,11 +238,11 @@ impl p2p::ChainAdapter for NetToChainAdapter { bh: core::BlockHeader, peer_info: &PeerInfo, ) -> Result { - let bhash = bh.hash(); - debug!( - "Received block header {} at {} from {}, going to process.", - bhash, bh.height, peer_info.addr, - ); + if !self.sync_state.is_syncing() { + for hook in &self.hooks { + hook.on_header_received(&bh, &peer_info.addr); + } + } // pushing the new block header through the header chain pipeline // we will go ask for the block if this is a new header @@ -251,7 +251,7 @@ impl p2p::ChainAdapter for NetToChainAdapter { .process_block_header(&bh, self.chain_opts(false)); if let Err(e) = res { - debug!("Block header {} refused by chain: {:?}", bhash, e.kind()); + debug!("Block header {} refused by chain: {:?}", bh.hash(), e.kind()); if e.is_bad_data() { return Ok(false); } else {