From e1241b3e20706c61db3fd5b152a89f779f5b791f Mon Sep 17 00:00:00 2001 From: Cyrix126 Date: Wed, 9 Oct 2024 04:59:36 +0200 Subject: [PATCH] fix: take only custom args if not empty (node and proxy) --- src/helper/node.rs | 16 ++++++++-------- src/helper/xrig/xmrig_proxy.rs | 17 ++++++++--------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/helper/node.rs b/src/helper/node.rs index 3190b22..50d5ffc 100644 --- a/src/helper/node.rs +++ b/src/helper/node.rs @@ -56,14 +56,7 @@ impl Helper { } pub fn build_node_args(state: &crate::disk::state::Node) -> Vec { let mut args = Vec::with_capacity(500); - if !state.arguments.is_empty() && !state.simple { - // This parses the input - // todo: set the state if user change port and token - for arg in state.arguments.split_whitespace() { - let arg = if arg == "localhost" { "127.0.0.1" } else { arg }; - args.push(arg.to_string()); - } - } + if !state.arguments.is_empty() && !state.simple {} // [Simple] if state.simple { @@ -84,6 +77,13 @@ impl Helper { args.push("--prune-blockchain".to_string()); // [Advanced] + } else if !state.arguments.is_empty() { + // This parses the input + // todo: set the state if user change port and token + for arg in state.arguments.split_whitespace() { + let arg = if arg == "localhost" { "127.0.0.1" } else { arg }; + args.push(arg.to_string()); + } } else { let dir = if state.path_db.is_empty() { String::from(".bitmonero") diff --git a/src/helper/xrig/xmrig_proxy.rs b/src/helper/xrig/xmrig_proxy.rs index 41eea8b..8ce4e7d 100644 --- a/src/helper/xrig/xmrig_proxy.rs +++ b/src/helper/xrig/xmrig_proxy.rs @@ -112,15 +112,6 @@ impl Helper { let api_port; let ip; let port; - // custom args from user input - if !state.arguments.is_empty() && !state.simple { - // This parses the input - // todo: set the state if user change port and token - for arg in state.arguments.split_whitespace() { - let arg = if arg == "localhost" { "127.0.0.1" } else { arg }; - args.push(arg.to_string()); - } - } // [Simple] if state.simple { // Build the xmrig argument @@ -143,6 +134,14 @@ impl Helper { lock2!(helper, pub_api_xp).node = "127.0.0.1:3333 (Local P2Pool)".to_string(); // [Advanced] + } else if !state.arguments.is_empty() { + // custom args from user input + // This parses the input + // todo: set the state if user change port and token + for arg in state.arguments.split_whitespace() { + let arg = if arg == "localhost" { "127.0.0.1" } else { arg }; + args.push(arg.to_string()); + } } else { // XMRig doesn't understand [localhost] let p2pool_ip = if state.p2pool_ip == "localhost" || state.p2pool_ip.is_empty() {