Skip to content

Commit 535cef0

Browse files
authored
Merge pull request #6013 from obycode/block_rejection_timeout_steps
feat: reduce default `block_rejection_timeout_steps`
2 parents d50e407 + efa19d4 commit 535cef0

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the versioning scheme outlined in the [README.md](README.md).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Reduce the default `block_rejection_timeout_steps` configuration so that miners will retry faster when blocks fail to reach 70% approved or 30% rejected.
13+
814
## [3.1.0.0.8]
915

1016
### Added

stackslib/src/config/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,9 +2244,9 @@ impl Default for MinerConfig {
22442244

22452245
block_rejection_timeout_steps: {
22462246
let mut rejections_timeouts_default_map = HashMap::<u32, Duration>::new();
2247-
rejections_timeouts_default_map.insert(0, Duration::from_secs(600));
2248-
rejections_timeouts_default_map.insert(10, Duration::from_secs(300));
2249-
rejections_timeouts_default_map.insert(20, Duration::from_secs(150));
2247+
rejections_timeouts_default_map.insert(0, Duration::from_secs(180));
2248+
rejections_timeouts_default_map.insert(10, Duration::from_secs(90));
2249+
rejections_timeouts_default_map.insert(20, Duration::from_secs(45));
22502250
rejections_timeouts_default_map.insert(30, Duration::from_secs(0));
22512251
rejections_timeouts_default_map
22522252
},
@@ -2835,6 +2835,7 @@ impl MinerConfigFile {
28352835
})
28362836
}
28372837
}
2838+
28382839
#[derive(Clone, Deserialize, Default, Debug)]
28392840
#[serde(deny_unknown_fields)]
28402841
pub struct AtlasConfigFile {

testnet/stacks-node/src/nakamoto_node/miner.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,16 @@ impl BlockMinerThread {
704704
)?
705705
.ok_or_else(|| NakamotoNodeError::UnexpectedChainState)?;
706706

707-
if processed {
707+
// Once the block has been processed and the miner is no longer
708+
// blocked, we can continue mining.
709+
if processed
710+
&& !(*self
711+
.globals
712+
.get_miner_status()
713+
.lock()
714+
.expect("FATAL: mutex poisoned"))
715+
.is_blocked()
716+
{
708717
break;
709718
}
710719

testnet/stacks-node/src/tests/signer/v0.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12115,8 +12115,20 @@ fn repeated_rejection() {
1211512115
let send_amt = 100;
1211612116
let send_fee = 180;
1211712117
let recipient = PrincipalData::from(StacksAddress::burn_address(false));
12118-
let mut signer_test: SignerTest<SpawnedSigner> =
12119-
SignerTest::new(num_signers, vec![(sender_addr, (send_amt + send_fee) * 3)]);
12118+
let mut signer_test: SignerTest<SpawnedSigner> = SignerTest::new_with_config_modifications(
12119+
num_signers,
12120+
vec![(sender_addr, (send_amt + send_fee) * 3)],
12121+
|_| {},
12122+
|config| {
12123+
config.miner.block_rejection_timeout_steps.clear();
12124+
config
12125+
.miner
12126+
.block_rejection_timeout_steps
12127+
.insert(0, Duration::from_secs(120));
12128+
},
12129+
None,
12130+
None,
12131+
);
1212012132
let http_origin = format!("http://{}", &signer_test.running_nodes.conf.node.rpc_bind);
1212112133
signer_test.boot_to_epoch_3();
1212212134

0 commit comments

Comments
 (0)