Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion crates/malachite-cli/src/cmd/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,13 +694,14 @@ impl StartCmd {
let has_ipc_options = self.eth_socket.is_some() || self.execution_socket.is_some();
let has_rpc_options = self.eth_rpc_endpoint.is_some()
|| self.execution_endpoint.is_some()
|| self.execution_ws_endpoint.is_some()
|| self.execution_jwt.is_some();

if has_ipc_options && has_rpc_options {
return Err(eyre::eyre!(
"Conflicting options detected: Cannot specify both IPC and RPC options simultaneously.\n\
IPC options: --eth-socket, --execution-socket\n\
RPC options: --eth-rpc-endpoint, --execution-endpoint, --execution-jwt\n\
RPC options: --eth-rpc-endpoint, --execution-endpoint, --execution-ws-endpoint, --execution-jwt\n\
Please choose either IPC (for local communication) or RPC (for remote communication)."
));
}
Expand Down Expand Up @@ -940,6 +941,21 @@ mod tests {
assert!(err_msg.contains("Conflicting options detected"));
}

#[test]
fn validate_err_when_mixing_ipc_and_execution_ws_endpoint() {
let mut cmd = new_start_cmd();
cmd.eth_socket = Some("/tmp/reth.ipc".to_string());
cmd.execution_socket = Some("/tmp/reth-auth.ipc".to_string());
cmd.execution_ws_endpoint = Some(dummy_url());

let err = cmd
.validate()
.expect_err("--execution-ws-endpoint must conflict with IPC transport options");
let err_msg = err.to_string();
assert!(err_msg.contains("Conflicting options detected"));
assert!(err_msg.contains("--execution-ws-endpoint"));
}

#[test]
fn validate_err_with_another_mix_of_options() {
let mut cmd = new_start_cmd();
Expand Down