pub fn secondary_pow_scaling(height: u64, diff_data: &[HeaderInfo]) -> u32 {
	// Get the scaling factor sum of the last DIFFICULTY_ADJUST_WINDOW elements
	let scale_sum: u64 = diff_data.iter().map(|dd| dd.secondary_scaling as u64).sum();

	// compute ideal 2nd_pow_fraction in pct and across window
	let target_pct = secondary_pow_ratio(height);
	let target_count = DIFFICULTY_ADJUST_WINDOW * target_pct;

	// Get the secondary count across the window, adjusting count toward goal
	// subject to dampening and clamping.
	let adj_count = clamp(
		damp(
			ar_count(height, diff_data),
			target_count,
			ar_scale_damp_factor(height),
		),
		target_count,
		CLAMP_FACTOR,
	);
	let scale = scale_sum * target_pct / max(1, adj_count);

	// minimum AR scale avoids getting stuck due to dampening
	max(MIN_AR_SCALE, scale) as u32
}
/// Factor by which the secondary proof of work difficulty will be adjusted
Factor by which the secondary proof of work difficulty will be adjusted
Factor by which the secondary proof of work difficulty will be adjusted
pub fn secondary_pow_scaling(height: u64, diff_data: &[HeaderInfo]) -> u32 {
	// Get the scaling factor sum of the last DIFFICULTY_ADJUST_WINDOW elements
	let scale_sum: u64 = diff_data.iter().map(|dd| dd.secondary_scaling as u64).sum();
	// compute ideal 2nd_pow_fraction in pct and across window
	let target_pct = secondary_pow_ratio(height);
	let target_count = DIFFICULTY_ADJUST_WINDOW * target_pct;
	// Get the secondary count across the window, adjusting count toward goal
	// subject to dampening and clamping.
	let adj_count = clamp(
		damp(
			ar_count(height, diff_data),
			target_count,
			ar_scale_damp_factor(height),
		),
		target_count,
		CLAMP_FACTOR,
	);
	let scale = scale_sum * target_pct / max(1, adj_count);
	// minimum AR scale avoids getting stuck due to dampening
	max(MIN_AR_SCALE, scale) as u32
}
pub fn secondary_pow_scaling ( height : u64 , diff_data : & [ HeaderInfo ] ) -> u32 { // Get the scaling factor sum of the last DIFFICULTY_ADJUST_WINDOW elements let scale_sum : u64 = diff_data . iter ( ) . map ( | dd | dd . secondary_scaling as u64 ) . sum ( ) ; // compute ideal 2nd_pow_fraction in pct and across window let target_pct = secondary_pow_ratio ( height ) ; let target_count = DIFFICULTY_ADJUST_WINDOW * target_pct ; // Get the secondary count across the window, adjusting count toward goal // subject to dampening and clamping. let adj_count = clamp ( damp ( ar_count ( height , diff_data ) , target_count , ar_scale_damp_factor ( height ) , ) , target_count , CLAMP_FACTOR , ) ; let scale = scale_sum * target_pct / max ( 1 , adj_count ) ; // minimum AR scale avoids getting stuck due to dampening max ( MIN_AR_SCALE , scale ) as u32 }
Factor by which the secondary proof of work difficulty will be adjusted
Factor by which the secondary proof of work difficulty will be adjusted
height
u64
diff_data
&[HeaderInfo]
height
u64
diff_data
&[HeaderInfo]