Skip to content

Commit 62f5a6a

Browse files
committed
Do not enable pre nakamoto mock signing unless the miner key is set
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 3a85972 commit 62f5a6a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

testnet/stacks-node/src/config.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,10 @@ impl Config {
11681168
.validate()
11691169
.map_err(|e| format!("Atlas config error: {e}"))?;
11701170

1171+
if miner.mining_key.is_none() && miner.pre_nakamoto_mock_signing {
1172+
return Err("Cannot use pre_nakamoto_mock_signing without a mining_key".to_string());
1173+
}
1174+
11711175
Ok(Config {
11721176
config_path: config_file.__path,
11731177
node,
@@ -2384,7 +2388,7 @@ impl Default for MinerConfig {
23842388
max_reorg_depth: 3,
23852389
// TODO: update to a sane value based on stackerdb benchmarking
23862390
wait_on_signers: Duration::from_secs(200),
2387-
pre_nakamoto_mock_signing: true,
2391+
pre_nakamoto_mock_signing: false, // Should only default true if mining key is set
23882392
}
23892393
}
23902394
}
@@ -2739,6 +2743,12 @@ pub struct MinerConfigFile {
27392743

27402744
impl MinerConfigFile {
27412745
fn into_config_default(self, miner_default_config: MinerConfig) -> Result<MinerConfig, String> {
2746+
let mining_key = self
2747+
.mining_key
2748+
.as_ref()
2749+
.map(|x| Secp256k1PrivateKey::from_hex(x))
2750+
.transpose()?;
2751+
let pre_nakamoto_mock_signing = mining_key.is_some();
27422752
Ok(MinerConfig {
27432753
first_attempt_time_ms: self
27442754
.first_attempt_time_ms
@@ -2837,7 +2847,9 @@ impl MinerConfigFile {
28372847
.wait_on_signers_ms
28382848
.map(Duration::from_millis)
28392849
.unwrap_or(miner_default_config.wait_on_signers),
2840-
pre_nakamoto_mock_signing: self.pre_nakamoto_mock_signing.unwrap_or(true),
2850+
pre_nakamoto_mock_signing: self
2851+
.pre_nakamoto_mock_signing
2852+
.unwrap_or(pre_nakamoto_mock_signing), // Should only default true if mining key is set
28412853
})
28422854
}
28432855
}

0 commit comments

Comments
 (0)