Skip to content

Commit e51b3b0

Browse files
committed
feat: add use_test_genesis_chainstate option to node config
1 parent 39a1c9e commit e51b3b0

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

testnet/stacks-node/src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ impl Config {
421421
pox_sync_sample_secs: node
422422
.pox_sync_sample_secs
423423
.unwrap_or(default_node_config.pox_sync_sample_secs),
424+
use_test_genesis_chainstate: node.use_test_genesis_chainstate,
424425
};
425426
node_config.set_bootstrap_node(node.bootstrap_node);
426427
if let Some(deny_nodes) = node.deny_nodes {
@@ -913,6 +914,7 @@ pub struct NodeConfig {
913914
pub wait_time_for_microblocks: u64,
914915
pub prometheus_bind: Option<String>,
915916
pub pox_sync_sample_secs: u64,
917+
pub use_test_genesis_chainstate: Option<bool>,
916918
}
917919

918920
impl NodeConfig {
@@ -950,6 +952,7 @@ impl NodeConfig {
950952
wait_time_for_microblocks: 5000,
951953
prometheus_bind: None,
952954
pox_sync_sample_secs: 30,
955+
use_test_genesis_chainstate: None,
953956
}
954957
}
955958

@@ -1081,6 +1084,7 @@ pub struct NodeConfigFile {
10811084
pub wait_time_for_microblocks: Option<u64>,
10821085
pub prometheus_bind: Option<String>,
10831086
pub pox_sync_sample_secs: Option<u64>,
1087+
pub use_test_genesis_chainstate: Option<bool>,
10841088
}
10851089

10861090
#[derive(Clone, Deserialize, Default)]

testnet/stacks-node/src/node.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,13 @@ impl Node {
184184
pub fn new(config: Config, boot_block_exec: Box<dyn FnOnce(&mut ClarityTx) -> ()>) -> Self {
185185
let use_test_genesis_data = if config.burnchain.mode == "mocknet" {
186186
// When running in mocknet mode allow the small test genesis chainstate data to be enabled.
187+
// First check env var, then config file, then use default.
187188
if env::var("BLOCKSTACK_USE_TEST_GENESIS_CHAINSTATE") == Ok("1".to_string()) {
188189
true
190+
} else if let Some(use_test_genesis_chainstate) =
191+
config.node.use_test_genesis_chainstate
192+
{
193+
use_test_genesis_chainstate
189194
} else {
190195
USE_TEST_GENESIS_CHAINSTATE
191196
}

0 commit comments

Comments
 (0)