Skip to content

Commit 058dae0

Browse files
authored
Add requires --http when using vc subcommands --http-port (#7405)
Prevent running `lighthouse vc --http-port <PORT>` without `--http`. Issue: #7402 Added requires `--http` when using `lighthouse vc --http-port <PORT>`. Implemented a test code for this issue.
1 parent 3d92e36 commit 058dae0

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

lighthouse/tests/validator_client.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,14 @@ fn missing_unencrypted_http_transport_flag() {
317317
.with_config(|config| assert_eq!(config.http_api.listen_addr, addr));
318318
}
319319
#[test]
320+
#[should_panic]
321+
fn missing_http_http_port_flag() {
322+
CommandLineTest::new()
323+
.flag("http-port", Some("9090"))
324+
.run()
325+
.with_config(|config| assert_eq!(config.http_api.listen_port, 9090));
326+
}
327+
#[test]
320328
fn http_port_flag() {
321329
CommandLineTest::new()
322330
.flag("http", None)

validator_client/src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ pub struct ValidatorClient {
219219

220220
#[clap(
221221
long,
222+
requires = "http",
222223
value_name = "PORT",
223224
default_value_t = 5062,
224225
help = "Set the listen TCP port for the RESTful HTTP API server.",

0 commit comments

Comments
 (0)