diff --git a/Cargo.lock b/Cargo.lock index fa42541..e1b47ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2497,9 +2497,9 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "7.1.1" +version = "7.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c" dependencies = [ "memchr", "minimal-lexical", diff --git a/src/constants.rs b/src/constants.rs index 2d7056b..adf66c0 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -174,7 +174,6 @@ pub const STATUS_XMRIG_THREADS: &str = "The amount of threads XMRig is curre // Status Submenus pub const STATUS_SUBMENU_PROCESSES: &str = "View the status of process related data for [Gupax|P2Pool|XMRig]"; pub const STATUS_SUBMENU_P2POOL: &str = "View P2Pool specific data"; -pub const STATUS_SUBMENU_MONERO: &str = "View general Monero blockchain data"; //-- P2Pool pub const STATUS_SUBMENU_PAYOUT: &str = "The total amount of payouts received via P2Pool across all time. This includes all payouts you have ever received using Gupax and P2Pool."; pub const STATUS_SUBMENU_XMR: &str = "The total of XMR mined via P2Pool across all time. This includes all the XMR you have ever mined using Gupax and P2Pool."; @@ -316,6 +315,7 @@ pub const XMRIG_NAME: &str = "Add a unique name to identify this pool; pub const XMRIG_IP: &str = "Specify the pool IP to connect to with XMRig; It must be a valid IPv4 address or a valid domain name; Max length = 255 characters"; pub const XMRIG_PORT: &str = "Specify the port of the pool; [1-65535]"; pub const XMRIG_RIG: &str = "Add an optional rig ID. This will be the name shown on the pool; Only [A-Za-z0-9-_] and spaces allowed; Max length = 30 characters"; +#[cfg(not(target_os = "linux"))] pub const XMRIG_PAUSE: &str = "THIS SETTING IS DISABLED IF SET TO [0]. Pause mining if user is active, resume after"; pub const XMRIG_API_IP: &str = "Specify which IP to bind to for XMRig's HTTP API; If empty: [localhost/127.0.0.1]"; pub const XMRIG_API_PORT: &str = "Specify which port to bind to for XMRig's HTTP API; If empty: [18088]"; diff --git a/src/disk.rs b/src/disk.rs index 70ff0e8..3ca3d98 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -48,7 +48,6 @@ use crate::{ Tab, xmr::*, macros::*, - P2poolRegex, }; use log::*; #[cfg(target_family = "unix")] @@ -167,7 +166,7 @@ pub fn create_gupax_dir(path: &PathBuf) -> Result<(), TomlError> { Ok(_) => info!("OS | Create data path ... OK"), Err(e) => { error!("OS | Create data path ... FAIL ... {}", e); return Err(TomlError::Io(e)) }, } - set_unix_750_perms(&path) + set_unix_750_perms(path) } pub fn create_gupax_p2pool_dir(path: &PathBuf) -> Result<(), TomlError> { @@ -199,13 +198,6 @@ pub fn print_dash(toml: &str) { info!("{}", HORIZONTAL); } -// Write str to console with [debug!] surrounded by "---" -pub fn print_dash_debug(toml: &str) { - info!("{}", HORIZONTAL); - for i in toml.lines() { debug!("{}", i); } - info!("{}", HORIZONTAL); -} - // Turn relative paths into absolute paths pub fn into_absolute_path(path: String) -> Result { let path = PathBuf::from(path); @@ -689,7 +681,7 @@ impl GupaxP2poolApi { let mut log_rev = String::with_capacity(self.log.len()); for line in self.log.lines().rev() { log_rev.push_str(line); - log_rev.push_str("\n"); + log_rev.push('\n'); } self.log_rev = log_rev; } @@ -700,7 +692,7 @@ impl GupaxP2poolApi { pub fn append_log(&mut self, formatted_log_line: &str) { self.log.push_str(formatted_log_line); - self.log.push_str("\n"); + self.log.push('\n'); } pub fn append_head_log_rev(&mut self, formatted_log_line: &str) { @@ -836,7 +828,7 @@ impl Display for Submenu { use Submenu::*; match self { P2pool => write!(f, "P2Pool"), - _ => write!(f, "{}", self), + _ => write!(f, "{:?}", self), } } } @@ -865,7 +857,7 @@ impl Default for PayoutView { impl Display for PayoutView { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - write!(f, "{}", self) + write!(f, "{:?}", self) } } @@ -935,8 +927,8 @@ impl Hash { impl Display for Hash { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - Hash::Hash => write!(f, "{}", self), - _ => write!(f, "{}hash", self), + Hash::Hash => write!(f, "Hash"), + _ => write!(f, "{:?}hash", self), } } } diff --git a/src/gupax.rs b/src/gupax.rs index f108877..1bf1c74 100644 --- a/src/gupax.rs +++ b/src/gupax.rs @@ -27,7 +27,6 @@ use egui::{ }; use crate::{ constants::*, - disk::Gupax, update::*, ErrorState, Restart, diff --git a/src/helper.rs b/src/helper.rs index db02343..d814779 100644 --- a/src/helper.rs +++ b/src/helper.rs @@ -81,11 +81,7 @@ pub struct Helper { pub img_xmrig: Arc>, // A static "image" of the data XMRig started with pub_api_p2pool: Arc>, // P2Pool API state (for Helper/P2Pool thread) pub_api_xmrig: Arc>, // XMRig API state (for Helper/XMRig thread) - pub gupax_p2pool_api: Arc>, // - priv_api_p2pool_local: Arc>, // Serde struct(s) for P2Pool's API files - priv_api_p2pool_network: Arc>, - priv_api_p2pool_pool: Arc>, - priv_api_xmrig: Arc>, // Serde struct for XMRig's HTTP API + pub gupax_p2pool_api: Arc>, // } // The communication between the data here and the GUI thread goes as follows: @@ -237,10 +233,6 @@ impl Helper { instant, pub_sys, uptime: HumanTime::into_human(instant.elapsed()), - priv_api_p2pool_local: arc_mut!(PrivP2poolLocalApi::new()), - priv_api_p2pool_network: arc_mut!(PrivP2poolNetworkApi::new()), - priv_api_p2pool_pool: arc_mut!(PrivP2poolPoolApi::new()), - priv_api_xmrig: arc_mut!(PrivXmrigApi::new()), pub_api_p2pool: arc_mut!(PubP2poolApi::new()), pub_api_xmrig: arc_mut!(PubXmrigApi::new()), // These are created when initializing [App], since it needs a handle to it as well @@ -254,7 +246,7 @@ impl Helper { } } - fn read_pty_xmrig(output_parse: Arc>, output_pub: Arc>, reader: Box) { + fn read_pty_xmrig(_output_parse: Arc>, output_pub: Arc>, reader: Box) { use std::io::BufRead; let mut stdout = std::io::BufReader::new(reader).lines(); // We don't need to write twice for XMRig, since we dont parse it... yet. @@ -740,10 +732,9 @@ impl Helper { let process = Arc::clone(&lock!(helper).xmrig); let gui_api = Arc::clone(&lock!(helper).gui_api_xmrig); let pub_api = Arc::clone(&lock!(helper).pub_api_xmrig); - let priv_api = Arc::clone(&lock!(helper).priv_api_xmrig); let path = path.clone(); thread::spawn(move || { - Self::spawn_xmrig_watchdog(process, gui_api, pub_api, priv_api, args, path, sudo, api_ip_port); + Self::spawn_xmrig_watchdog(process, gui_api, pub_api, args, path, sudo, api_ip_port); }); } @@ -849,7 +840,7 @@ impl Helper { // The XMRig watchdog. Spawns 1 OS thread for reading a PTY (STDOUT+STDERR), and combines the [Child] with a PTY so STDIN actually works. // This isn't actually async, a tokio runtime is unfortunately needed because [Hyper] is an async library (HTTP API calls) #[tokio::main] - async fn spawn_xmrig_watchdog(process: Arc>, gui_api: Arc>, pub_api: Arc>, _priv_api: Arc>, args: Vec, path: std::path::PathBuf, sudo: Arc>, mut api_ip_port: String) { + async fn spawn_xmrig_watchdog(process: Arc>, gui_api: Arc>, pub_api: Arc>, args: Vec, path: std::path::PathBuf, sudo: Arc>, mut api_ip_port: String) { // 1a. Create PTY debug!("XMRig | Creating PTY..."); let pty = portable_pty::native_pty_system(); @@ -1977,9 +1968,9 @@ mod test { assert_eq!(p.solo_block_mean.to_string(), "5 months, 21 days, 9 hours, 52 minutes"); assert_eq!(p.p2pool_block_mean.to_string(), "3 days, 11 hours, 20 minutes"); assert_eq!(p.p2pool_share_mean.to_string(), "8 minutes, 20 seconds"); - assert_eq!(p.p2pool_percent.to_string(), "0.04%"); - assert_eq!(p.user_p2pool_percent.to_string(), "2%"); - assert_eq!(p.user_monero_percent.to_string(), "0.0008%"); + assert_eq!(p.p2pool_percent.to_string(), "0.040000%"); + assert_eq!(p.user_p2pool_percent.to_string(), "2.000000%"); + assert_eq!(p.user_monero_percent.to_string(), "0.000800%"); drop(p); } diff --git a/src/main.rs b/src/main.rs index 7bd0d23..1127de9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1685,10 +1685,10 @@ XMRig console byte length: {}\n P2POOL_VERSION, XMRIG_VERSION, self.now.elapsed().as_secs_f32(), - self.state.gupax.selected_width as u16, - self.state.gupax.selected_height as u16, - self.width as u16, - self.height as u16, + self.state.gupax.selected_width, + self.state.gupax.selected_height, + self.width, + self.height, OS_NAME, self.max_threads, self.pid, diff --git a/src/status.rs b/src/status.rs index 7a6b949..7e2e43a 100644 --- a/src/status.rs +++ b/src/status.rs @@ -133,7 +133,7 @@ pub fn show(&mut self, sys: &Arc>, p2pool_api: &Arc>, p2pool_api: &Arc>, p2pool_api: &Arc