Skip to content

Commit f23ffb6

Browse files
committed
Add a block_proposal_validation_timeout_ms config option
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 96d3f78 commit f23ffb6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

stacks-signer/src/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::client::SignerSlotID;
3535

3636
const EVENT_TIMEOUT_MS: u64 = 5000;
3737
const BLOCK_PROPOSAL_TIMEOUT_MS: u64 = 600_000;
38+
const BLOCK_PROPOSAL_VALIDATION_TIMEOUT_MS: u64 = 120_000;
3839
const DEFAULT_FIRST_PROPOSAL_BURN_BLOCK_TIMING_SECS: u64 = 60;
3940

4041
#[derive(thiserror::Error, Debug)]
@@ -158,6 +159,9 @@ pub struct GlobalConfig {
158159
pub block_proposal_timeout: Duration,
159160
/// An optional custom Chain ID
160161
pub chain_id: Option<u32>,
162+
/// How long to wait for a response from a block proposal validation response from the node
163+
/// before marking that block as invalid and rejecting it
164+
pub block_proposal_validation_timeout: Duration,
161165
}
162166

163167
/// Internal struct for loading up the config file
@@ -187,6 +191,9 @@ struct RawConfigFile {
187191
pub block_proposal_timeout_ms: Option<u64>,
188192
/// An optional custom Chain ID
189193
pub chain_id: Option<u32>,
194+
/// How long to wait for a response from a block proposal validation response from the node
195+
/// before marking that block as invalid and rejecting it in milliseconds.
196+
pub block_proposal_validation_timeout_ms: Option<u64>,
190197
}
191198

192199
impl RawConfigFile {
@@ -266,6 +273,11 @@ impl TryFrom<RawConfigFile> for GlobalConfig {
266273
.unwrap_or(BLOCK_PROPOSAL_TIMEOUT_MS),
267274
);
268275

276+
let block_proposal_validation_timeout = Duration::from_millis(
277+
raw_data
278+
.block_proposal_validation_timeout_ms
279+
.unwrap_or(BLOCK_PROPOSAL_VALIDATION_TIMEOUT_MS),
280+
);
269281
Ok(Self {
270282
node_host: raw_data.node_host,
271283
endpoint,
@@ -279,6 +291,7 @@ impl TryFrom<RawConfigFile> for GlobalConfig {
279291
first_proposal_burn_block_timing,
280292
block_proposal_timeout,
281293
chain_id: raw_data.chain_id,
294+
block_proposal_validation_timeout,
282295
})
283296
}
284297
}

0 commit comments

Comments
 (0)