fn pruning_range(config: &Configuration, min_blocks_to_keep: u64, block: u64) -> Option<(u64, u64)> {
	// compute number of changes tries we actually want to keep
	let (prune_interval, blocks_to_keep) = if config.is_digest_build_enabled() {
		// we only CAN prune at block where max-level-digest is created
		let max_digest_interval = match config.digest_level_at_block(block) {
			Some((digest_level, digest_interval, _)) if digest_level == config.digest_levels =>
				digest_interval,
			_ => return None,
		};

		// compute maximal number of high-level digests to keep
		let max_digest_intervals_to_keep = max_digest_intervals_to_keep(min_blocks_to_keep, max_digest_interval);

		// number of blocks BEFORE current block where changes tries are not pruned
		(
			max_digest_interval,
			max_digest_intervals_to_keep.checked_mul(max_digest_interval)
		)
	} else {
		(
			1,
			Some(min_blocks_to_keep)
		)
	};

	// last block for which changes trie is pruned
	let last_block_to_prune = blocks_to_keep.and_then(|b| block.checked_sub(b));
	let first_block_to_prune = last_block_to_prune.clone().and_then(|b| b.checked_sub(prune_interval));

	last_block_to_prune
		.and_then(|last| first_block_to_prune.map(|first| (first + 1, last)))
}
/// Select blocks range (inclusive from both ends) for pruning changes tries in.
Select blocks range (inclusive from both ends) for pruning changes tries in.
Select blocks range ( inclusive from both ends ) for pruning changes tries in .
fn pruning_range(config: &Configuration, min_blocks_to_keep: u64, block: u64) -> Option<(u64, u64)> {
	// compute number of changes tries we actually want to keep
	let (prune_interval, blocks_to_keep) = if config.is_digest_build_enabled() {
		// we only CAN prune at block where max-level-digest is created
		let max_digest_interval = match config.digest_level_at_block(block) {
			Some((digest_level, digest_interval, _)) if digest_level == config.digest_levels =>
				digest_interval,
			_ => return None,
		};
		// compute maximal number of high-level digests to keep
		let max_digest_intervals_to_keep = max_digest_intervals_to_keep(min_blocks_to_keep, max_digest_interval);
		// number of blocks BEFORE current block where changes tries are not pruned
		(
			max_digest_interval,
			max_digest_intervals_to_keep.checked_mul(max_digest_interval)
		)
	} else {
		(
			1,
			Some(min_blocks_to_keep)
		)
	};
	// last block for which changes trie is pruned
	let last_block_to_prune = blocks_to_keep.and_then(|b| block.checked_sub(b));
	let first_block_to_prune = last_block_to_prune.clone().and_then(|b| b.checked_sub(prune_interval));
	last_block_to_prune
		.and_then(|last| first_block_to_prune.map(|first| (first + 1, last)))
}
fn pruning_range ( config : & Configuration , min_blocks_to_keep : u64 , block : u64 ) -> Option < ( u64 , u64 ) > { // compute number of changes tries we actually want to keep let ( prune_interval , blocks_to_keep ) = if config . is_digest_build_enabled ( ) { // we only CAN prune at block where max-level-digest is created let max_digest_interval = match config . digest_level_at_block ( block ) { Some ( ( digest_level , digest_interval , _ ) ) if digest_level == config . digest_levels => digest_interval , _ => return None , } ; // compute maximal number of high-level digests to keep let max_digest_intervals_to_keep = max_digest_intervals_to_keep ( min_blocks_to_keep , max_digest_interval ) ; // number of blocks BEFORE current block where changes tries are not pruned ( max_digest_interval , max_digest_intervals_to_keep . checked_mul ( max_digest_interval ) ) } else { ( 1 , Some ( min_blocks_to_keep ) ) } ; // last block for which changes trie is pruned let last_block_to_prune = blocks_to_keep . and_then ( | b | block . checked_sub ( b ) ) ; let first_block_to_prune = last_block_to_prune . clone ( ) . and_then ( | b | b . checked_sub ( prune_interval ) ) ; last_block_to_prune . and_then ( | last | first_block_to_prune . map ( | first | ( first + 1 , last ) ) ) }
Select blocks range (inclusive from both ends) for pruning changes tries in.
Select blocks range ( inclusive from both ends ) for pruning changes tries in .
config
&Configuration
min_blocks_to_keep
u64
block
u64
config
&Configuration
min_blocks_to_keep
u64
block
u64