Skip to content

Commit

Permalink
Use ranges when checking percentage
Browse files Browse the repository at this point in the history
Signed-off-by: Jacinta Ferrant <[email protected]>
  • Loading branch information
jferrant committed Nov 14, 2024
1 parent 804b8b9 commit 21ed874
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stackslib/src/chainstate/nakamoto/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ impl NakamotoBlockBuilder {
.mempool_settings
.tenure_cost_limit_per_block_percentage
{
if percentage < 100 {
if (1..100).contains(&percentage) {
let mut remaining_limit = block_limit.clone();
let cost_so_far = tenure_tx.cost_so_far();
if remaining_limit.sub(&cost_so_far).is_ok() {
Expand Down
2 changes: 1 addition & 1 deletion testnet/stacks-node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2574,7 +2574,7 @@ impl MinerConfigFile {
let pre_nakamoto_mock_signing = mining_key.is_some();
let valid_tenure_cost_limit = self
.tenure_cost_limit_per_block_percentage
.map(|p| p <= 100 && p > 0)
.map(|p| (1..=100).contains(&p))
.unwrap_or(true);
if !valid_tenure_cost_limit {
return Err(
Expand Down

0 comments on commit 21ed874

Please sign in to comment.