Skip to content

Commit 99d9a80

Browse files
committed
Add an assert to account for a faulty test
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent f27e918 commit 99d9a80

File tree

1 file changed

+5
-0
lines changed
  • stackslib/src/chainstate/nakamoto

1 file changed

+5
-0
lines changed

stackslib/src/chainstate/nakamoto/miner.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,11 @@ impl NakamotoBlockBuilder {
536536
.mempool_settings
537537
.tenure_cost_limit_per_block_percentage
538538
{
539+
// Make sure we aren't actually going to multiply by 0 or attempt to increase the block limit.
540+
assert!(
541+
(1..100).contains(&percentage),
542+
"BUG: tenure_cost_limit_per_block_percentage must be between between 1 and 99."
543+
);
539544
let mut remaining_limit = block_limit.clone();
540545
let cost_so_far = tenure_tx.cost_so_far();
541546
if remaining_limit.sub(&cost_so_far).is_ok() {

0 commit comments

Comments
 (0)