Skip to content

Commit

Permalink
Relax a bit the BBT maximum attempts constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
tiram88 committed Sep 18, 2023
1 parent 403c6b0 commit 01c8f9c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions core/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ impl<const TR: u64> Stopwatch<TR> {
pub fn with_threshold(name: &'static str) -> Self {
Self { name, start: Instant::now() }
}

pub fn elapsed(&self) -> Duration {
self.start.elapsed()
}
}

impl<const TR: u64> Drop for Stopwatch<TR> {
Expand Down
16 changes: 11 additions & 5 deletions mining/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,25 @@ impl MiningManager {
let block_template = cache_lock.set_immutable_cached_template(block_template);
match attempts {
1 => {
debug!("Built a new block template with {} transactions", block_template.block.transactions.len());
debug!(
"Built a new block template with {} transactions in {:#?}",
block_template.block.transactions.len(),
_swo.elapsed()
);
}
2 => {
debug!(
"Built a new block template with {} transactions at second attempt",
block_template.block.transactions.len()
"Built a new block template with {} transactions at second attempt in {:#?}",
block_template.block.transactions.len(),
_swo.elapsed()
);
}
n => {
debug!(
"Built a new block template with {} transactions in {} attempts",
"Built a new block template with {} transactions in {} attempts totaling {:#?}",
block_template.block.transactions.len(),
n
n,
_swo.elapsed()
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion mining/src/mempool/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use kaspa_consensus_core::constants::TX_VERSION;

pub(crate) const DEFAULT_MAXIMUM_TRANSACTION_COUNT: u64 = 1_000_000;
pub(crate) const DEFAULT_MAXIMUM_READY_TRANSACTION_COUNT: u64 = 100_000;
pub(crate) const DEFAULT_MAXIMUM_BUILD_BLOCK_TEMPLATE_ATTEMPTS: u64 = 3;
pub(crate) const DEFAULT_MAXIMUM_BUILD_BLOCK_TEMPLATE_ATTEMPTS: u64 = 5;
// TODO: revisit this value
pub(crate) const DEFAULT_READY_TRANSACTIONS_REFETCH_LIMIT: usize = 2_500;

Expand Down

0 comments on commit 01c8f9c

Please sign in to comment.