diff --git a/testnet/stacks-node/src/config.rs b/testnet/stacks-node/src/config.rs index 2d55aa479dd..18097490396 100644 --- a/testnet/stacks-node/src/config.rs +++ b/testnet/stacks-node/src/config.rs @@ -1661,6 +1661,7 @@ pub struct NodeConfig { pub max_microblocks: u64, pub wait_time_for_microblocks: u64, pub wait_time_for_blocks: u64, + pub next_initiative_delay: u64, pub prometheus_bind: Option, pub marf_cache_strategy: Option, pub marf_defer_hashing: bool, @@ -1946,6 +1947,7 @@ impl Default for NodeConfig { max_microblocks: u16::MAX as u64, wait_time_for_microblocks: 30_000, wait_time_for_blocks: 30_000, + next_initiative_delay: 10_000, prometheus_bind: None, marf_cache_strategy: None, marf_defer_hashing: true, @@ -2393,6 +2395,7 @@ pub struct NodeConfigFile { pub max_microblocks: Option, pub wait_time_for_microblocks: Option, pub wait_time_for_blocks: Option, + pub next_initiative_delay: Option, pub prometheus_bind: Option, pub marf_cache_strategy: Option, pub marf_defer_hashing: Option, @@ -2453,6 +2456,9 @@ impl NodeConfigFile { wait_time_for_blocks: self .wait_time_for_blocks .unwrap_or(default_node_config.wait_time_for_blocks), + next_initiative_delay: self + .next_initiative_delay + .unwrap_or(default_node_config.next_initiative_delay), prometheus_bind: self.prometheus_bind, marf_cache_strategy: self.marf_cache_strategy, marf_defer_hashing: self diff --git a/testnet/stacks-node/src/nakamoto_node/relayer.rs b/testnet/stacks-node/src/nakamoto_node/relayer.rs index 20609db9af0..66f72049a20 100644 --- a/testnet/stacks-node/src/nakamoto_node/relayer.rs +++ b/testnet/stacks-node/src/nakamoto_node/relayer.rs @@ -185,8 +185,10 @@ impl RelayerThread { let bitcoin_controller = BitcoinRegtestController::new_dummy(config.clone()); + let next_initiative_delay = config.node.next_initiative_delay; + RelayerThread { - config: config, + config, sortdb, chainstate, mempool, @@ -210,7 +212,7 @@ impl RelayerThread { miner_thread: None, is_miner, - next_initiative: Instant::now() + Duration::from_secs(4), + next_initiative: Instant::now() + Duration::from_millis(next_initiative_delay), last_committed: None, } } @@ -804,10 +806,12 @@ impl RelayerThread { pub fn main(mut self, relay_rcv: Receiver) { debug!("relayer thread ID is {:?}", std::thread::current().id()); - self.next_initiative = Instant::now() + Duration::from_secs(4); + self.next_initiative = + Instant::now() + Duration::from_millis(self.config.node.next_initiative_delay); while self.globals.keep_running() { let directive = if Instant::now() >= self.next_initiative { - self.next_initiative = Instant::now() + Duration::from_secs(4); + self.next_initiative = + Instant::now() + Duration::from_millis(self.config.node.next_initiative_delay); self.initiative() } else { None