fix: take only custom args if not empty (node and proxy)

This commit is contained in:
Cyrix126 2024-10-09 04:59:36 +02:00
parent a5f26bd4f1
commit e1241b3e20
2 changed files with 16 additions and 17 deletions

View file

@ -56,14 +56,7 @@ impl Helper {
}
pub fn build_node_args(state: &crate::disk::state::Node) -> Vec<String> {
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")

View file

@ -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() {