Skip to content

Commit

Permalink
fix: style
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Dec 19, 2024
1 parent 0b0b821 commit 635cfe3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
15 changes: 3 additions & 12 deletions stackslib/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2676,18 +2676,9 @@ impl MinerConfigFile {
activated_vrf_key_path: self.activated_vrf_key_path.clone(),
fast_rampup: self.fast_rampup.unwrap_or(miner_default_config.fast_rampup),
underperform_stop_threshold: self.underperform_stop_threshold,
mempool_walk_strategy: {
if let Some(mempool_walk_strategy) = &self.mempool_walk_strategy {
match str::parse(&mempool_walk_strategy) {
Ok(strategy) => strategy,
Err(e) => {
panic!("could not parse '{mempool_walk_strategy}': {e}");
},
}
} else {
MemPoolWalkStrategy::GlobalFeeRate
}
},
mempool_walk_strategy: self.mempool_walk_strategy
.map(|s| str::parse(&s).unwrap_or_else(|e| panic!("Could not parse '{s}': {e}")))
.unwrap_or(MemPoolWalkStrategy::GlobalFeeRate),
txs_to_consider: {
if let Some(txs_to_consider) = &self.txs_to_consider {
txs_to_consider
Expand Down
27 changes: 6 additions & 21 deletions stackslib/src/core/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1717,10 +1717,7 @@ impl MemPoolDB {
FROM mempool
WHERE fee_rate IS NULL
";
let mut query_stmt_null = self
.db
.prepare(&sql)
.map_err(Error::SqliteError)?;
let mut query_stmt_null = self.db.prepare(&sql).map_err(Error::SqliteError)?;
let mut null_iterator = query_stmt_null
.query(NO_PARAMS)
.map_err(Error::SqliteError)?;
Expand All @@ -1730,10 +1727,7 @@ impl MemPoolDB {
WHERE fee_rate IS NOT NULL
ORDER BY fee_rate DESC
";
let mut query_stmt_fee = self
.db
.prepare(&sql)
.map_err(Error::SqliteError)?;
let mut query_stmt_fee = self.db.prepare(&sql).map_err(Error::SqliteError)?;
let mut fee_iterator = query_stmt_fee
.query(NO_PARAMS)
.map_err(Error::SqliteError)?;
Expand Down Expand Up @@ -1786,10 +1780,7 @@ impl MemPoolDB {
ORDER BY origin_rank ASC, sponsor_rank ASC, sort_fee_rate DESC
LIMIT 1
";
let mut query_stmt_nonce_rank = self
.db
.prepare(&sql)
.map_err(Error::SqliteError)?;
let mut query_stmt_nonce_rank = self.db.prepare(&sql).map_err(Error::SqliteError)?;

let stop_reason = loop {
if start_time.elapsed().as_millis() > settings.max_walk_time_ms as u128 {
Expand All @@ -1812,9 +1803,7 @@ impl MemPoolDB {
< settings.consider_no_estimate_tx_prob;
// randomly select from either the null fee-rate transactions or those with fee-rate estimates.
let opt_tx = if start_with_no_estimate {
null_iterator
.next()
.map_err(Error::SqliteError)?
null_iterator.next().map_err(Error::SqliteError)?
} else {
fee_iterator.next().map_err(Error::SqliteError)?
};
Expand All @@ -1825,13 +1814,9 @@ impl MemPoolDB {
None => {
// If the selected iterator is empty, check the other
match if start_with_no_estimate {
fee_iterator
.next()
.map_err(Error::SqliteError)?
fee_iterator.next().map_err(Error::SqliteError)?
} else {
null_iterator
.next()
.map_err(Error::SqliteError)?
null_iterator.next().map_err(Error::SqliteError)?
} {
Some(row) => (
MemPoolTxInfoPartial::from_row(row)?,
Expand Down

0 comments on commit 635cfe3

Please sign in to comment.