mirror of
https://github.com/mimblewimble/grin.git
synced 2025-05-02 07:11:15 +03:00
Fix last tests broken by secondary PoW factor adjustment
This commit is contained in:
parent
3c6b5a0a9c
commit
a41022f1e3
2 changed files with 5 additions and 4 deletions
|
@ -408,17 +408,17 @@ fn next_target_adjustment() {
|
|||
let diff_one = Difficulty::one();
|
||||
assert_eq!(
|
||||
next_difficulty(1, vec![HeaderInfo::from_ts_diff(cur_time, diff_one)]),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 1),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 4),
|
||||
);
|
||||
assert_eq!(
|
||||
next_difficulty(1, vec![HeaderInfo::new(cur_time, diff_one, 10, true)]),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 1),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 4),
|
||||
);
|
||||
|
||||
let mut hi = HeaderInfo::from_diff_scaling(diff_one, 1);
|
||||
assert_eq!(
|
||||
next_difficulty(1, repeat(60, hi.clone(), DIFFICULTY_ADJUST_WINDOW, None)),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 1),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 4),
|
||||
);
|
||||
hi.is_secondary = true;
|
||||
assert_eq!(
|
||||
|
@ -428,7 +428,7 @@ fn next_target_adjustment() {
|
|||
hi.secondary_scaling = 100;
|
||||
assert_eq!(
|
||||
next_difficulty(1, repeat(60, hi.clone(), DIFFICULTY_ADJUST_WINDOW, None)),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 93),
|
||||
HeaderInfo::from_diff_scaling(Difficulty::one(), 106),
|
||||
);
|
||||
|
||||
// Check we don't get stuck on difficulty 1
|
||||
|
|
|
@ -97,6 +97,7 @@ pub fn add_block_with_reward(chain: &Chain, txs: Vec<&Transaction>, reward: CbDa
|
|||
(output, kernel),
|
||||
).unwrap();
|
||||
b.header.timestamp = prev.timestamp + Duration::seconds(60);
|
||||
b.header.pow.scaling_difficulty = next_header_info.secondary_scaling;
|
||||
chain.set_txhashset_roots(&mut b, false).unwrap();
|
||||
pow::pow_size(
|
||||
&mut b.header,
|
||||
|
|
Loading…
Add table
Reference in a new issue