Skip to content

Commit

Permalink
remove median test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cifko committed Nov 18, 2022
1 parent 5920cfd commit df78bdd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
12 changes: 3 additions & 9 deletions base_layer/core/src/validation/header_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ use tari_utilities::hex::Hex;

use crate::{
blocks::BlockHeader,
chain_storage::{fetch_headers, BlockchainBackend},
consensus::{ConsensusConstants, ConsensusManager},
chain_storage::BlockchainBackend,
consensus::ConsensusManager,
proof_of_work::AchievedTargetDifficulty,
validation::{
helpers::{
check_blockchain_version,
check_header_timestamp_greater_than_median,
check_not_bad_block,
check_pow_data,
check_timestamp_ftl,
},
helpers::{check_blockchain_version, check_not_bad_block, check_pow_data, check_timestamp_ftl},
DifficultyCalculator,
HeaderValidation,
ValidationError,
Expand Down
14 changes: 0 additions & 14 deletions base_layer/core/tests/block_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,20 +612,6 @@ OutputFeatures::default()),
)
.is_err());

// lets break the median rules
let mut new_block = db.prepare_new_block(template.clone()).unwrap();
new_block.header.nonce = OsRng.next_u64();
// we take the max ftl time and give 10 seconds for mining then check it, it should still be more than the ftl
new_block.header.timestamp = genesis.header().timestamp.checked_sub(100.into()).unwrap();
find_header_with_achieved_difficulty(&mut new_block.header, 20.into());
assert!(header_validator
.validate(
&*db.db_read_access().unwrap(),
&new_block.header,
&difficulty_calculator,
)
.is_err());

// lets break difficulty
let mut new_block = db.prepare_new_block(template).unwrap();
new_block.header.nonce = OsRng.next_u64();
Expand Down

0 comments on commit df78bdd

Please sign in to comment.