feat: use rust edition 2024, apply fmt 2024
Some checks failed
Lockbud / lockbud (push) Waiting to run
Rust / fmt (push) Waiting to run
Rust / test (push) Waiting to run
Rust / clippy (macos-latest) (push) Waiting to run
Rust / clippy (ubuntu-latest) (push) Waiting to run
Rust / check (macos-latest) (push) Waiting to run
Rust / check (ubuntu-latest) (push) Waiting to run
Rust / doc (push) Waiting to run
Typo / typo (push) Waiting to run
Audit / audit (push) Has been cancelled

This commit is contained in:
Cyrix126 2024-11-19 22:13:33 +01:00
parent fd4e62342e
commit 0ea492d930
39 changed files with 259 additions and 196 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
/target
/ra_target
/feature
.DS_Store
rustc-ice-*

View file

@ -1,11 +1,11 @@
cargo-features = ["profile-rustflags", "codegen-backend"]
cargo-features = ["profile-rustflags", "codegen-backend", "edition2024"]
[package]
name = "gupaxx"
version = "1.5.3"
authors = ["cyrix126 <gupaxx@baermail.fr>"]
description = "Fork of Gupax integrating the XMRvsBeast Raffle "
documentation = "https://github.com/cyrix126/gupaxx"
edition = "2021"
edition = "2024"
[profile.release]
panic = "abort"
@ -16,7 +16,8 @@ strip = "symbols"
rustflags = ["-Zlocation-detail=none"]
[profile.dev]
codegen-backend = "cranelift"
# can induce issue when using rust-analyzer, but allows smaller dev build time
# codegen-backend = "cranelift"
[features]
default = []

View file

@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex};
use super::App;
#[cfg(target_os = "windows")]
use crate::errors::{process_running, ErrorButtons, ErrorFerris};
use crate::errors::{ErrorButtons, ErrorFerris, process_running};
use crate::helper::{Helper, ProcessName, ProcessState};
use crate::inits::init_text_styles;
use crate::{NODE_MIDDLE, P2POOL_MIDDLE, SECOND, XMRIG_MIDDLE, XMRIG_PROXY_MIDDLE, XVB_MIDDLE};

View file

@ -1,9 +1,13 @@
use crate::cli::parse_args;
use crate::APP_DEFAULT_HEIGHT;
use crate::APP_DEFAULT_WIDTH;
use crate::GUPAX_VERSION;
use crate::OS;
use crate::cli::Cli;
use crate::cli::parse_args;
use crate::components::gupax::FileWindow;
use crate::components::node::Ping;
use crate::components::node::RemoteNode;
use crate::components::node::REMOTE_NODES;
use crate::components::node::RemoteNode;
use crate::components::update::Update;
use crate::disk::consts::NODE_TOML;
use crate::disk::consts::POOL_TOML;
@ -16,18 +20,18 @@ use crate::disk::state::State;
use crate::errors::ErrorButtons;
use crate::errors::ErrorFerris;
use crate::errors::ErrorState;
use crate::helper::Helper;
use crate::helper::Process;
use crate::helper::ProcessName;
use crate::helper::Sys;
use crate::helper::node::PubNodeApi;
use crate::helper::p2pool::ImgP2pool;
use crate::helper::p2pool::PubP2poolApi;
use crate::helper::xrig::xmrig::ImgXmrig;
use crate::helper::xrig::xmrig::PubXmrigApi;
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::xvb::priv_stats::RuntimeMode;
use crate::helper::xvb::PubXvbApi;
use crate::helper::Helper;
use crate::helper::Process;
use crate::helper::ProcessName;
use crate::helper::Sys;
use crate::helper::xvb::priv_stats::RuntimeMode;
use crate::inits::init_text_styles;
use crate::miscs::cmp_f64;
use crate::miscs::get_exe;
@ -35,14 +39,10 @@ use crate::miscs::get_exe_dir;
use crate::utils::constants::VISUALS;
use crate::utils::macros::arc_mut;
use crate::utils::sudo::SudoState;
use crate::APP_DEFAULT_HEIGHT;
use crate::APP_DEFAULT_WIDTH;
use crate::GUPAX_VERSION;
use crate::OS;
use derive_more::derive::Display;
use eframe::CreationContext;
use egui::vec2;
use egui::Vec2;
use egui::vec2;
use log::debug;
use log::error;
use log::info;
@ -501,7 +501,7 @@ impl App {
//----------------------------------------------------------------------------------------------------
let mut og = app.og.lock().unwrap(); // Lock [og]
// Handle max threads
// Handle max threads
info!("App Init | Handling max thread overflow...");
og.xmrig.max_threads = app.max_threads;
let current = og.xmrig.current_threads;

View file

@ -1,7 +1,7 @@
use std::sync::Arc;
use crate::app::eframe_impl::{ProcessStateGui, ProcessStatesGui};
use crate::app::{keys::KeyPressed, Restart};
use crate::app::{Restart, keys::KeyPressed};
use crate::disk::node::Node;
use crate::disk::pool::Pool;
use crate::disk::state::{Gupax, State};
@ -583,7 +583,9 @@ impl crate::app::App {
};
// check path of binary except for XvB
if name != ProcessName::Xvb && !crate::components::update::check_binary_path(path, name) {
let msg_error = format!("{name} binary at the given PATH in the Gupaxx tab doesn't look like {name}! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where {name} is located.");
let msg_error = format!(
"{name} binary at the given PATH in the Gupaxx tab doesn't look like {name}! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where {name} is located."
);
return Err(msg_error);
}

View file

@ -1,9 +1,9 @@
use crate::app::panels::middle::*;
use crate::app::ErrorState;
use crate::app::Restart;
use crate::app::panels::middle::*;
use crate::components::gupax::*;
use crate::components::update::check_binary_path;
use crate::components::update::Update;
use crate::components::update::check_binary_path;
use crate::disk::state::*;
use log::debug;
use std::path::Path;

View file

@ -1,6 +1,6 @@
use crate::app::Tab;
use crate::app::eframe_impl::ProcessStatesGui;
use crate::app::keys::KeyPressed;
use crate::app::Tab;
use crate::helper::ProcessName;
use crate::utils::constants::*;
use crate::utils::errors::{ErrorButtons, ErrorFerris};

View file

@ -11,9 +11,9 @@ use log::debug;
use crate::components::gupax::{FileType, FileWindow};
use crate::disk::state::{Gupax, Node};
use crate::helper::node::PubNodeApi;
use crate::helper::Process;
use crate::regex::{num_lines, REGEXES};
use crate::helper::node::PubNodeApi;
use crate::regex::{REGEXES, num_lines};
use crate::utils::constants::DARK_GRAY;
use crate::{GREEN, LIGHT_GRAY, P2POOL_IN, P2POOL_LOG, P2POOL_OUT, RED, SPACE};

View file

@ -20,7 +20,7 @@ impl P2pool {
let space_h = size.y / 128.0;
debug!("P2Pool Tab | Rendering [Node List] elements");
let mut incorrect_input = false; // This will disable [Add/Delete] on bad input
// [Monero node IP/RPC/ZMQ]
// [Monero node IP/RPC/ZMQ]
ui.horizontal(|ui| {
ui.group(|ui| {
let width = size.x/10.0;

View file

@ -19,7 +19,7 @@ use crate::regex::num_lines;
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::{components::node::*, constants::*, helper::*, utils::regex::Regexes};
use egui::{vec2, Color32, Label, RichText, TextEdit, TextStyle, Vec2};
use egui::{Color32, Label, RichText, TextEdit, TextStyle, Vec2, vec2};
use log::*;
use std::sync::{Arc, Mutex};

View file

@ -4,15 +4,15 @@ use std::sync::Mutex;
use crate::app::panels::middle::Hyperlink;
use crate::app::panels::middle::ProgressBar;
use crate::app::panels::middle::Spinner;
use crate::components::node::format_ip_location;
use crate::components::node::format_ms;
use crate::components::node::Ping;
use crate::components::node::RemoteNode;
use crate::components::node::format_ip_location;
use crate::components::node::format_ms;
use crate::disk::state::P2pool;
use egui::vec2;
use egui::Button;
use egui::Checkbox;
use egui::Vec2;
use egui::vec2;
use crate::constants::*;
use egui::{Color32, ComboBox, Label, RichText, Ui};

View file

@ -18,9 +18,10 @@
use egui::Vec2;
use crate::{
app::{eframe_impl::ProcessStatesGui, Benchmark},
app::{Benchmark, eframe_impl::ProcessStatesGui},
disk::{gupax_p2pool_api::GupaxP2poolApi, state::Status, status::*},
helper::{
ProcessName, Sys,
node::PubNodeApi,
p2pool::{ImgP2pool, PubP2poolApi},
xrig::{
@ -28,7 +29,6 @@ use crate::{
xmrig_proxy::PubXmrigProxyApi,
},
xvb::PubXvbApi,
ProcessName, Sys,
},
};
use std::sync::{Arc, Mutex};

View file

@ -8,7 +8,7 @@ use crate::helper::node::PubNodeApi;
use crate::helper::p2pool::{ImgP2pool, PubP2poolApi};
use crate::helper::xrig::xmrig::{ImgXmrig, PubXmrigApi};
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::xvb::{rounds::XvbRound, PubXvbApi};
use crate::helper::xvb::{PubXvbApi, rounds::XvbRound};
use crate::helper::{ProcessName, Sys};
use crate::constants::*;

View file

@ -18,13 +18,13 @@
use crate::constants::*;
use crate::disk::pool::Pool;
use crate::disk::state::Xmrig;
use crate::helper::xrig::xmrig::PubXmrigApi;
use crate::helper::Process;
use crate::regex::{num_lines, REGEXES};
use crate::helper::xrig::xmrig::PubXmrigApi;
use crate::regex::{REGEXES, num_lines};
use crate::utils::regex::Regexes;
use egui::{
vec2, Button, Checkbox, ComboBox, Label, RichText, SelectableLabel, Slider, TextEdit,
TextStyle, Vec2,
Button, Checkbox, ComboBox, Label, RichText, SelectableLabel, Slider, TextEdit, TextStyle,
Vec2, vec2,
};
use log::*;

View file

@ -1,5 +1,5 @@
use egui::{
vec2, Button, Checkbox, ComboBox, Label, RichText, SelectableLabel, TextEdit, TextStyle, Vec2,
Button, Checkbox, ComboBox, Label, RichText, SelectableLabel, TextEdit, TextStyle, Vec2, vec2,
};
use std::sync::{Arc, Mutex};
@ -7,9 +7,9 @@ use log::{debug, info};
use crate::disk::pool::Pool;
use crate::disk::state::XmrigProxy;
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::Process;
use crate::regex::{num_lines, REGEXES};
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::regex::{REGEXES, num_lines};
use crate::utils::constants::DARK_GRAY;
use crate::{
GREEN, LIGHT_GRAY, LIST_ADD, LIST_CLEAR, LIST_DELETE, LIST_SAVE, RED, SPACE, XMRIG_API_IP,

View file

@ -1,15 +1,16 @@
use std::sync::{Arc, Mutex};
use egui::{vec2, Image, RichText, TextEdit, TextStyle, Ui, Vec2};
use egui::{Image, RichText, TextEdit, TextStyle, Ui, Vec2, vec2};
use log::debug;
use readable::num::Float;
use readable::up::Uptime;
use crate::XVB_MINING_ON_FIELD;
use crate::disk::state::{ManualDonationLevel, ManualDonationMetric, XvbMode};
use crate::helper::xrig::xmrig::PubXmrigApi;
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::xvb::priv_stats::RuntimeMode;
use crate::helper::xvb::PubXvbApi;
use crate::helper::xvb::priv_stats::RuntimeMode;
use crate::regex::num_lines;
use crate::utils::constants::{
GREEN, LIGHT_GRAY, ORANGE, RED, XVB_DONATED_1H_FIELD, XVB_DONATED_24H_FIELD,
@ -21,7 +22,6 @@ use crate::utils::constants::{
XVB_TOKEN_LEN, XVB_URL_RULES, XVB_WINNER_FIELD,
};
use crate::utils::regex::Regexes;
use crate::XVB_MINING_ON_FIELD;
use crate::{
constants::{BYTES_XVB, SPACE},
utils::constants::{DARK_GRAY, XVB_URL},

View file

@ -1,9 +1,9 @@
use clap::Parser;
use clap::Subcommand;
use clap::crate_authors;
use clap::crate_description;
use clap::crate_name;
use clap::crate_version;
use clap::Parser;
use clap::Subcommand;
use log::debug;
use log::info;
use log::warn;

View file

@ -19,7 +19,7 @@ use crate::components::update::get_user_agent;
use crate::{constants::*, macros::*};
use egui::Color32;
use log::*;
use rand::{thread_rng, Rng};
use rand::{Rng, thread_rng};
use reqwest::{Client, RequestBuilder};
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
@ -467,7 +467,7 @@ mod test {
use log::error;
use reqwest::Client;
use crate::components::node::{format_ip, REMOTE_NODES, REMOTE_NODE_LENGTH};
use crate::components::node::{REMOTE_NODE_LENGTH, REMOTE_NODES, format_ip};
use crate::components::update::get_user_agent;
// Iterate through all nodes, find the longest domain.
pub const REMOTE_NODE_MAX_CHARS: usize = {

View file

@ -33,10 +33,10 @@ use crate::{
miscs::get_exe_dir,
utils::errors::{ErrorButtons, ErrorFerris, ErrorState},
};
use anyhow::{anyhow, Error};
use anyhow::{Error, anyhow};
use log::*;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use rand::{Rng, thread_rng};
use reqwest::header::{LOCATION, USER_AGENT};
use reqwest::{Client, RequestBuilder};
use serde::{Deserialize, Serialize};
@ -130,8 +130,7 @@ const MSG_DOWNLOAD: &str = "Downloading packages";
const MSG_EXTRACT: &str = "Extracting packages";
const MSG_UPGRADE: &str = "Upgrading packages";
pub const MSG_FAILED: &str = "Update failed";
pub const MSG_FAILED_HELP: &str =
"Consider manually replacing your executable from github releases: https://github.com/Cyrix126/gupaxx/releases";
pub const MSG_FAILED_HELP: &str = "Consider manually replacing your executable from github releases: https://github.com/Cyrix126/gupaxx/releases";
const INIT: &str = "------------------- Init -------------------";
const METADATA: &str = "----------------- Metadata -----------------";
const COMPARE: &str = "----------------- Compare ------------------";

View file

@ -32,8 +32,8 @@
use crate::disk::consts::*;
use crate::{app::Tab, components::gupax::Ratio, constants::*, human::*, macros::*, xmr::*};
use figment::providers::{Format, Toml};
use figment::Figment;
use figment::providers::{Format, Toml};
use log::*;
use serde::{Deserialize, Serialize};
#[cfg(target_family = "unix")]

View file

@ -1,5 +1,5 @@
use anyhow::Result;
use rand::{distributions::Alphanumeric, thread_rng, Rng};
use rand::{Rng, distributions::Alphanumeric, thread_rng};
use super::*;
use crate::{components::node::RemoteNode, disk::status::*};

View file

@ -327,9 +327,10 @@ mod test {
assert_eq!(api.payout_u64, 1);
assert_eq!(api.xmr.to_u64(), 2);
assert!(!api.payout_ord.is_empty());
assert!(api
.log
.contains("2022-01-27 01:30:23.1377 | 0.000000000001 XMR | Block 2,642,816"));
assert!(
api.log
.contains("2022-01-27 01:30:23.1377 | 0.000000000001 XMR | Block 2,642,816")
);
}
#[test]

View file

@ -56,7 +56,7 @@ use std::{
};
use strum::EnumIter;
use self::xvb::{nodes::XvbNode, PubXvbApi};
use self::xvb::{PubXvbApi, nodes::XvbNode};
pub mod node;
pub mod p2pool;
pub mod tests;
@ -339,7 +339,10 @@ impl Helper {
"{} Watchdog | Output is nearing {} bytes, resetting!",
name, MAX_GUI_OUTPUT_BYTES
);
let text = format!("{}\n{} GUI log is exceeding the maximum: {} bytes!\nI've reset the logs for you!\n{}\n\n\n\n", HORI_CONSOLE, name, MAX_GUI_OUTPUT_BYTES, HORI_CONSOLE);
let text = format!(
"{}\n{} GUI log is exceeding the maximum: {} bytes!\nI've reset the logs for you!\n{}\n\n\n\n",
HORI_CONSOLE, name, MAX_GUI_OUTPUT_BYTES, HORI_CONSOLE
);
output.clear();
output.push_str(&text);
debug!("{} Watchdog | Resetting GUI output ... OK", name);
@ -455,7 +458,9 @@ impl Helper {
let sysinfo_processes = sysinfo::ProcessRefreshKind::new().with_cpu();
thread::spawn(move || {
info!("Helper | Hello from helper thread! Entering loop where I will spend the rest of my days...");
info!(
"Helper | Hello from helper thread! Entering loop where I will spend the rest of my days..."
);
// Begin loop
loop {
// 1. Loop init timestamp

View file

@ -16,8 +16,8 @@ use tokio::spawn;
use crate::{
disk::state::Node,
helper::{
check_died, check_user_input, signal_end, sleep_end_loop, ProcessName, ProcessSignal,
ProcessState,
ProcessName, ProcessSignal, ProcessState, check_died, check_user_input, signal_end,
sleep_end_loop,
},
macros::{arc_mut, sleep},
};

View file

@ -2,20 +2,20 @@ use super::Helper;
use super::Process;
use crate::components::node::RemoteNode;
use crate::disk::state::P2pool;
use crate::helper::ProcessName;
use crate::helper::ProcessSignal;
use crate::helper::ProcessState;
use crate::helper::check_died;
use crate::helper::check_user_input;
use crate::helper::signal_end;
use crate::helper::sleep_end_loop;
use crate::helper::ProcessName;
use crate::helper::ProcessSignal;
use crate::helper::ProcessState;
use crate::regex::P2POOL_REGEX;
use crate::regex::contains_end_status;
use crate::regex::contains_statuscommand;
use crate::regex::contains_yourhashrate;
use crate::regex::contains_yourshare;
use crate::regex::estimated_hr;
use crate::regex::nb_current_shares;
use crate::regex::P2POOL_REGEX;
use crate::{
constants::*,
disk::{gupax_p2pool_api::GupaxP2poolApi, node::Node},
@ -99,7 +99,10 @@ impl Helper {
gui_api.lock().unwrap().sidechain_ehr
);
} else {
error!("P2pool | PTY Getting data from status: Lines contains Your shares but no value found: {}", line);
error!(
"P2pool | PTY Getting data from status: Lines contains Your shares but no value found: {}",
line
);
}
}
if contains_yourshare(&line) {
@ -111,7 +114,10 @@ impl Helper {
);
gui_api.lock().unwrap().sidechain_shares = shares;
} else {
error!("P2pool | PTY Getting data from status: Lines contains Your shares but no value found: {}", line);
error!(
"P2pool | PTY Getting data from status: Lines contains Your shares but no value found: {}",
line
);
}
}
if contains_end_status(&line) {
@ -203,12 +209,9 @@ impl Helper {
// Print arguments & user settings to console
crate::disk::print_dash(&format!(
"P2Pool | Launch arguments: {:#?} | Local API Path: {:#?} | Network API Path: {:#?} | Pool API Path: {:#?}",
args,
api_path_local,
api_path_network,
api_path_pool,
));
"P2Pool | Launch arguments: {:#?} | Local API Path: {:#?} | Network API Path: {:#?} | Pool API Path: {:#?}",
args, api_path_local, api_path_network, api_path_pool,
));
// Spawn watchdog thread
let process = Arc::clone(&helper.lock().unwrap().p2pool);
@ -914,7 +917,10 @@ impl PubP2poolApi {
xmr_new
);
debug!("P2Pool Watchdog | Total [XMR mined] should be ... {}", xmr);
debug!("P2Pool Watchdog | Correct [XMR mined per] should be ... [{}/hour, {}/day, {}/month]", xmr_hour, xmr_day, xmr_month);
debug!(
"P2Pool Watchdog | Correct [XMR mined per] should be ... [{}/hour, {}/day, {}/month]",
xmr_hour, xmr_day, xmr_month
);
}
// 6. Mutate the struct with the new info

View file

@ -4,9 +4,9 @@ mod test {
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::xvb::algorithm::Algorithm;
use crate::helper::{
Helper, Process, ProcessName, ProcessState,
p2pool::{PrivP2poolLocalApi, PrivP2poolNetworkApi},
xvb::{priv_stats::RuntimeDonationLevel, priv_stats::RuntimeMode},
Helper, Process, ProcessName, ProcessState,
};
use crate::miscs::client;
@ -241,11 +241,11 @@ Uptime = 0h 2m 4s
#[test]
fn update_pub_p2pool_from_local_network_pool() {
use crate::helper::PubP2poolApi;
use crate::helper::p2pool::PoolStatistics;
use crate::helper::p2pool::PrivP2poolLocalApi;
use crate::helper::p2pool::PrivP2poolNetworkApi;
use crate::helper::p2pool::PrivP2poolPoolApi;
use crate::helper::PubP2poolApi;
use std::sync::{Arc, Mutex};
let public = Arc::new(Mutex::new(PubP2poolApi::new()));
let local = PrivP2poolLocalApi {
@ -338,7 +338,9 @@ Uptime = 0h 2m 4s
println!("{:#?}", process);
assert!(process.lock().unwrap().state == ProcessState::NotMining);
let output_parse = Arc::new(Mutex::new(String::from("[2022-02-12 12:49:30.311] net new job from 192.168.2.1:3333 diff 402K algo rx/0 height 2241142 (11 tx)")));
let output_parse = Arc::new(Mutex::new(String::from(
"[2022-02-12 12:49:30.311] net new job from 192.168.2.1:3333 diff 402K algo rx/0 height 2241142 (11 tx)",
)));
PubXmrigApi::update_from_output(
&mut public.lock().unwrap(),
&output_parse,
@ -547,7 +549,7 @@ Uptime = 0h 2m 4s
helper::{p2pool::PubP2poolApi, xrig::xmrig::PubXmrigApi},
};
use crate::helper::xvb::{public_stats::XvbPubStats, PubXvbApi};
use crate::helper::xvb::{PubXvbApi, public_stats::XvbPubStats};
use reqwest_middleware::ClientWithMiddleware as Client;
#[test]

View file

@ -1,6 +1,6 @@
use crate::helper::XvbNode;
use anyhow::anyhow;
use anyhow::Result;
use anyhow::anyhow;
use log::info;
use reqwest::header::AUTHORIZATION;
use reqwest_middleware::ClientWithMiddleware as Client;

View file

@ -1,10 +1,10 @@
use crate::constants::*;
use crate::helper::xrig::update_xmrig_config;
use crate::helper::{arc_mut, check_died, check_user_input, sleep, sleep_end_loop, Process};
use crate::helper::{Helper, ProcessName, ProcessSignal, ProcessState};
use crate::helper::{Process, arc_mut, check_died, check_user_input, sleep, sleep_end_loop};
use crate::helper::{PubXvbApi, XvbNode};
use crate::miscs::{client, output_console};
use crate::regex::{contains_error, contains_usepool, detect_new_node_xmrig, XMRIG_REGEX};
use crate::regex::{XMRIG_REGEX, contains_error, contains_usepool, detect_new_node_xmrig};
use crate::utils::human::HumanNumber;
use crate::utils::sudo::SudoState;
use enclose::enclose;
@ -555,7 +555,9 @@ impl Helper {
&& !process_xp.lock().unwrap().is_alive()
&& process_p2pool.lock().unwrap().is_alive()
{
info!("XMRig Process | redirect xmrig to p2pool since XMRig-Proxy is not alive anymore");
info!(
"XMRig Process | redirect xmrig to p2pool since XMRig-Proxy is not alive anymore"
);
let node = XvbNode::P2pool;
if let Err(err) = update_xmrig_config(
&client,

View file

@ -14,17 +14,17 @@ use tokio::spawn;
use crate::miscs::client;
use crate::{
GUPAX_VERSION_UNDERSCORE, UNKNOWN_DATA,
disk::state::Xmrig,
helper::{
check_died, check_user_input, signal_end, sleep_end_loop,
Helper, Process, ProcessName, ProcessSignal, ProcessState, check_died, check_user_input,
signal_end, sleep_end_loop,
xrig::update_xmrig_config,
xvb::{nodes::XvbNode, PubXvbApi},
Helper, Process, ProcessName, ProcessSignal, ProcessState,
xvb::{PubXvbApi, nodes::XvbNode},
},
macros::{arc_mut, sleep},
miscs::output_console,
regex::{contains_timeout, contains_usepool, detect_new_node_xmrig, XMRIG_REGEX},
GUPAX_VERSION_UNDERSCORE, UNKNOWN_DATA,
regex::{XMRIG_REGEX, contains_timeout, contains_usepool, detect_new_node_xmrig},
};
use crate::{NO_POOL, XMRIG_CONFIG_URL, XMRIG_PROXY_SUMMARY_URL};
@ -72,8 +72,8 @@ impl Helper {
// updating current node to None, will stop sending signal of FailedNode until new node is set
// send signal to update node.
warn!(
"XMRig-Proxy PTY Parse | node is offline, sending signal to update nodes."
);
"XMRig-Proxy PTY Parse | node is offline, sending signal to update nodes."
);
if current_node != XvbNode::P2pool {
process_xvb.lock().unwrap().signal =
ProcessSignal::UpdateNodes(current_node);
@ -412,7 +412,9 @@ impl Helper {
match PrivXmrigProxyApi::request_xp_api(&client, api_summary_xp, token_proxy).await
{
Ok(priv_api) => {
debug!("XMRig-Proxy Watchdog | HTTP API request OK, attempting [update_from_priv()]");
debug!(
"XMRig-Proxy Watchdog | HTTP API request OK, attempting [update_from_priv()]"
);
PubXmrigProxyApi::update_from_priv(pub_api, priv_api);
}
Err(err) => {
@ -455,7 +457,7 @@ impl Helper {
}
}
} // locked are dropped here
// do not use more than 1 second for the loop
// do not use more than 1 second for the loop
sleep_end_loop(now, ProcessName::XmrigProxy).await;
}

View file

@ -1,9 +1,9 @@
use crate::XVB_MIN_TIME_SEND;
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::xvb::api_url_xmrig;
use crate::helper::xvb::current_controllable_hr;
use crate::miscs::output_console;
use crate::miscs::output_console_without_time;
use crate::XVB_MIN_TIME_SEND;
use std::{
sync::{Arc, Mutex},
time::Duration,
@ -15,17 +15,17 @@ use reqwest_middleware::ClientWithMiddleware as Client;
use tokio::time::sleep;
use crate::{
BLOCK_PPLNS_WINDOW_MAIN, BLOCK_PPLNS_WINDOW_MINI, SECOND_PER_BLOCK_P2POOL,
XVB_ROUND_DONOR_MEGA_MIN_HR, XVB_ROUND_DONOR_MIN_HR, XVB_ROUND_DONOR_VIP_MIN_HR,
XVB_ROUND_DONOR_WHALE_MIN_HR, XVB_TIME_ALGO,
helper::{
p2pool::PubP2poolApi,
xrig::{update_xmrig_config, xmrig::PubXmrigApi},
xvb::{nodes::XvbNode, priv_stats::RuntimeMode},
},
BLOCK_PPLNS_WINDOW_MAIN, BLOCK_PPLNS_WINDOW_MINI, SECOND_PER_BLOCK_P2POOL,
XVB_ROUND_DONOR_MEGA_MIN_HR, XVB_ROUND_DONOR_MIN_HR, XVB_ROUND_DONOR_VIP_MIN_HR,
XVB_ROUND_DONOR_WHALE_MIN_HR, XVB_TIME_ALGO,
};
use super::{priv_stats::RuntimeDonationLevel, PubXvbApi, SamplesAverageHour};
use super::{PubXvbApi, SamplesAverageHour, priv_stats::RuntimeDonationLevel};
#[allow(clippy::too_many_arguments)]
pub(crate) async fn algorithm(
@ -138,7 +138,9 @@ impl<'a> Algorithm<'a> {
);
let p2pool_external_hashrate =
(p2pool_total_hashrate - p2pool_avg_last_hour_hashrate).max(0.0);
info!("p2pool external hashrate({p2pool_external_hashrate}) = p2ool_total_hashrate({p2pool_total_hashrate}) - p2pool_avg_last_hour_hashrate({p2pool_avg_last_hour_hashrate})");
info!(
"p2pool external hashrate({p2pool_external_hashrate}) = p2ool_total_hashrate({p2pool_total_hashrate}) - p2pool_avg_last_hour_hashrate({p2pool_avg_last_hour_hashrate})"
);
let share_min_hashrate = Self::minimum_hashrate_share(
gui_api_p2pool.lock().unwrap().p2pool_difficulty_u64,
@ -161,7 +163,9 @@ impl<'a> Algorithm<'a> {
&gui_api_xvb.lock().unwrap().xvb_sent_last_hour_samples,
);
let xvb_external_hashrate = (xvb_1h_avg - xvb_avg_last_hour_hashrate).max(0.0);
info!("xvb external hashrate({xvb_external_hashrate}) = xvb_1h_avg({xvb_1h_avg}) - xvb_avg_last_hour_hashrate({xvb_avg_last_hour_hashrate})");
info!(
"xvb external hashrate({xvb_external_hashrate}) = xvb_1h_avg({xvb_1h_avg}) - xvb_avg_last_hour_hashrate({xvb_avg_last_hour_hashrate})"
);
let stats = Stats {
share,
hashrate_xmrig,
@ -429,10 +433,10 @@ impl<'a> Algorithm<'a> {
let target_donation_hashrate =
self.stats.hashrate_xmrig - (self.stats.runtime_amount as f32);
info!("Algorithm | ManualP2poolMode target_donation_hashrate({})=hashrate_xmrig({})-runtime_amount({})",
target_donation_hashrate,
self.stats.hashrate_xmrig,
self.stats.runtime_amount);
info!(
"Algorithm | ManualP2poolMode target_donation_hashrate({})=hashrate_xmrig({})-runtime_amount({})",
target_donation_hashrate, self.stats.hashrate_xmrig, self.stats.runtime_amount
);
target_donation_hashrate
}
@ -441,9 +445,10 @@ impl<'a> Algorithm<'a> {
let target_donation_hashrate = self.stats.runtime_donation_level.get_hashrate()
- self.stats.xvb_external_hashrate;
info!("Algorithm | ManualDonationLevelMode target_donation_hashrate({})={:#?}.get_hashrate()",
target_donation_hashrate,
self.stats.runtime_donation_level);
info!(
"Algorithm | ManualDonationLevelMode target_donation_hashrate({})={:#?}.get_hashrate()",
target_donation_hashrate, self.stats.runtime_donation_level
);
target_donation_hashrate
}
@ -511,13 +516,15 @@ impl<'a> Algorithm<'a> {
* (1.0 + (p2pool_buffer as f32 / 100.0)))
- p2pool_external_hashrate;
info!("Algorithm | (difficulty({}) / (window pplns blocks({}) * seconds per p2pool block({})) * (BUFFER 1 + ({})) / 100) - outside HR({}H/s) = minimum HR({}H/s) to keep a share.",
difficulty,
pws,
SECOND_PER_BLOCK_P2POOL,
p2pool_buffer,
p2pool_external_hashrate,
minimum_hr);
info!(
"Algorithm | (difficulty({}) / (window pplns blocks({}) * seconds per p2pool block({})) * (BUFFER 1 + ({})) / 100) - outside HR({}H/s) = minimum HR({}H/s) to keep a share.",
difficulty,
pws,
SECOND_PER_BLOCK_P2POOL,
p2pool_buffer,
p2pool_external_hashrate,
minimum_hr
);
if minimum_hr.is_sign_negative() {
info!("Algorithm | if minimum HR is negative, it is 0.");
@ -567,16 +574,23 @@ impl<'a> Algorithm<'a> {
match self.stats.needed_time_xvb {
x if x <= XVB_MIN_TIME_SEND => {
info!("Algorithm | Needed time: {x} to send on XvB is less than minimum time to send, sending all HR to p2pool");
info!(
"Algorithm | Needed time: {x} to send on XvB is less than minimum time to send, sending all HR to p2pool"
);
self.send_all_p2pool().await;
}
x if x <= XVB_TIME_ALGO - XVB_MIN_TIME_SEND => {
info!("Algorithm | There is a share in p2pool and 24H avg XvB is achieved. Sending {} seconds to XvB!", self.stats.needed_time_xvb);
info!(
"Algorithm | There is a share in p2pool and 24H avg XvB is achieved. Sending {} seconds to XvB!",
self.stats.needed_time_xvb
);
self.target_p2pool_node().await;
self.sleep_then_update_node_xmrig().await;
}
x if x >= XVB_TIME_ALGO - XVB_MIN_TIME_SEND => {
info!("Algorithm | time : {x} seconds for XvB is more than time algo - minimum time to send, sending all to XvB");
info!(
"Algorithm | time : {x} seconds for XvB is more than time algo - minimum time to send, sending all to XvB"
);
self.send_all_xvb().await;
}
_ => error!("should not be possible"),
@ -635,11 +649,10 @@ impl<'a> Algorithm<'a> {
fn get_needed_time_xvb(target_donation_hashrate: f32, hashrate_xmrig: f32) -> u32 {
let needed_time = target_donation_hashrate / hashrate_xmrig * (XVB_TIME_ALGO as f32);
info!("Algorithm | Calculating... needed time for XvB ({}seconds)=target_donation_hashrate({})/hashrate_xmrig({})*XVB_TIME_ALGO({})",
needed_time,
target_donation_hashrate,
hashrate_xmrig,
XVB_TIME_ALGO);
info!(
"Algorithm | Calculating... needed time for XvB ({}seconds)=target_donation_hashrate({})/hashrate_xmrig({})*XVB_TIME_ALGO({})",
needed_time, target_donation_hashrate, hashrate_xmrig, XVB_TIME_ALGO
);
// never go above time of algo
// it could be the case if manual donation level is set
needed_time.clamp(0.0, XVB_TIME_ALGO as f32) as u32

View file

@ -2,7 +2,7 @@ use crate::helper::xrig::update_xmrig_config;
use crate::helper::xvb::algorithm::algorithm;
use crate::helper::xvb::priv_stats::XvbPrivStats;
use crate::helper::xvb::public_stats::XvbPubStats;
use crate::helper::{sleep_end_loop, ProcessName};
use crate::helper::{ProcessName, sleep_end_loop};
use crate::miscs::{client, output_console};
use crate::{XMRIG_CONFIG_URL, XMRIG_PROXY_CONFIG_URL, XMRIG_PROXY_SUMMARY_URL, XMRIG_SUMMARY_URL};
use bounded_vec_deque::BoundedVecDeque;
@ -18,7 +18,7 @@ use std::{
};
use tokio::spawn;
use tokio::task::JoinHandle;
use tokio::time::{sleep, Instant};
use tokio::time::{Instant, sleep};
use crate::helper::xvb::rounds::round_type;
use crate::utils::constants::{XVB_PUBLIC_ONLY, XVB_TIME_ALGO};
@ -488,8 +488,18 @@ async fn check_conditions_for_start(
{
info!("XvB | verify address and token");
// send to console: token non existent for address on XvB server
warn!("Xvb | Start ... Partially failed because token and associated address are not existent on XvB server: {}\n", err);
output_console(&mut gui_api.lock().unwrap().output, &format!("Token and associated address are not valid on XvB API.\nCheck if you are registered.\nError: {}", err), ProcessName::Xvb);
warn!(
"Xvb | Start ... Partially failed because token and associated address are not existent on XvB server: {}\n",
err
);
output_console(
&mut gui_api.lock().unwrap().output,
&format!(
"Token and associated address are not valid on XvB API.\nCheck if you are registered.\nError: {}",
err
),
ProcessName::Xvb,
);
ProcessState::NotMining
} else if process_p2pool.lock().unwrap().state != ProcessState::Alive {
info!("XvB | verify p2pool node");
@ -506,7 +516,9 @@ async fn check_conditions_for_start(
&& process_xp.lock().unwrap().state != ProcessState::Alive
{
// send to console: xmrig process is not running
warn!("Xvb | Start ... Partially failed because Xmrig or Xmrig-Proxy instance is not running.");
warn!(
"Xvb | Start ... Partially failed because Xmrig or Xmrig-Proxy instance is not running."
);
// output the error to console
output_console(
&mut gui_api.lock().unwrap().output,
@ -573,7 +585,7 @@ async fn check_state_outcauses_xvb(
output_console(
&mut gui_api.lock().unwrap().output,
"XvB process can not completely continue, algorithm of distribution of HR is stopped.",
ProcessName::Xvb
ProcessName::Xvb,
);
// only update xmrig if it is alive and wasn't on p2pool already.
if gui_api.lock().unwrap().current_node != Some(XvbNode::P2pool)
@ -638,16 +650,18 @@ async fn check_state_outcauses_xvb(
match state {
ProcessState::Alive if !p2pool_xmrig_alive => {
// they are not both alives, so state will be at syncing and data reset, state of loop also.
warn!("XvB | stopped partially because P2pool node or xmrig/xmrig-proxy are not reachable.");
warn!(
"XvB | stopped partially because P2pool node or xmrig/xmrig-proxy are not reachable."
);
// stats must be empty put to default so the UI reflect that XvB private is not running.
reset_data_xvb(pub_api, gui_api);
// request from public API must be executed at next loop, do not wait for 1 minute.
*first_loop = true;
output_console(
&mut gui_api.lock().unwrap().output,
"XvB is now partially stopped because p2pool node or XMRig/XMRig-Proxy came offline.\nCheck P2pool and Xmrig/Xmrig-Proxy Tabs",
ProcessName::Xvb
);
&mut gui_api.lock().unwrap().output,
"XvB is now partially stopped because p2pool node or XMRig/XMRig-Proxy came offline.\nCheck P2pool and Xmrig/Xmrig-Proxy Tabs",
ProcessName::Xvb,
);
output_console(
&mut gui_api.lock().unwrap().output,
XVB_PUBLIC_ONLY,
@ -806,7 +820,7 @@ fn signal_interrupt(
err
), ProcessName::Xvb
);
}
}
}
));}
},

View file

@ -9,9 +9,9 @@ use reqwest_middleware::ClientWithMiddleware as Client;
use tokio::spawn;
use crate::{
components::node::{GetInfo, TIMEOUT_NODE_PING},
helper::{xvb::output_console, Process, ProcessName, ProcessState},
GUPAX_VERSION_UNDERSCORE, XVB_NODE_EU, XVB_NODE_NA, XVB_NODE_PORT, XVB_NODE_RPC,
components::node::{GetInfo, TIMEOUT_NODE_PING},
helper::{Process, ProcessName, ProcessState, xvb::output_console},
};
use super::PubXvbApi;

View file

@ -10,16 +10,16 @@ use reqwest_middleware::ClientWithMiddleware as Client;
use serde::Deserialize;
use crate::{
disk::state::ManualDonationLevel,
helper::{xvb::output_console, Process, ProcessName, ProcessState},
XVB_URL,
XVB_ROUND_DONOR_MEGA_MIN_HR, XVB_ROUND_DONOR_MIN_HR, XVB_ROUND_DONOR_VIP_MIN_HR,
XVB_ROUND_DONOR_WHALE_MIN_HR, disk::state::XvbMode,
};
use crate::{
disk::state::XvbMode, XVB_ROUND_DONOR_MEGA_MIN_HR, XVB_ROUND_DONOR_MIN_HR,
XVB_ROUND_DONOR_VIP_MIN_HR, XVB_ROUND_DONOR_WHALE_MIN_HR,
XVB_URL,
disk::state::ManualDonationLevel,
helper::{Process, ProcessName, ProcessState, xvb::output_console},
};
use super::{nodes::XvbNode, rounds::XvbRound, PubXvbApi};
use super::{PubXvbApi, nodes::XvbNode, rounds::XvbRound};
#[derive(Debug, Clone, Deserialize, PartialEq, Eq, Default)]
pub enum RuntimeMode {
@ -97,7 +97,10 @@ impl XvbPrivStats {
StatusCode::OK => match resp.json::<Self>().await {
Ok(s) => Ok(s),
Err(err) => {
error!("XvB Watchdog | Data provided from private API is not deserializ-able.Error: {}", err);
error!(
"XvB Watchdog | Data provided from private API is not deserializ-able.Error: {}",
err
);
bail!(
"Data provided from private API is not deserializ-able.Error: {}",
err

View file

@ -9,11 +9,11 @@ use serde::Deserialize;
use serde_this_or_that::as_u64;
use crate::{
helper::{xvb::output_console, Process, ProcessName, ProcessState},
XVB_URL_PUBLIC_API,
helper::{Process, ProcessName, ProcessState, xvb::output_console},
};
use super::{rounds::XvbRound, PubXvbApi};
use super::{PubXvbApi, rounds::XvbRound};
#[allow(dead_code)] // because deserialize doesn't use all the fields
#[derive(Debug, Clone, Default, Deserialize)]

View file

@ -1,4 +1,4 @@
use crate::components::update::{check_binary_path, Update};
use crate::components::update::{Update, check_binary_path};
use crate::errors::process_running;
use crate::helper::{Helper, ProcessName, ProcessSignal};
use crate::utils::constants::{
@ -66,7 +66,6 @@ pub fn init_logger(now: Instant, logfile: bool) {
"trace" | "Trace" | "TRACE" => LevelFilter::Trace,
_ => LevelFilter::Info,
};
std::env::set_var("RUST_LOG", format!("off,gupax={}", filter_env));
Builder::new()
.format(move |buf, record| {
@ -162,7 +161,9 @@ pub fn init_auto(app: &mut App) {
} else if !check_binary_path(&app.state.gupax.node_path, ProcessName::Node) {
warn!("Gupaxx | Node path is not valid! Skipping auto-node...");
} else if process_running(ProcessName::Node) {
warn!("Gupaxx | Node instance is already running outside of Gupaxx ! Skipping auto-node...");
warn!(
"Gupaxx | Node instance is already running outside of Gupaxx ! Skipping auto-node..."
);
} else {
// enable hugepage on linux
// sudo sysctl vm.nr_hugepages=3072
@ -184,7 +185,9 @@ pub fn init_auto(app: &mut App) {
} else if !check_binary_path(&app.state.gupax.p2pool_path, ProcessName::P2pool) {
warn!("Gupaxx | P2Pool path is not valid! Skipping auto-p2pool...");
} else if process_running(crate::helper::ProcessName::P2pool) {
warn!("Gupaxx | P2pool instance is already running outside of Gupaxx ! Skipping auto-node...");
warn!(
"Gupaxx | P2pool instance is already running outside of Gupaxx ! Skipping auto-node..."
);
} else {
let backup_hosts = app.gather_backup_hosts();
Helper::start_p2pool(
@ -205,7 +208,9 @@ pub fn init_auto(app: &mut App) {
} else if !check_binary_path(&app.state.gupax.xmrig_path, ProcessName::Xmrig) {
warn!("Gupaxx | XMRig path is not valid! Skipping auto-xmrig...");
} else if process_running(crate::helper::ProcessName::Xmrig) {
warn!("Gupaxx | Xmrig instance is already running outside of Gupaxx ! Skipping auto-node...");
warn!(
"Gupaxx | Xmrig instance is already running outside of Gupaxx ! Skipping auto-node..."
);
} else if cfg!(windows) {
Helper::start_xmrig(
&app.helper,
@ -227,7 +232,9 @@ pub fn init_auto(app: &mut App) {
} else if !check_binary_path(&app.state.gupax.xmrig_proxy_path, ProcessName::XmrigProxy) {
warn!("Gupaxx | Xmrig-Proxy path is not valid! Skipping auto-xmrig_proxy...");
} else if process_running(crate::helper::ProcessName::XmrigProxy) {
warn!("Gupaxx | Xmrig-Proxy instance is already running outside of Gupaxx ! Skipping auto-node...");
warn!(
"Gupaxx | Xmrig-Proxy instance is already running outside of Gupaxx ! Skipping auto-node..."
);
} else {
Helper::start_xp(
&app.helper,

View file

@ -29,9 +29,7 @@ use crate::app::App;
use crate::cli::Cli;
//---------------------------------------------------------------------------------------------------- Imports
use crate::constants::*;
use crate::inits::init_auto;
use crate::inits::init_logger;
use crate::inits::init_options;
use crate::inits::{init_auto, init_logger, init_options};
use crate::miscs::clean_dir;
use crate::utils::*;
use clap::Parser;
@ -71,7 +69,9 @@ fn main() {
let selected_height = app.state.gupax.selected_height as f32;
let initial_window_size = if selected_width > APP_MAX_WIDTH || selected_height > APP_MAX_HEIGHT
{
warn!("App | Set width or height was greater than the maximum! Starting with the default resolution...");
warn!(
"App | Set width or height was greater than the maximum! Starting with the default resolution..."
);
Some(Vec2::new(APP_DEFAULT_WIDTH, APP_DEFAULT_HEIGHT))
} else {
Some(Vec2::new(
@ -90,7 +90,9 @@ fn main() {
let resolution = Vec2::new(selected_width, selected_height);
// Run Gupax.
info!("/*************************************/ Init ... OK /*************************************/");
info!(
"/*************************************/ Init ... OK /*************************************/"
);
eframe::run_native(
&app.name_version.clone(),
options,

View file

@ -21,8 +21,8 @@ pub const XMRIG_VERSION: &str = "v6.21.1";
pub const XMRIG_PROXY_VERSION: &str = "v6.21.1";
pub const NODE_VERSION: &str = "v18.3.4";
pub const COMMIT: &str = env!("COMMIT"); // set in build.rs
// e.g: Gupax_v1_0_0
// Would have been [Gupax_v1.0.0] but P2Pool truncates everything after [.]
// e.g: Gupax_v1_0_0
// Would have been [Gupax_v1.0.0] but P2Pool truncates everything after [.]
pub const GUPAX_VERSION_UNDERSCORE: &str = concat!(
"Gupaxx_v",
env!("CARGO_PKG_VERSION_MAJOR"),
@ -88,8 +88,8 @@ pub const P2POOL_API_PATH_NETWORK: &str = "network/stats";
#[cfg(target_family = "unix")]
pub const P2POOL_API_PATH_POOL: &str = "pool/stats";
pub const XMRIG_API_SUMMARY_URI: &str = "1/summary"; // The default relative URI of XMRig's API summary
// pub const XMRIG_API_CONFIG_URI: &str = "1/config"; // The default relative URI of XMRig's API config
// todo allow user to change the port of the http api for xmrig and xmrig-proxy
// pub const XMRIG_API_CONFIG_URI: &str = "1/config"; // The default relative URI of XMRig's API config
// todo allow user to change the port of the http api for xmrig and xmrig-proxy
pub const XMRIG_CONFIG_URL: &str = "http://127.0.0.1:18088/1/config"; // The default relative URI of XMRig's API config
pub const XMRIG_PROXY_CONFIG_URL: &str = "http://127.0.0.1:18089/1/config"; // The default relative URI of XMRig Proxy's API config
pub const XMRIG_SUMMARY_URL: &str = "http://127.0.0.1:18088/1/summary"; // The default relative URI of XMRig's API config
@ -137,10 +137,10 @@ pub const XMRIG_PROXY_ADVANCED: &str = r#"Use advanced XMRig-Proxy settings:
- Custom HTTP API IP/Port
- TLS setting
- Keepalive setting"#;
pub const XMRIG_PROXY_PATH_NOT_FILE: &str = "XMRig-Proxy binary not found at the given PATH in the Gupaxx tab! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where XMRig-Proxy is located.";
pub const XMRIG_PROXY_PATH_NOT_FILE: &str = "XMRig-Proxy binary not found at the given PATH in the Gupaxx tab! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where XMRig-Proxy is located.";
pub const XMRIG_PROXY_PATH_NOT_VALID: &str = "XMRig-Proxy binary at the given PATH in the Gupaxx tab doesn't look like XMRig-Proxy! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where XMRig-Proxy is located.";
pub const XMRIG_PROXY_PATH_OK: &str = "XMRig-Proxy was found at the given PATH";
pub const XMRIG_PROXY_PATH_EMPTY: &str = "XMRig-Proxy PATH is empty! To fix: goto the [GupaxxAdvanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PROXY_PATH_EMPTY: &str = "XMRig-Proxy PATH is empty! To fix: goto the [GupaxxAdvanced] tab, select [Open] and specify where XMRig is located.";
pub const STATUS_XMRIG_PROXY_UPTIME: &str = "How long XMRig-Proxy has been online";
pub const STATUS_XMRIG_PROXY_POOL: &str = "The pool XMRig-Proxy is currently mining to";
pub const STATUS_XMRIG_PROXY_HASHRATE: &str = "The average hashrate of XMRig-Proxy";
@ -204,8 +204,7 @@ pub const OS_NAME: &str = "Linux";
// Tooltips
// Status
pub const STATUS_GUPAX_UPTIME: &str = "How long Gupaxx has been online";
pub const STATUS_GUPAX_CPU_USAGE: &str =
"How much CPU Gupaxx is currently using. This accounts for all your threads (it is out of 100%)";
pub const STATUS_GUPAX_CPU_USAGE: &str = "How much CPU Gupaxx is currently using. This accounts for all your threads (it is out of 100%)";
pub const STATUS_GUPAX_MEMORY_USAGE: &str =
"How much memory Gupaxx is currently using in Megabytes";
pub const STATUS_GUPAX_SYSTEM_CPU_USAGE: &str = "How much CPU your entire system is currently using. This accounts for all your threads (it is out of 100%)";
@ -215,9 +214,9 @@ pub const STATUS_GUPAX_SYSTEM_CPU_MODEL: &str =
"The detected model of your system's CPU and its current frequency";
//--
pub const STATUS_P2POOL_UPTIME: &str = "How long P2Pool has been online";
pub const STATUS_P2POOL_PAYOUTS: &str = "The total amount of payouts received in this instance of P2Pool and an extrapolated estimate of how many you will receive. Warning: these stats will be quite inaccurate if your P2Pool hasn't been running for a long time!";
pub const STATUS_P2POOL_XMR: &str = "The total amount of XMR mined in this instance of P2Pool and an extrapolated estimate of how many you will mine in the future. Warning: these stats will be quite inaccurate if your P2Pool hasn't been running for a long time!";
pub const STATUS_P2POOL_HASHRATE: &str = "The total amount of hashrate your P2Pool has pointed at it in 15 minute, 1 hour, and 24 hour averages";
pub const STATUS_P2POOL_PAYOUTS: &str = "The total amount of payouts received in this instance of P2Pool and an extrapolated estimate of how many you will receive. Warning: these stats will be quite inaccurate if your P2Pool hasn't been running for a long time!";
pub const STATUS_P2POOL_XMR: &str = "The total amount of XMR mined in this instance of P2Pool and an extrapolated estimate of how many you will mine in the future. Warning: these stats will be quite inaccurate if your P2Pool hasn't been running for a long time!";
pub const STATUS_P2POOL_HASHRATE: &str = "The total amount of hashrate your P2Pool has pointed at it in 15 minute, 1 hour, and 24 hour averages";
pub const STATUS_P2POOL_SHARES: &str = "The total amount of shares found on P2Pool";
pub const STATUS_P2POOL_CURRENT_SHARES: &str =
"Current shares valid in the PPLNS Window for your address";
@ -261,15 +260,15 @@ pub const STATUS_SUBMENU_PROCESSES: &str =
pub const STATUS_SUBMENU_P2POOL: &str = "View P2Pool specific data";
pub const STATUS_SUBMENU_HASHRATE: &str = "Compare your CPU hashrate with others";
//-- 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 Gupaxx 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 Gupaxx and 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 Gupaxx 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 Gupaxx and P2Pool.";
pub const STATUS_SUBMENU_LATEST: &str = "Sort the payouts from latest to oldest";
pub const STATUS_SUBMENU_OLDEST: &str = "Sort the payouts from oldest to latest";
pub const STATUS_SUBMENU_BIGGEST: &str = "Sort the payouts from biggest to smallest";
pub const STATUS_SUBMENU_SMALLEST: &str = "Sort the payouts from smallest to biggest";
pub const STATUS_SUBMENU_AUTOMATIC: &str =
"Automatically calculate share/block time with your current P2Pool 1 hour average hashrate";
pub const STATUS_SUBMENU_MANUAL: &str = "Manually input a hashrate to calculate share/block time with current P2Pool/Monero network stats";
pub const STATUS_SUBMENU_MANUAL: &str = "Manually input a hashrate to calculate share/block time with current P2Pool/Monero network stats";
pub const STATUS_SUBMENU_HASH: &str = "Use [Hash] as the hashrate metric";
pub const STATUS_SUBMENU_KILO: &str = "Use [Kilo] as the hashrate metric (1,000x hash)";
pub const STATUS_SUBMENU_MEGA: &str = "Use [Mega] as the hashrate metric (1,000,000x hash)";
@ -281,9 +280,9 @@ pub const STATUS_SUBMENU_P2POOL_SHARE_MEAN: &str =
"The average time it takes for your hashrate to find a share on P2Pool";
pub const STATUS_SUBMENU_SOLO_BLOCK_MEAN: &str =
"The average time it would take for your hashrate to find a block solo mining Monero";
pub const STATUS_SUBMENU_MONERO_DIFFICULTY: &str = "The current Monero network's difficulty (how many hashes it will take on average to find a block)";
pub const STATUS_SUBMENU_MONERO_DIFFICULTY: &str = "The current Monero network's difficulty (how many hashes it will take on average to find a block)";
pub const STATUS_SUBMENU_MONERO_HASHRATE: &str = "The current Monero network's hashrate";
pub const STATUS_SUBMENU_P2POOL_DIFFICULTY: &str = "The current P2Pool network's difficulty (how many hashes it will take on average to find a share)";
pub const STATUS_SUBMENU_P2POOL_DIFFICULTY: &str = "The current P2Pool network's difficulty (how many hashes it will take on average to find a share)";
pub const STATUS_SUBMENU_P2POOL_HASHRATE: &str = "The current P2Pool network's hashrate";
pub const STATUS_SUBMENU_P2POOL_MINERS: &str = "The current amount of miners on P2Pool";
pub const STATUS_SUBMENU_P2POOL_DOMINANCE: &str =
@ -305,9 +304,9 @@ pub const STATUS_SUBMENU_YOUR_AVERAGE: &str =
"The average hashrate of your CPU based off the data at [https://xmrig.com/benchmark]";
pub const STATUS_SUBMENU_YOUR_LOW: &str =
"The lowest hashrate recorded for your CPU on [https://xmrig.com/benchmark]";
pub const STATUS_SUBMENU_OTHER_CPUS: &str = "A list of ALL the recorded CPU benchmarks. The CPUs most similar to yours are listed first. All this data is taken from [https://xmrig.com/benchmark].";
pub const STATUS_SUBMENU_OTHER_CPUS: &str = "A list of ALL the recorded CPU benchmarks. The CPUs most similar to yours are listed first. All this data is taken from [https://xmrig.com/benchmark].";
pub const STATUS_SUBMENU_OTHER_CPU: &str = "The CPU name";
pub const STATUS_SUBMENU_OTHER_RELATIVE: &str = "The relative hashrate power compared to the fastest recorded CPU, which is current: [AMD EPYC 7T83 64-Core Processor]";
pub const STATUS_SUBMENU_OTHER_RELATIVE: &str = "The relative hashrate power compared to the fastest recorded CPU, which is current: [AMD EPYC 7T83 64-Core Processor]";
pub const STATUS_SUBMENU_OTHER_HIGH: &str = "Highest hashrate record";
pub const STATUS_SUBMENU_OTHER_AVERAGE: &str = "Average hashrate";
pub const STATUS_SUBMENU_OTHER_LOW: &str = "Lowest hashrate record";
@ -316,11 +315,9 @@ pub const STATUS_SUBMENU_OTHER_BENCHMARKS: &str =
"How many benchmarks this CPU has had posted to [https://xmrig.com/benchmark]";
// Gupaxx
pub const GUPAX_UPDATE: &str =
"Check for updates on Gupaxx and bundled versions of P2Pool and XMRig via GitHub's API and upgrade automatically";
pub const GUPAX_UPDATE: &str = "Check for updates on Gupaxx and bundled versions of P2Pool and XMRig via GitHub's API and upgrade automatically";
pub const GUPAX_AUTO_UPDATE: &str = "Automatically check for updates at startup";
pub const GUPAX_BUNDLED_UPDATE: &str =
"Update XMRig and P2Pool with bundled versions of latest Gupaxx. It will replace any present xmrig and p2pool binary in their specified path.";
pub const GUPAX_BUNDLED_UPDATE: &str = "Update XMRig and P2Pool with bundled versions of latest Gupaxx. It will replace any present xmrig and p2pool binary in their specified path.";
pub const GUPAX_SHOULD_RESTART: &str =
"Gupaxx was updated. A restart is recommended but not required";
// #[cfg(not(target_os = "macos"))]
@ -329,11 +326,11 @@ pub const GUPAX_SHOULD_RESTART: &str =
// pub const GUPAX_UPDATE_VIA_TOR: &str = "WARNING: This option is unstable on macOS. Update through the Tor network. Tor is embedded within Gupax; a Tor system proxy is not required";
pub const GUPAX_ASK_BEFORE_QUIT: &str = "Ask before quitting Gupaxx";
pub const GUPAX_SAVE_BEFORE_QUIT: &str = "Automatically save any changed settings before quitting";
pub const GUPAX_AUTO_P2POOL: &str = "Automatically start P2Pool on Gupaxx startup. If you are using [P2Pool Simple], this will NOT wait for your [Auto-Ping] to finish, it will start P2Pool on the pool you already have selected. This option will fail if your P2Pool settings aren't valid!";
pub const GUPAX_AUTO_NODE: &str = "Automatically start Node on Gupaxx startup. This option will fail if your P2Pool settings aren't valid!";
pub const GUPAX_AUTO_XMRIG: &str = "Automatically start XMRig on Gupaxx startup. This option will fail if your XMRig settings aren't valid!";
pub const GUPAX_AUTO_P2POOL: &str = "Automatically start P2Pool on Gupaxx startup. If you are using [P2Pool Simple], this will NOT wait for your [Auto-Ping] to finish, it will start P2Pool on the pool you already have selected. This option will fail if your P2Pool settings aren't valid!";
pub const GUPAX_AUTO_NODE: &str = "Automatically start Node on Gupaxx startup. This option will fail if your P2Pool settings aren't valid!";
pub const GUPAX_AUTO_XMRIG: &str = "Automatically start XMRig on Gupaxx startup. This option will fail if your XMRig settings aren't valid!";
pub const GUPAX_AUTO_XMRIG_PROXY: &str = "Automatically start XMRig-Proxy on Gupaxx startup.";
pub const GUPAX_AUTO_XVB: &str = "Automatically start XvB on Gupaxx startup. This option will fail if your XvB settings aren't valid!";
pub const GUPAX_AUTO_XVB: &str = "Automatically start XvB on Gupaxx startup. This option will fail if your XvB settings aren't valid!";
pub const GUPAX_ADJUST: &str = "Adjust and set the width/height of the Gupaxx window";
pub const GUPAX_WIDTH: &str = "Set the width of the Gupaxx window";
pub const GUPAX_HEIGHT: &str = "Set the height of the Gupaxx window";
@ -369,8 +366,8 @@ pub const GUPAX_PATH_XMRIG: &str = "The location of the XMRig binary: Both absol
pub const GUPAX_PATH_XMRIG_PROXY: &str = "The location of the XMRig-Proxy binary: Both absolute and relative paths are accepted; A red [X] will appear if there is no file found at the given path";
// P2Pool
pub const P2POOL_MAIN: &str = "Use the P2Pool main-chain. This P2Pool finds blocks faster, but has a higher difficulty. Suitable for miners with more than 50kH/s";
pub const P2POOL_MINI: &str = "Use the P2Pool mini-chain. This P2Pool finds blocks slower, but has a lower difficulty. Suitable for miners with less than 50kH/s";
pub const P2POOL_MAIN: &str = "Use the P2Pool main-chain. This P2Pool finds blocks faster, but has a higher difficulty. Suitable for miners with more than 50kH/s";
pub const P2POOL_MINI: &str = "Use the P2Pool mini-chain. This P2Pool finds blocks slower, but has a lower difficulty. Suitable for miners with less than 50kH/s";
pub const P2POOL_OUT: &str = "How many out-bound peers to connect to? (you connecting to others)";
pub const P2POOL_IN: &str = "How many in-bound peers to allow? (others connecting to you)";
pub const P2POOL_LOG: &str = "Verbosity of the console log";
@ -387,7 +384,7 @@ pub const P2POOL_SELECT_RANDOM: &str = "Select a random remote Monero node";
pub const P2POOL_SELECT_LAST: &str = "Select the previous remote Monero node";
pub const P2POOL_SELECT_NEXT: &str = "Select the next remote Monero node";
pub const P2POOL_PING: &str = "Ping the built-in remote Monero nodes";
pub const P2POOL_ADDRESS: &str = "You must use a primary Monero address to mine on P2Pool (starts with a 4). It is highly recommended to create a new wallet since addresses are public on P2Pool!";
pub const P2POOL_ADDRESS: &str = "You must use a primary Monero address to mine on P2Pool (starts with a 4). It is highly recommended to create a new wallet since addresses are public on P2Pool!";
pub const P2POOL_COMMUNITY_NODE_WARNING: &str = r#"TL;DR: Run & use your own Monero Node.
Using a Remote Monero Node is convenient but comes at the cost of privacy and reliability.
@ -479,11 +476,11 @@ pub const XMRIG_INPUT: &str = "Send a command to XMRig";
pub const XMRIG_ARGUMENTS: &str = r#"WARNING: Use [--no-color] and make sure to set [--http-host <IP>] & [--http-port <PORT>] so that the [Status] tab can work!
Start XMRig with these arguments and override all below settings"#;
pub const XMRIG_ADDRESS: &str = "Specify which Monero address to payout to. This does nothing if mining to P2Pool since the address being paid out to will be the one P2Pool started with. This doubles as a rig identifier for P2Pool and some pools.";
pub const XMRIG_NAME: &str = "Add a unique name to identify this pool; Only [A-Za-z0-9-_.] and spaces allowed; Max length = 30 characters";
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_ADDRESS: &str = "Specify which Monero address to payout to. This does nothing if mining to P2Pool since the address being paid out to will be the one P2Pool started with. This doubles as a rig identifier for P2Pool and some pools.";
pub const XMRIG_NAME: &str = "Add a unique name to identify this pool; Only [A-Za-z0-9-_.] and spaces allowed; Max length = 30 characters";
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";
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";
@ -494,10 +491,10 @@ pub const XMRIG_API_PORT: &str =
pub const XMRIG_TLS: &str = "Enable SSL/TLS connections (needs pool support)";
pub const XMRIG_KEEPALIVE: &str = "Send keepalive packets to prevent timeout (needs pool support)";
pub const XMRIG_THREADS: &str = "Number of CPU threads to use for mining";
pub const XMRIG_PATH_NOT_FILE: &str = "XMRig binary not found at the given PATH in the Gupaxxtab! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PATH_NOT_FILE: &str = "XMRig binary not found at the given PATH in the Gupaxxtab! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PATH_NOT_VALID: &str = "XMRig binary at the given PATH in the Gupaxxtab doesn't look like XMRig! To fix: goto the [Gupaxx Advanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PATH_OK: &str = "XMRig was found at the given PATH";
pub const XMRIG_PATH_EMPTY: &str = "XMRig PATH is empty! To fix: goto the [GupaxxAdvanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PATH_EMPTY: &str = "XMRig PATH is empty! To fix: goto the [GupaxxAdvanced] tab, select [Open] and specify where XMRig is located.";
pub const XMRIG_PROXY_URL: &str = "https://github.com/xmrig/xmrig-proxy";
// XvB
@ -528,8 +525,7 @@ pub const XVB_SIDE_MARGIN_1H: f32 = 1.20;
pub const XVB_TIME_ALGO: u32 = 600;
pub const XVB_MIN_TIME_SEND: u32 = (XVB_TIME_ALGO as f32 * 0.01) as u32;
pub const XVB_TOKEN_LEN: usize = 9;
pub const XVB_HERO_SELECT: &str =
"Donate as much as possible while keeping a share on p2pool, increases the odds of your round winning\nWhen modified, the algorithm will use the new choice at the next decision.";
pub const XVB_HERO_SELECT: &str = "Donate as much as possible while keeping a share on p2pool, increases the odds of your round winning\nWhen modified, the algorithm will use the new choice at the next decision.";
pub const XVB_TOKEN_FIELD: &str = "Token";
pub const XVB_FAILURE_FIELD: &str = "Failures";
pub const XVB_DONATED_1H_FIELD: &str = "Donated last hour";

View file

@ -184,7 +184,9 @@ pub fn detect_new_node_xmrig(s: &str) -> Option<XvbNode> {
}
}
}
warn!("a line on xmrig console was detected as using a new pool but the syntax was not recognized or it was not a pool useable for the algorithm.");
warn!(
"a line on xmrig console was detected as using a new pool but the syntax was not recognized or it was not a pool useable for the algorithm."
);
None
}
// this detection removes the need to update pub_api.node everytime xmrig/proxy are updated to mine to another p2pool node.
@ -204,7 +206,9 @@ pub fn detect_node_xmrig(s: &str) -> Option<String> {
return Some(name);
}
}
warn!("a line on xmrig console was detected as using a new pool but the syntax was not recognized or it was not a pool useable for the algorithm.");
warn!(
"a line on xmrig console was detected as using a new pool but the syntax was not recognized or it was not a pool useable for the algorithm."
);
None
}
pub fn estimated_hr(s: &str) -> Option<f32> {
@ -282,7 +286,10 @@ mod test {
fn build_regexes() {
let r = Regexes::new();
assert!(Regex::is_match(&r.name, "_this_ is... a n-a-m-e."));
assert!(Regex::is_match(&r.address, "44hintoFpuo3ugKfcqJvh5BmrsTRpnTasJmetKC4VXCt6QDtbHVuixdTtsm6Ptp7Y8haXnJ6j8Gj2dra8CKy5ewz7Vi9CYW"));
assert!(Regex::is_match(
&r.address,
"44hintoFpuo3ugKfcqJvh5BmrsTRpnTasJmetKC4VXCt6QDtbHVuixdTtsm6Ptp7Y8haXnJ6j8Gj2dra8CKy5ewz7Vi9CYW"
));
assert!(Regex::is_match(&r.ipv4, "192.168.1.2"));
assert!(Regex::is_match(&r.ipv4, "127.0.0.1"));
assert!(Regex::is_match(&r.domain, "sub.domain.com"));

View file

@ -284,13 +284,13 @@ impl PayoutOrd {
// self.0 = The [Vec] within [PayoutOrd]
// b.1.0 = [b] is [(String, AtomicUnit, HumanNumber)], [.1] is the [AtomicUnit] inside it, [.0] is the [u64] inside that
// a.1.0 = Same deal, but we compare it with the previous value (b)
self.0.sort_by(|a, b| b.1 .0.cmp(&a.1 .0));
self.0.sort_by(|a, b| b.1.0.cmp(&a.1.0));
}
// These sorting functions take around [0.0035~] seconds on a Ryzen 5950x
// given a Vec filled with 1_000_000 elements, not bad.
pub fn sort_payout_low_to_high(&mut self) {
self.0.sort_by(|a, b| a.1 .0.cmp(&b.1 .0));
self.0.sort_by(|a, b| a.1.0.cmp(&b.1.0));
}
// Returns a reversed [Iter] of the [PayoutOrd]