diff --git a/CHANGELOG.md b/CHANGELOG.md index 87f2349..4023d32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# v0.1.4 +Fix release for beta version. +This version is only made for testing purposes and have feedbacks. + +## Changes +new logo +algorithm wait for xmrig first value, takes 10s value at first start, 1m value at second start, 15m value at third start. + +## Fixes +fix detection of p2pool eHR +fix private round type stats +fix name gupax tab to gupaxx + +## Bundled Versions +* [`P2Pool v3.10`](https://github.com/SChernykh/p2pool/releases/tag/v3.10) +* [`XMRig v6.21.1`](https://github.com/xmrig/xmrig/releases/tag/v6.21.1) + # v0.1.3 Fix release for beta version. This version is only made for testing purposes and have feedbacks. diff --git a/Cargo.lock b/Cargo.lock index ae3c70e..b5ace80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2064,7 +2064,7 @@ dependencies = [ [[package]] name = "gupaxx" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "benri", @@ -2549,7 +2549,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.52.4", + "windows-targets 0.48.5", ] [[package]] @@ -2649,9 +2649,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap2" diff --git a/Cargo.toml b/Cargo.toml index 136142d..0543f23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ cargo-features = ["profile-rustflags"] [package] name = "gupaxx" -version = "0.1.3" +version = "0.1.4" authors = ["cyrix126 "] description = "Fork of Gupax integrating the XMRvsBeast Raffle " documentation = "https://github.com/cyrix126/gupaxx" @@ -68,7 +68,7 @@ rand = "0.8.5" regex = { version = "1.10.4", default-features = false, features = ["perf"] } rfd = "0.14.1" serde = { version = "1.0.197", features = ["rc", "derive"] } -serde_json = "1.0.114" +serde_json = "1.0.115" sysinfo = { version = "0.30.7", default-features = false } # tls-api = "0.9.0" tokio = { version = "1.36.0", features = ["rt", "time", "macros", "process", "rt-multi-thread"] } @@ -80,7 +80,7 @@ strip-ansi-escapes = "0.2.0" derive_more = {version="0.99.17", default-features=false, features=["display"]} serde-this-or-that = "0.4.2" readable = "0.16" -chrono = {version="0.4.35", default-features=false, features=["clock", "std"]} +chrono = {version="0.4.37", default-features=false, features=["clock", "std"]} # Unix dependencies [target.'cfg(unix)'.dependencies] eframe = { version = "0.26.2", features = ["wgpu"] } diff --git a/assets/images/banner.png b/assets/images/banner.png index aa8870e..bc2a98d 100644 Binary files a/assets/images/banner.png and b/assets/images/banner.png differ diff --git a/src/app/panels/top.rs b/src/app/panels/top.rs index 24832d4..68de4e7 100644 --- a/src/app/panels/top.rs +++ b/src/app/panels/top.rs @@ -36,7 +36,7 @@ impl crate::app::App { if ui .add_sized( [width, height], - SelectableLabel::new(self.tab == Tab::Gupax, "Gupax"), + SelectableLabel::new(self.tab == Tab::Gupax, "Gupaxx"), ) .clicked() { diff --git a/src/helper/p2pool.rs b/src/helper/p2pool.rs index 12e697e..4eaf528 100644 --- a/src/helper/p2pool.rs +++ b/src/helper/p2pool.rs @@ -72,10 +72,10 @@ impl Helper { if contains_yourhashrate(&line) { if let Some(ehr) = estimated_hr(&line) { debug!( - "P2pool | PTY getting current estimated HR data from status: {} share", + "P2pool | PTY getting current estimated HR data from status: {} KH/s", ehr ); - lock!(gui_api).sidechain_ehr = ehr; + lock!(gui_api).sidechain_ehr = ehr * 1000.0; } else { error!("P2pool | PTY Getting data from status: Lines contains Your shares but no value found: {}", line); } @@ -895,6 +895,7 @@ impl PubP2poolApi { tick: std::mem::take(&mut gui_api.tick), tick_status: std::mem::take(&mut gui_api.tick_status), sidechain_shares: std::mem::take(&mut gui_api.sidechain_shares), + sidechain_ehr: std::mem::take(&mut gui_api.sidechain_ehr), ..pub_api.clone() }; } diff --git a/src/helper/xmrig.rs b/src/helper/xmrig.rs index 6f91aac..cd9418b 100644 --- a/src/helper/xmrig.rs +++ b/src/helper/xmrig.rs @@ -683,6 +683,7 @@ pub struct PubXmrigApi { pub accepted: String, pub rejected: String, pub hashrate_raw: f32, + pub hashrate_raw_1m: f32, pub hashrate_raw_15m: f32, pub node: String, } @@ -705,6 +706,7 @@ impl PubXmrigApi { accepted: UNKNOWN_DATA.to_string(), rejected: UNKNOWN_DATA.to_string(), hashrate_raw: 0.0, + hashrate_raw_1m: 0.0, hashrate_raw_15m: 0.0, node: UNKNOWN_DATA.to_string(), } @@ -766,6 +768,10 @@ impl PubXmrigApi { Some(Some(h)) => *h, _ => 0.0, }; + let hashrate_raw_1m = match private.hashrate.total.iter().nth(1) { + Some(Some(h)) => *h, + _ => 0.0, + }; let hashrate_raw_15m = match private.hashrate.total.last() { Some(Some(h)) => *h, _ => 0.0, @@ -779,6 +785,7 @@ impl PubXmrigApi { accepted: Unsigned::from(private.connection.accepted as usize).to_string(), rejected: Unsigned::from(private.connection.rejected as usize).to_string(), hashrate_raw, + hashrate_raw_1m, hashrate_raw_15m, ..std::mem::take(&mut *public) } diff --git a/src/helper/xvb.rs b/src/helper/xvb.rs index c52496d..c4e545b 100644 --- a/src/helper/xvb.rs +++ b/src/helper/xvb.rs @@ -5,6 +5,7 @@ use hyper::client::HttpConnector; use hyper::{Client, Request, StatusCode}; use hyper_tls::HttpsConnector; use log::{debug, error, info, warn}; +use readable::num::Float; use readable::up::Uptime; use serde::Deserialize; use std::collections::VecDeque; @@ -196,6 +197,7 @@ impl Helper { let mut last_algorithm = tokio::time::Instant::now(); let mut last_request = tokio::time::Instant::now(); let mut first_loop = true; + let mut second_loop = false; info!("XvB | Entering watchdog mode... woof!"); loop { debug!("XvB Watchdog | ----------- Start of loop -----------"); @@ -326,11 +328,13 @@ impl Helper { } }); let share = lock!(gui_api_p2pool).sidechain_shares; + debug!("XvB | Number of current shares: {}", share); // // verify in which round type we are let round = XvbPrivStats::round_type(share, &pub_api); // refresh the round we participate - lock!(&pub_api).stats_priv.round_participate = round; + debug!("XvB | Round type: {:#?}", round); + lock!(&gui_api).stats_priv.round_participate = round; // verify if we are the winner of the current round if lock!(pub_api).stats_pub.winner @@ -341,8 +345,10 @@ impl Helper { // if 10 minutes passed since last check // the first 15 minutes, the HR of xmrig will be 0.0, so xmrig will always mine on p2pool for 15m. - if last_algorithm.elapsed() >= Duration::from_secs(XVB_TIME_ALGO.into()) - || first_loop + // check local HR, skip this time if xmrig is not yet started + if (last_algorithm.elapsed() >= Duration::from_secs(XVB_TIME_ALGO.into()) + || first_loop) + && lock!(gui_api_xmrig).hashrate_raw > 0.0 { debug!("Xvb Process | Algorithm is started"); output_console( @@ -391,8 +397,16 @@ impl Helper { &gui_api, "At least one share is in current PPLNS window.", ); + let hashrate_xmrig = if first_loop { + // check rapidly average HR for first time + lock!(gui_api_xmrig).hashrate_raw + } else if second_loop { + lock!(gui_api_xmrig).hashrate_raw_1m + } else { + lock!(gui_api_xmrig).hashrate_raw_15m + }; let time_donated = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + hashrate_xmrig, &gui_api_p2pool, &gui_api, &state_p2pool, @@ -406,7 +420,7 @@ impl Helper { XVB_TIME_ALGO - time_donated, time_donated ), ); - let hashrate_xmrig = lock!(gui_api_xmrig).hashrate_raw_15m; + debug!("Xvb Process | Local HR is {}H/s ", hashrate_xmrig); lock!(gui_api).p2pool_sent_last_hour_samples.pop_back(); lock!(gui_api).p2pool_sent_last_hour_samples.push_front( @@ -454,6 +468,17 @@ impl Helper { lock!(gui_api).p2pool_sent_last_hour_samples.push_front(0.0); lock!(gui_api).p2pool_sent_last_hour_samples.pop_back(); } + if second_loop { + second_loop = false; + } + if first_loop { + first_loop = false; + second_loop = true; + } + } else { + // if xmrig is still at 0 HR but is alive and algorithm is skipped, recheck first 10s of xmrig inside algorithm next time + first_loop = true; + second_loop = false; } } } @@ -461,9 +486,6 @@ impl Helper { // Reset stats before loop // Sleep (only if 900ms hasn't passed) - if first_loop { - first_loop = false; - } let elapsed = start_loop.elapsed().as_millis(); // Since logic goes off if less than 1000, casting should be safe if elapsed < 900 { @@ -676,13 +698,12 @@ impl XvbPrivStats { } } fn calcul_donated_time( - gui_api_xmrig: &Arc>, + lhr: f32, gui_api_p2pool: &Arc>, gui_api_xvb: &Arc>, state_p2pool: &crate::disk::state::P2pool, state_xvb: &crate::disk::state::Xvb, ) -> u32 { - let lhr = lock!(gui_api_xmrig).hashrate_raw_15m; let p2pool_ehr = lock!(gui_api_p2pool).sidechain_ehr; // what if ehr stay still for the next ten minutes ? mHR will augment every ten minutes because it thinks that oHR is decreasing. // @@ -699,17 +720,15 @@ impl XvbPrivStats { min_hr = 0.0; } debug!("Xvb Process | hr {}, min_hr: {} ", lhr, min_hr); - output_console( - &gui_api_xvb, - &format!("The average 15 minutes HR from Xmrig is {:.0} H/s, minimum required HR to keep a share in PPLNS window is {:.0} H/s, there was {} H/s estimated sent for your address on p2pool", lhr, min_hr, p2pool_ohr), - ); + let msg = format!("local HR from Xmrig is {} kH/s, minimum required HR to keep a share in PPLNS window is {} k/s, there was {} kH/s estimated sent for your address on p2pool", Float::from_3(lhr.into()), Float::from_3(min_hr.into()), Float::from_3(p2pool_ehr.into())); + output_console(&gui_api_xvb, &msg); // calculate how much time can be spared let mut spared_time = Helper::time_that_could_be_spared(lhr, min_hr); if spared_time > 0 { // if not hero option if !state_xvb.hero { - let xvb_chr = lock!(gui_api_xvb).stats_priv.donor_1hr_avg; + let xvb_chr = lock!(gui_api_xvb).stats_priv.donor_1hr_avg * 1000.0; let shr = Helper::calc_last_hour_avg_hash_rate( &lock!(gui_api_xvb).xvb_sent_last_hour_samples, ); @@ -923,8 +942,13 @@ impl PubXvbApi { if !buf.is_empty() { output.push_str(&buf); } + let round_participate = std::mem::take(&mut gui_api.stats_priv.round_participate); *gui_api = Self { output, + stats_priv: XvbPrivStats { + round_participate, + ..pub_api.stats_priv.clone() + }, ..pub_api.clone() }; } @@ -1085,7 +1109,7 @@ mod test { lock!(gui_api_xmrig).hashrate_raw_15m = 5500.0; state_xvb.hero = false; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1107,7 +1131,7 @@ mod test { // verify that hero mode will give x seconds state_xvb.hero = true; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1128,7 +1152,7 @@ mod test { lock!(gui_api_xmrig).hashrate_raw_15m = 7000.0; state_xvb.hero = false; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1150,7 +1174,7 @@ mod test { // verify that hero mode will give x seconds state_xvb.hero = true; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1171,7 +1195,7 @@ mod test { lock!(gui_api_xmrig).hashrate_raw_15m = 18000.0; state_xvb.hero = false; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1193,7 +1217,7 @@ mod test { // verify that hero mode will give x seconds state_xvb.hero = true; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1214,7 +1238,7 @@ mod test { lock!(gui_api_xmrig).hashrate_raw_15m = 105000.0; state_xvb.hero = false; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1236,7 +1260,7 @@ mod test { // verify that hero mode will give x seconds state_xvb.hero = true; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1257,7 +1281,7 @@ mod test { lock!(gui_api_xmrig).hashrate_raw_15m = 1205000.0; state_xvb.hero = false; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1279,7 +1303,7 @@ mod test { // verify that hero mode will give x seconds state_xvb.hero = true; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1301,7 +1325,7 @@ mod test { lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 5000.0; state_xvb.hero = false; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, @@ -1326,7 +1350,7 @@ mod test { lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 5000.0; state_xvb.hero = true; let given_time = XvbPrivStats::calcul_donated_time( - &gui_api_xmrig, + lock!(gui_api_xmrig).hashrate_raw_15m, &gui_api_p2pool, &gui_api_xvb, &state_p2pool, diff --git a/src/utils/regex.rs b/src/utils/regex.rs index 0c1d523..24255b6 100644 --- a/src/utils/regex.rs +++ b/src/utils/regex.rs @@ -150,7 +150,7 @@ pub fn nb_current_shares(s: &str) -> Option { } pub fn estimated_hr(s: &str) -> Option { static CURRENT_SHARE: Lazy = - Lazy::new(|| Regex::new(r"Your hashrate (pool-side) = (?P.*) KH/s").unwrap()); + Lazy::new(|| Regex::new(r"(?P[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)").unwrap()); if let Some(c) = CURRENT_SHARE.captures(s) { if let Some(m) = c.name("nb") { return Some( @@ -177,7 +177,7 @@ pub fn contains_yourshare(l: &str) -> bool { } pub fn contains_yourhashrate(l: &str) -> bool { static LINE_SHARE: Lazy = - Lazy::new(|| Regex::new(r"^Your hashrate (pool-side)").unwrap()); + Lazy::new(|| Regex::new(r"^Your hashrate \(pool-side\) = ").unwrap()); LINE_SHARE.is_match(l) } pub fn contains_end_status(l: &str) -> bool {