Skip to content

Commit f27e918

Browse files
committed
CRC: cleanup
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 95ca231 commit f27e918

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

stackslib/src/chainstate/nakamoto/miner.rs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -536,25 +536,23 @@ impl NakamotoBlockBuilder {
536536
.mempool_settings
537537
.tenure_cost_limit_per_block_percentage
538538
{
539-
if (1..100).contains(&percentage) {
540-
let mut remaining_limit = block_limit.clone();
541-
let cost_so_far = tenure_tx.cost_so_far();
542-
if remaining_limit.sub(&cost_so_far).is_ok() {
543-
if remaining_limit.divide(100).is_ok() {
544-
remaining_limit.multiply(percentage.into()).expect(
545-
"BUG: failed to multiply by {percentage} when previously divided by 100",
546-
);
547-
remaining_limit.add(&cost_so_far).expect("BUG: unexpected overflow when adding cost_so_far, which was previously checked");
548-
debug!(
549-
"Setting soft limit for clarity cost to {percentage}% of remaining block limit";
550-
"remaining_limit" => %remaining_limit,
551-
"cost_so_far" => %cost_so_far,
552-
"block_limit" => %block_limit,
553-
);
554-
soft_limit = Some(remaining_limit);
555-
}
556-
};
557-
}
539+
let mut remaining_limit = block_limit.clone();
540+
let cost_so_far = tenure_tx.cost_so_far();
541+
if remaining_limit.sub(&cost_so_far).is_ok() {
542+
if remaining_limit.divide(100).is_ok() {
543+
remaining_limit.multiply(percentage.into()).expect(
544+
"BUG: failed to multiply by {percentage} when previously divided by 100",
545+
);
546+
remaining_limit.add(&cost_so_far).expect("BUG: unexpected overflow when adding cost_so_far, which was previously checked");
547+
debug!(
548+
"Setting soft limit for clarity cost to {percentage}% of remaining block limit";
549+
"remaining_limit" => %remaining_limit,
550+
"cost_so_far" => %cost_so_far,
551+
"block_limit" => %block_limit,
552+
);
553+
soft_limit = Some(remaining_limit);
554+
}
555+
};
558556
}
559557

560558
builder.soft_limit = soft_limit;

testnet/stacks-node/src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,9 @@ impl MinerConfigFile {
25752575

25762576
let tenure_cost_limit_per_block_percentage =
25772577
if let Some(percentage) = self.tenure_cost_limit_per_block_percentage {
2578-
if (1..=100).contains(&percentage) {
2578+
if percentage == 100 {
2579+
None
2580+
} else if percentage > 0 && percentage < 100 {
25792581
Some(percentage)
25802582
} else {
25812583
return Err(

0 commit comments

Comments
 (0)