mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 06:39:21 +00:00
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
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:
parent
fd4e62342e
commit
0ea492d930
39 changed files with 259 additions and 196 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
/target
|
||||
/ra_target
|
||||
/feature
|
||||
.DS_Store
|
||||
rustc-ice-*
|
||||
|
|
|
@ -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 = []
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 ------------------";
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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::*};
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
};
|
||||
|
|
|
@ -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) {
|
||||
|
@ -204,10 +210,7 @@ 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,
|
||||
args, api_path_local, api_path_network, api_path_pool,
|
||||
));
|
||||
|
||||
// Spawn watchdog thread
|
||||
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
@ -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) => {
|
||||
|
|
|
@ -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.",
|
||||
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);
|
||||
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
|
||||
|
|
|
@ -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,7 +650,9 @@ 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.
|
||||
|
@ -646,7 +660,7 @@ async fn check_state_outcauses_xvb(
|
|||
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
|
||||
ProcessName::Xvb,
|
||||
);
|
||||
output_console(
|
||||
&mut gui_api.lock().unwrap().output,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)]
|
||||
|
|
19
src/inits.rs
19
src/inits.rs
|
@ -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,
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -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,
|
||||
|
|
|
@ -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%)";
|
||||
|
@ -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"))]
|
||||
|
@ -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";
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in a new issue