Skip to content

Commit 65bfe3a

Browse files
committed
Gate regtest configuration options to only the regtest network
1 parent 4e74444 commit 65bfe3a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

node-lib/src/runner.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub async fn setup(options: Options) -> Result<Node> {
214214
.await
215215
}
216216
Command::Regtest(ref regtest_options) => {
217-
let chain_config = regtest_chain_config(&regtest_options.chain_config)?;
217+
let chain_config = regtest_chain_config(&command, &regtest_options.chain_config)?;
218218
start(
219219
&options.config_path(*chain_config.chain_type()),
220220
&options.data_dir,
@@ -322,7 +322,14 @@ async fn start(
322322
})
323323
}
324324

325-
fn regtest_chain_config(options: &ChainConfigOptions) -> Result<ChainConfig> {
325+
fn regtest_chain_config(command: &Command, options: &ChainConfigOptions) -> Result<ChainConfig> {
326+
match command {
327+
Command::Regtest(_) => {}
328+
Command::Mainnet(_) | Command::Testnet(_) => {
329+
panic!("RegTest configuration options must only be used on RegTest")
330+
}
331+
};
332+
326333
let ChainConfigOptions {
327334
chain_max_future_block_time_offset,
328335
chain_version,

0 commit comments

Comments
 (0)