diff --git a/consensus/src/consensus/mod.rs b/consensus/src/consensus/mod.rs index 6a66e8e46..77dc30033 100644 --- a/consensus/src/consensus/mod.rs +++ b/consensus/src/consensus/mod.rs @@ -903,6 +903,10 @@ impl ConsensusApi for Consensus { Some(hash) => { self.validate_block_exists(hash)?; let ghostdag_data = self.ghostdag_primary_store.get_data(hash).unwrap(); + // The selected parent header is used within to check for sampling activation, so we verify its existence first + if !self.headers_store.has(ghostdag_data.selected_parent).unwrap() { + return Err(ConsensusError::DifficultyError(DifficultyError::InsufficientWindowData(0))); + } self.estimate_network_hashes_per_second_impl(&ghostdag_data, window_size) } None => {