mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
feat: beta release 0.1.3
feat: take into account external HR for p2pool and XvB fix: retrograde to xmrig 6.20.1 to fix issue with xmrig stats showing only 1/4h later
This commit is contained in:
parent
1675b716f8
commit
e9e630ae09
10 changed files with 235 additions and 34 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,3 +1,17 @@
|
||||||
|
# v0.1.3
|
||||||
|
Fix release for beta version.
|
||||||
|
This version is only made for testing purposes and have feedbacks.
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
take into account outside HR
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
downgrade to xmrig 6.21.1 to solve xmrig stats showing only after 15m
|
||||||
|
|
||||||
|
## Bundled Versions
|
||||||
|
* [`P2Pool v3.10`](https://github.com/SChernykh/p2pool/releases/tag/v3.10)
|
||||||
|
* [`XMRig v6.21.1`](https://github.com/xmrig/xmrig/releases/tag/v6.21.1)
|
||||||
|
|
||||||
# v0.1.2
|
# v0.1.2
|
||||||
Fix release for beta version.
|
Fix release for beta version.
|
||||||
This version is only made for testing purposes and have feedbacks.
|
This version is only made for testing purposes and have feedbacks.
|
||||||
|
|
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -952,9 +952,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.35"
|
version = "0.4.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
|
checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"android-tzdata",
|
"android-tzdata",
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
|
@ -1432,7 +1432,7 @@ dependencies = [
|
||||||
"egui",
|
"egui",
|
||||||
"glow",
|
"glow",
|
||||||
"log",
|
"log",
|
||||||
"memoffset 0.9.0",
|
"memoffset 0.9.1",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"winit",
|
"winit",
|
||||||
|
@ -2064,7 +2064,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gupaxx"
|
name = "gupaxx"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"benri",
|
"benri",
|
||||||
|
@ -2682,9 +2682,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memoffset"
|
name = "memoffset"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
]
|
]
|
||||||
|
@ -2871,7 +2871,7 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"libc",
|
"libc",
|
||||||
"memoffset 0.9.0",
|
"memoffset 0.9.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3629,9 +3629,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "renderdoc-sys"
|
name = "renderdoc-sys"
|
||||||
|
@ -4490,7 +4490,7 @@ version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
|
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memoffset 0.9.0",
|
"memoffset 0.9.1",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
@ -5666,9 +5666,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd-sys"
|
name = "zstd-sys"
|
||||||
version = "2.0.9+zstd.1.5.5"
|
version = "2.0.10+zstd.1.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656"
|
checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
cargo-features = ["profile-rustflags"]
|
cargo-features = ["profile-rustflags"]
|
||||||
[package]
|
[package]
|
||||||
name = "gupaxx"
|
name = "gupaxx"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["cyrix126 <gupaxx@baermail.fr>"]
|
authors = ["cyrix126 <gupaxx@baermail.fr>"]
|
||||||
description = "Fork of Gupax integrating the XMRvsBeast Raffle "
|
description = "Fork of Gupax integrating the XMRvsBeast Raffle "
|
||||||
documentation = "https://github.com/cyrix126/gupaxx"
|
documentation = "https://github.com/cyrix126/gupaxx"
|
||||||
|
|
|
@ -21,4 +21,4 @@ The rendering of the benchmark table and of console outputs were calculating eve
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
With the upgrade of dependencies, cargo audit show only one allowed warning instead of 5 vulnerabilities and 4 allowed warnings.
|
With the upgrade of dependencies, cargo audit show no warnings instead of 5 vulnerabilities and 4 allowed warnings.
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
- [x] button to autostart
|
- [x] button to autostart
|
||||||
- [x] distribute hashrate conforming to the algorithm.
|
- [x] distribute hashrate conforming to the algorithm.
|
||||||
- [x] check every 10 minutes average Xmrig HR of last 15 minutes
|
- [x] check every 10 minutes average Xmrig HR of last 15 minutes
|
||||||
|
- [x] take into account outside HR
|
||||||
|
- [x] mining on p2pool
|
||||||
|
- [x] mining on XvB
|
||||||
- [x] ask Xmrig to mine on p2pool
|
- [x] ask Xmrig to mine on p2pool
|
||||||
- [x] generate token for xmrig
|
- [x] generate token for xmrig
|
||||||
- [x] enable xmrig with remote access control
|
- [x] enable xmrig with remote access control
|
||||||
|
|
|
@ -7,7 +7,9 @@ use crate::helper::ProcessSignal;
|
||||||
use crate::helper::ProcessState;
|
use crate::helper::ProcessState;
|
||||||
use crate::regex::contains_end_status;
|
use crate::regex::contains_end_status;
|
||||||
use crate::regex::contains_statuscommand;
|
use crate::regex::contains_statuscommand;
|
||||||
|
use crate::regex::contains_yourhashrate;
|
||||||
use crate::regex::contains_yourshare;
|
use crate::regex::contains_yourshare;
|
||||||
|
use crate::regex::estimated_hr;
|
||||||
use crate::regex::nb_current_shares;
|
use crate::regex::nb_current_shares;
|
||||||
use crate::regex::P2POOL_REGEX;
|
use crate::regex::P2POOL_REGEX;
|
||||||
use crate::{
|
use crate::{
|
||||||
|
@ -67,6 +69,17 @@ impl Helper {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if status_output {
|
if status_output {
|
||||||
|
if contains_yourhashrate(&line) {
|
||||||
|
if let Some(ehr) = estimated_hr(&line) {
|
||||||
|
debug!(
|
||||||
|
"P2pool | PTY getting current estimated HR data from status: {} share",
|
||||||
|
ehr
|
||||||
|
);
|
||||||
|
lock!(gui_api).sidechain_ehr = ehr;
|
||||||
|
} else {
|
||||||
|
error!("P2pool | PTY Getting data from status: Lines contains Your shares but no value found: {}", line);
|
||||||
|
}
|
||||||
|
}
|
||||||
if contains_yourshare(&line) {
|
if contains_yourshare(&line) {
|
||||||
// update sidechain shares
|
// update sidechain shares
|
||||||
if let Some(shares) = nb_current_shares(&line) {
|
if let Some(shares) = nb_current_shares(&line) {
|
||||||
|
@ -811,6 +824,7 @@ pub struct PubP2poolApi {
|
||||||
pub user_monero_percent: HumanNumber, // How much percent the user's hashrate accounts for in all of Monero hashrate.
|
pub user_monero_percent: HumanNumber, // How much percent the user's hashrate accounts for in all of Monero hashrate.
|
||||||
// from status
|
// from status
|
||||||
pub sidechain_shares: u32,
|
pub sidechain_shares: u32,
|
||||||
|
pub sidechain_ehr: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PubP2poolApi {
|
impl Default for PubP2poolApi {
|
||||||
|
@ -861,6 +875,7 @@ impl PubP2poolApi {
|
||||||
user_p2pool_percent: HumanNumber::unknown(),
|
user_p2pool_percent: HumanNumber::unknown(),
|
||||||
user_monero_percent: HumanNumber::unknown(),
|
user_monero_percent: HumanNumber::unknown(),
|
||||||
sidechain_shares: 0,
|
sidechain_shares: 0,
|
||||||
|
sidechain_ehr: 0.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ use hyper_tls::HttpsConnector;
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, warn};
|
||||||
use readable::up::Uptime;
|
use readable::up::Uptime;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::collections::VecDeque;
|
||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -405,6 +406,26 @@ impl Helper {
|
||||||
XVB_TIME_ALGO - time_donated, time_donated
|
XVB_TIME_ALGO - time_donated, time_donated
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
let hashrate_xmrig = lock!(gui_api_xmrig).hashrate_raw_15m;
|
||||||
|
debug!("Xvb Process | Local HR is {}H/s ", hashrate_xmrig);
|
||||||
|
lock!(gui_api).p2pool_sent_last_hour_samples.pop_back();
|
||||||
|
lock!(gui_api).p2pool_sent_last_hour_samples.push_front(
|
||||||
|
hashrate_xmrig
|
||||||
|
* ((XVB_TIME_ALGO - time_donated) / XVB_TIME_ALGO) as f32,
|
||||||
|
);
|
||||||
|
debug!(
|
||||||
|
"Xvb Process | New average HR sent for XvB samples: {:#?}",
|
||||||
|
lock!(gui_api).p2pool_sent_last_hour_samples
|
||||||
|
);
|
||||||
|
lock!(gui_api).xvb_sent_last_hour_samples.pop_back();
|
||||||
|
lock!(gui_api)
|
||||||
|
.xvb_sent_last_hour_samples
|
||||||
|
.push_front(hashrate_xmrig * (time_donated / XVB_TIME_ALGO) as f32);
|
||||||
|
debug!(
|
||||||
|
"Xvb Process | New average HR sent for XvB samples: {:#?}",
|
||||||
|
lock!(gui_api).xvb_sent_last_hour_samples
|
||||||
|
);
|
||||||
|
|
||||||
// sleep 10m less spared time then request XMrig to mine on XvB
|
// sleep 10m less spared time then request XMrig to mine on XvB
|
||||||
let was_instant = last_algorithm;
|
let was_instant = last_algorithm;
|
||||||
let gui_api_c = gui_api.clone();
|
let gui_api_c = gui_api.clone();
|
||||||
|
@ -426,6 +447,12 @@ impl Helper {
|
||||||
} else {
|
} else {
|
||||||
output_console(&gui_api, "No share in the current PPLNS Window !");
|
output_console(&gui_api, "No share in the current PPLNS Window !");
|
||||||
output_console(&gui_api, "Mining on P2pool for the next ten minutes.");
|
output_console(&gui_api, "Mining on P2pool for the next ten minutes.");
|
||||||
|
lock!(gui_api).xvb_sent_last_hour_samples.pop_back();
|
||||||
|
lock!(gui_api)
|
||||||
|
.p2pool_sent_last_hour_samples
|
||||||
|
.push_front(lock!(gui_api_xmrig).hashrate_raw_15m);
|
||||||
|
lock!(gui_api).p2pool_sent_last_hour_samples.push_front(0.0);
|
||||||
|
lock!(gui_api).p2pool_sent_last_hour_samples.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,13 +475,14 @@ impl Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn minimum_hashrate_share(difficulty: u64, mini: bool) -> f32 {
|
// outside HR that is estimated on p2pool
|
||||||
|
fn minimum_hashrate_share(difficulty: u64, mini: bool, ohr: f32) -> f32 {
|
||||||
let pws = if mini {
|
let pws = if mini {
|
||||||
BLOCK_PPLNS_WINDOW_MINI
|
BLOCK_PPLNS_WINDOW_MINI
|
||||||
} else {
|
} else {
|
||||||
BLOCK_PPLNS_WINDOW_MAIN
|
BLOCK_PPLNS_WINDOW_MAIN
|
||||||
};
|
};
|
||||||
(difficulty / (pws * SECOND_PER_BLOCK_P2POOL)) as f32 * XVB_BUFFER
|
((difficulty / (pws * SECOND_PER_BLOCK_P2POOL)) as f32 * XVB_BUFFER) - ohr
|
||||||
}
|
}
|
||||||
fn time_that_could_be_spared(hr: f32, min_hr: f32) -> u32 {
|
fn time_that_could_be_spared(hr: f32, min_hr: f32) -> u32 {
|
||||||
// percent of time minimum
|
// percent of time minimum
|
||||||
|
@ -466,15 +494,24 @@ impl Helper {
|
||||||
}
|
}
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
fn minimum_time_for_highest_accessible_round(st: u32, hr: f32) -> u32 {
|
|
||||||
let hr_for_xvb = (st as f32 / XVB_TIME_ALGO as f32) * hr;
|
// spared time, local hr, current 1h average hr already mining on XvB, 1h average local HR sent on XvB.
|
||||||
|
fn minimum_time_for_highest_accessible_round(st: u32, lhr: f32, chr: f32, shr: f32) -> u32 {
|
||||||
|
let hr_for_xvb = (st as f32 / XVB_TIME_ALGO as f32) * lhr;
|
||||||
|
let ohr = chr - shr;
|
||||||
match hr_for_xvb {
|
match hr_for_xvb {
|
||||||
x if x > XVB_ROUND_DONOR_MEGA_MIN_HR as f32 => ((x / hr) * XVB_TIME_ALGO as f32) as u32,
|
x if x > XVB_ROUND_DONOR_MEGA_MIN_HR as f32 - ohr => {
|
||||||
x if x > XVB_ROUND_DONOR_WHALE_MIN_HR as f32 => {
|
((x / lhr) * XVB_TIME_ALGO as f32) as u32
|
||||||
((x / hr) * XVB_TIME_ALGO as f32) as u32
|
}
|
||||||
|
x if x > XVB_ROUND_DONOR_WHALE_MIN_HR as f32 - ohr => {
|
||||||
|
((x / lhr) * XVB_TIME_ALGO as f32) as u32
|
||||||
|
}
|
||||||
|
x if x > (XVB_ROUND_DONOR_VIP_MIN_HR as f32 - ohr) => {
|
||||||
|
((x / lhr) * XVB_TIME_ALGO as f32) as u32
|
||||||
|
}
|
||||||
|
x if x > XVB_ROUND_DONOR_MIN_HR as f32 - ohr => {
|
||||||
|
((x / lhr) * XVB_TIME_ALGO as f32) as u32
|
||||||
}
|
}
|
||||||
x if x > XVB_ROUND_DONOR_VIP_MIN_HR as f32 => ((x / hr) * XVB_TIME_ALGO as f32) as u32,
|
|
||||||
x if x > XVB_ROUND_DONOR_MIN_HR as f32 => ((x / hr) * XVB_TIME_ALGO as f32) as u32,
|
|
||||||
_ => 0,
|
_ => 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,16 +555,40 @@ impl Helper {
|
||||||
debug!("Xvb Process | mining on XvB pool");
|
debug!("Xvb Process | mining on XvB pool");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// push new value into samples before executing this calcul
|
||||||
|
fn calc_last_hour_avg_hash_rate(samples: &VecDeque<f32>) -> f32 {
|
||||||
|
samples.iter().sum::<f32>() / samples.len() as f32
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------- Public XvB API
|
//---------------------------------------------------------------------------------------------------- Public XvB API
|
||||||
use serde_this_or_that::as_u64;
|
use serde_this_or_that::as_u64;
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PubXvbApi {
|
pub struct PubXvbApi {
|
||||||
pub output: String,
|
pub output: String,
|
||||||
pub uptime: u64,
|
pub uptime: u64,
|
||||||
|
pub xvb_sent_last_hour_samples: VecDeque<f32>,
|
||||||
|
pub p2pool_sent_last_hour_samples: VecDeque<f32>,
|
||||||
pub stats_pub: XvbPubStats,
|
pub stats_pub: XvbPubStats,
|
||||||
pub stats_priv: XvbPrivStats,
|
pub stats_priv: XvbPrivStats,
|
||||||
}
|
}
|
||||||
|
impl Default for PubXvbApi {
|
||||||
|
fn default() -> Self {
|
||||||
|
let capacity = (3600 / XVB_TIME_ALGO) as usize;
|
||||||
|
let mut p2pool_sent_last_hour_samples = VecDeque::with_capacity(capacity);
|
||||||
|
for _ in 0..capacity {
|
||||||
|
p2pool_sent_last_hour_samples.push_back(0.0f32);
|
||||||
|
}
|
||||||
|
let xvb_sent_last_hour_samples = p2pool_sent_last_hour_samples.clone();
|
||||||
|
Self {
|
||||||
|
output: Default::default(),
|
||||||
|
uptime: Default::default(),
|
||||||
|
xvb_sent_last_hour_samples,
|
||||||
|
p2pool_sent_last_hour_samples,
|
||||||
|
stats_pub: Default::default(),
|
||||||
|
stats_priv: Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default, Deserialize)]
|
#[derive(Debug, Clone, Default, Deserialize)]
|
||||||
pub struct XvbPubStats {
|
pub struct XvbPubStats {
|
||||||
|
@ -621,23 +682,44 @@ impl XvbPrivStats {
|
||||||
state_p2pool: &crate::disk::state::P2pool,
|
state_p2pool: &crate::disk::state::P2pool,
|
||||||
state_xvb: &crate::disk::state::Xvb,
|
state_xvb: &crate::disk::state::Xvb,
|
||||||
) -> u32 {
|
) -> u32 {
|
||||||
let hr = lock!(gui_api_xmrig).hashrate_raw_15m;
|
let lhr = lock!(gui_api_xmrig).hashrate_raw_15m;
|
||||||
let min_hr = Helper::minimum_hashrate_share(
|
let p2pool_ehr = lock!(gui_api_p2pool).sidechain_ehr;
|
||||||
|
// what if ehr stay still for the next ten minutes ? mHR will augment every ten minutes because it thinks that oHR is decreasing.
|
||||||
|
//
|
||||||
|
let p2pool_ohr = p2pool_ehr
|
||||||
|
- Helper::calc_last_hour_avg_hash_rate(
|
||||||
|
&lock!(gui_api_xvb).p2pool_sent_last_hour_samples,
|
||||||
|
);
|
||||||
|
let mut min_hr = Helper::minimum_hashrate_share(
|
||||||
lock!(gui_api_p2pool).p2pool_difficulty_u64,
|
lock!(gui_api_p2pool).p2pool_difficulty_u64,
|
||||||
state_p2pool.mini,
|
state_p2pool.mini,
|
||||||
|
p2pool_ohr,
|
||||||
);
|
);
|
||||||
debug!("Xvb Process | hr {}, min_hr: {} ", hr, min_hr);
|
if min_hr.is_sign_negative() {
|
||||||
|
min_hr = 0.0;
|
||||||
|
}
|
||||||
|
debug!("Xvb Process | hr {}, min_hr: {} ", lhr, min_hr);
|
||||||
output_console(
|
output_console(
|
||||||
&gui_api_xvb,
|
&gui_api_xvb,
|
||||||
&format!("The average 15 minutes HR from Xmrig is {:.0} H/s, minimum required HR to keep a share in PPLNS window is {:.0} H/s", hr, min_hr),
|
&format!("The average 15 minutes HR from Xmrig is {:.0} H/s, minimum required HR to keep a share in PPLNS window is {:.0} H/s, there was {} H/s estimated sent for your address on p2pool", lhr, min_hr, p2pool_ohr),
|
||||||
);
|
);
|
||||||
// calculate how much time can be spared
|
// calculate how much time can be spared
|
||||||
let mut spared_time = Helper::time_that_could_be_spared(hr, min_hr);
|
let mut spared_time = Helper::time_that_could_be_spared(lhr, min_hr);
|
||||||
|
|
||||||
if spared_time > 0 {
|
if spared_time > 0 {
|
||||||
// if not hero option
|
// if not hero option
|
||||||
if !state_xvb.hero {
|
if !state_xvb.hero {
|
||||||
|
let xvb_chr = lock!(gui_api_xvb).stats_priv.donor_1hr_avg;
|
||||||
|
let shr = Helper::calc_last_hour_avg_hash_rate(
|
||||||
|
&lock!(gui_api_xvb).xvb_sent_last_hour_samples,
|
||||||
|
);
|
||||||
// calculate how much time needed to be spared to be in most round type minimum HR + buffer
|
// calculate how much time needed to be spared to be in most round type minimum HR + buffer
|
||||||
spared_time = Helper::minimum_time_for_highest_accessible_round(spared_time, hr);
|
spared_time = Helper::minimum_time_for_highest_accessible_round(
|
||||||
|
spared_time,
|
||||||
|
lhr,
|
||||||
|
xvb_chr,
|
||||||
|
shr,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spared_time
|
spared_time
|
||||||
|
@ -999,6 +1081,7 @@ mod test {
|
||||||
let share = 1;
|
let share = 1;
|
||||||
// verify that if one share found (enough for vip round) but not enough for donor round, no time will be given to xvb, except if in hero mode.
|
// verify that if one share found (enough for vip round) but not enough for donor round, no time will be given to xvb, except if in hero mode.
|
||||||
// 15mn average HR of xmrig is 5kH/s
|
// 15mn average HR of xmrig is 5kH/s
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 5500.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 5500.0;
|
||||||
state_xvb.hero = false;
|
state_xvb.hero = false;
|
||||||
let given_time = XvbPrivStats::calcul_donated_time(
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
@ -1041,6 +1124,7 @@ mod test {
|
||||||
Some(XvbRound::Vip)
|
Some(XvbRound::Vip)
|
||||||
);
|
);
|
||||||
// verify that if one share and not enough for donor vip round (should be in donor round), right amount of time will be given to xvb for default and hero mode
|
// verify that if one share and not enough for donor vip round (should be in donor round), right amount of time will be given to xvb for default and hero mode
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 7000.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 7000.0;
|
||||||
state_xvb.hero = false;
|
state_xvb.hero = false;
|
||||||
let given_time = XvbPrivStats::calcul_donated_time(
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
@ -1083,6 +1167,7 @@ mod test {
|
||||||
Some(XvbRound::Donor)
|
Some(XvbRound::Donor)
|
||||||
);
|
);
|
||||||
// verify that if one share and not enough for donor whale round(should be in donor vip), right amount of time will be given to xvb for default and hero mode
|
// verify that if one share and not enough for donor whale round(should be in donor vip), right amount of time will be given to xvb for default and hero mode
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 18000.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 18000.0;
|
||||||
state_xvb.hero = false;
|
state_xvb.hero = false;
|
||||||
let given_time = XvbPrivStats::calcul_donated_time(
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
@ -1125,6 +1210,7 @@ mod test {
|
||||||
Some(XvbRound::DonorVip)
|
Some(XvbRound::DonorVip)
|
||||||
);
|
);
|
||||||
// verify that if one share and not enough for donor mega round, right amount of time will be given to xvb for default and hero mode
|
// verify that if one share and not enough for donor mega round, right amount of time will be given to xvb for default and hero mode
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 105000.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 105000.0;
|
||||||
state_xvb.hero = false;
|
state_xvb.hero = false;
|
||||||
let given_time = XvbPrivStats::calcul_donated_time(
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
@ -1167,6 +1253,7 @@ mod test {
|
||||||
Some(XvbRound::DonorWhale)
|
Some(XvbRound::DonorWhale)
|
||||||
);
|
);
|
||||||
// verify that if one share and enough for donor mega round, right amount of time will be given to xvb for default and hero mode
|
// verify that if one share and enough for donor mega round, right amount of time will be given to xvb for default and hero mode
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 1205000.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 1205000.0;
|
||||||
state_xvb.hero = false;
|
state_xvb.hero = false;
|
||||||
let given_time = XvbPrivStats::calcul_donated_time(
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
@ -1208,6 +1295,55 @@ mod test {
|
||||||
XvbPrivStats::round_type(share, &gui_api_xvb),
|
XvbPrivStats::round_type(share, &gui_api_xvb),
|
||||||
Some(XvbRound::DonorMega)
|
Some(XvbRound::DonorMega)
|
||||||
);
|
);
|
||||||
|
// verify that if one share and enough for donor vp round if XvB oHR is given, right amount of time will be given to xvb for default and hero mode
|
||||||
|
lock!(gui_api_xvb).output.clear();
|
||||||
|
lock!(gui_api_xmrig).hashrate_raw_15m = 12500.0;
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 5000.0;
|
||||||
|
state_xvb.hero = false;
|
||||||
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
&gui_api_xmrig,
|
||||||
|
&gui_api_p2pool,
|
||||||
|
&gui_api_xvb,
|
||||||
|
&state_p2pool,
|
||||||
|
&state_xvb,
|
||||||
|
);
|
||||||
|
// verify that default mode will give x seconds
|
||||||
|
assert_eq!(given_time, 378);
|
||||||
|
// given time should always be less than XVB_TIME_ALGO
|
||||||
|
assert!(given_time < XVB_TIME_ALGO);
|
||||||
|
// verify that right round should be detected.
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = ((given_time as f32 / XVB_TIME_ALGO as f32)
|
||||||
|
* lock!(gui_api_xmrig).hashrate_raw_15m)
|
||||||
|
+ 5000.0;
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_24hr_avg = ((given_time as f32 / XVB_TIME_ALGO as f32)
|
||||||
|
* lock!(gui_api_xmrig).hashrate_raw_15m)
|
||||||
|
+ 5000.0;
|
||||||
|
assert_eq!(
|
||||||
|
XvbPrivStats::round_type(share, &gui_api_xvb),
|
||||||
|
Some(XvbRound::DonorVip)
|
||||||
|
);
|
||||||
|
// verify that hero mode will give x seconds
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 5000.0;
|
||||||
|
state_xvb.hero = true;
|
||||||
|
let given_time = XvbPrivStats::calcul_donated_time(
|
||||||
|
&gui_api_xmrig,
|
||||||
|
&gui_api_p2pool,
|
||||||
|
&gui_api_xvb,
|
||||||
|
&state_p2pool,
|
||||||
|
&state_xvb,
|
||||||
|
);
|
||||||
|
assert_eq!(given_time, 378);
|
||||||
|
// verify that right round should be detected.
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = ((given_time as f32 / XVB_TIME_ALGO as f32)
|
||||||
|
* lock!(gui_api_xmrig).hashrate_raw_15m)
|
||||||
|
+ 5000.0;
|
||||||
|
lock!(gui_api_xvb).stats_priv.donor_24hr_avg = ((given_time as f32 / XVB_TIME_ALGO as f32)
|
||||||
|
* lock!(gui_api_xmrig).hashrate_raw_15m)
|
||||||
|
+ 5000.0;
|
||||||
|
assert_eq!(
|
||||||
|
XvbPrivStats::round_type(share, &gui_api_xvb),
|
||||||
|
Some(XvbRound::DonorVip)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// #[tokio::main]
|
// #[tokio::main]
|
||||||
// async fn algo(share: bool, xvb_time_algo: u32) -> XvbPubStats {
|
// async fn algo(share: bool, xvb_time_algo: u32) -> XvbPubStats {
|
||||||
|
|
|
@ -148,6 +148,24 @@ pub fn nb_current_shares(s: &str) -> Option<u32> {
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
pub fn estimated_hr(s: &str) -> Option<f32> {
|
||||||
|
static CURRENT_SHARE: Lazy<Regex> =
|
||||||
|
Lazy::new(|| Regex::new(r"Your hashrate (pool-side) = (?P<nb>.*) KH/s").unwrap());
|
||||||
|
if let Some(c) = CURRENT_SHARE.captures(s) {
|
||||||
|
if let Some(m) = c.name("nb") {
|
||||||
|
return Some(
|
||||||
|
m.as_str().parse::<f32>().expect(
|
||||||
|
&[
|
||||||
|
"the number of shares should have been a float number but is :\n",
|
||||||
|
m.as_str(),
|
||||||
|
]
|
||||||
|
.concat(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
pub fn contains_statuscommand(l: &str) -> bool {
|
pub fn contains_statuscommand(l: &str) -> bool {
|
||||||
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^statusfromgupaxx").unwrap());
|
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^statusfromgupaxx").unwrap());
|
||||||
LINE_SHARE.is_match(l)
|
LINE_SHARE.is_match(l)
|
||||||
|
@ -157,6 +175,11 @@ pub fn contains_yourshare(l: &str) -> bool {
|
||||||
Lazy::new(|| Regex::new(r"^Your shares = ").unwrap());
|
Lazy::new(|| Regex::new(r"^Your shares = ").unwrap());
|
||||||
LINE_SHARE.is_match(l)
|
LINE_SHARE.is_match(l)
|
||||||
}
|
}
|
||||||
|
pub fn contains_yourhashrate(l: &str) -> bool {
|
||||||
|
static LINE_SHARE: Lazy<Regex> =
|
||||||
|
Lazy::new(|| Regex::new(r"^Your hashrate (pool-side)").unwrap());
|
||||||
|
LINE_SHARE.is_match(l)
|
||||||
|
}
|
||||||
pub fn contains_end_status(l: &str) -> bool {
|
pub fn contains_end_status(l: &str) -> bool {
|
||||||
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^Uptime ").unwrap());
|
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^Uptime ").unwrap());
|
||||||
LINE_SHARE.is_match(l)
|
LINE_SHARE.is_match(l)
|
||||||
|
|
|
@ -3,3 +3,5 @@ extend-exclude = [
|
||||||
"assets/",
|
"assets/",
|
||||||
"pgp/",
|
"pgp/",
|
||||||
]
|
]
|
||||||
|
[default]
|
||||||
|
extend-ignore-identifiers-re = ["ehr"]
|
||||||
|
|
|
@ -21,21 +21,25 @@ wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-linux
|
||||||
tar -xf xmrig-6.21.1-linux-static-x64.tar.gz
|
tar -xf xmrig-6.21.1-linux-static-x64.tar.gz
|
||||||
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/linux/xmrig/xmrig
|
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/linux/xmrig/xmrig
|
||||||
rm -r xmrig-6.21.1
|
rm -r xmrig-6.21.1
|
||||||
|
rm xmrig-6.21.1-linux-static-x64.tar.gz
|
||||||
# download xmrig into directory macos-arm64
|
# download xmrig into directory macos-arm64
|
||||||
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-arm64.tar.gz
|
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-arm64.tar.gz
|
||||||
tar -xf xmrig-6.21.1-macos-arm64.tar.gz
|
tar -xf xmrig-6.21.1-macos-arm64.tar.gz
|
||||||
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-arm64/Gupaxx.app/Contents/MacOS/xmrig/xmrig
|
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-arm64/Gupaxx.app/Contents/MacOS/xmrig/xmrig
|
||||||
rm -r xmrig-6.21.1
|
rm -r xmrig-6.21.1
|
||||||
|
rm xmrig-6.21.1-macos-arm64.tar.gz
|
||||||
# download xmrig into directory macos-x64
|
# download xmrig into directory macos-x64
|
||||||
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-x64.tar.gz
|
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-macos-x64.tar.gz
|
||||||
tar -xf xmrig-6.21.1-macos-x64.tar.gz
|
tar -xf xmrig-6.21.1-macos-x64.tar.gz
|
||||||
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-x64/Gupaxx.app/Contents/MacOS/xmrig/xmrig
|
mv xmrig-6.21.1/xmrig /tmp/${FOLDER}/skel/macos-x64/Gupaxx.app/Contents/MacOS/xmrig/xmrig
|
||||||
rm -r xmrig-6.21.1
|
rm -r xmrig-6.21.1
|
||||||
|
rm xmrig-6.21.1-macos-x64.tar.gz
|
||||||
# download xmrig into directory windows
|
# download xmrig into directory windows
|
||||||
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-msvc-win64.zip
|
wget https://github.com/xmrig/xmrig/releases/download/v6.21.1/xmrig-6.21.1-msvc-win64.zip
|
||||||
unzip xmrig-6.21.1-msvc-win64.zip
|
unzip xmrig-6.21.1-msvc-win64.zip
|
||||||
mv xmrig-6.21.1/xmrig.exe /tmp/${FOLDER}/skel/windows/XMRig/xmrig.exe
|
mv xmrig-6.21.1/xmrig.exe /tmp/${FOLDER}/skel/windows/XMRig/xmrig.exe
|
||||||
rm -r xmrig-6.21.1
|
rm -r xmrig-6.21.1
|
||||||
|
rm xmrig-6.21.1-msvc-win64.zip
|
||||||
|
|
||||||
## Download P2Pool Binaries
|
## Download P2Pool Binaries
|
||||||
# download p2pool into directory linux
|
# download p2pool into directory linux
|
||||||
|
@ -43,21 +47,25 @@ wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-li
|
||||||
tar -xf p2pool-v3.10-linux-x64.tar.gz
|
tar -xf p2pool-v3.10-linux-x64.tar.gz
|
||||||
mv p2pool-v3.10-linux-x64/p2pool /tmp/${FOLDER}/skel/linux/p2pool/p2pool
|
mv p2pool-v3.10-linux-x64/p2pool /tmp/${FOLDER}/skel/linux/p2pool/p2pool
|
||||||
rm -r p2pool-v3.10-linux-x64
|
rm -r p2pool-v3.10-linux-x64
|
||||||
|
rm p2pool-v3.10-linux-x64.tar.gz
|
||||||
# download p2pool into directory macos-arm64
|
# download p2pool into directory macos-arm64
|
||||||
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-aarch64.tar.gz
|
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-aarch64.tar.gz
|
||||||
tar -xf p2pool-v3.10-macos-arm64.tar.gz
|
tar -xf p2pool-v3.10-macos-aarch64.tar.gz
|
||||||
mv p2pool-v3.10-macos-arm64/p2pool /tmp/${FOLDER}/skel/macos-arm64/Gupaxx.app/Contents/MacOS/p2pool/p2pool
|
mv p2pool-v3.10-macos-aarch64/p2pool /tmp/${FOLDER}/skel/macos-arm64/Gupaxx.app/Contents/MacOS/p2pool/p2pool
|
||||||
rm -r p2pool-v3.10-macos-arm64
|
rm -r p2pool-v3.10-macos-aarch64
|
||||||
|
rm p2pool-v3.10-macos-aarch64.tar.gz
|
||||||
# download p2pool into directory macos-x64
|
# download p2pool into directory macos-x64
|
||||||
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-x64.tar.gz
|
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-macos-x64.tar.gz
|
||||||
tar -xf p2pool-v3.10-macos-x64.tar.gz
|
tar -xf p2pool-v3.10-macos-x64.tar.gz
|
||||||
mv p2pool-v3.10-macos-x64/p2pool /tmp/${FOLDER}/skel/macos-x64/Gupaxx.app/Contents/MacOS/p2pool/p2pool
|
mv p2pool-v3.10-macos-x64/p2pool /tmp/${FOLDER}/skel/macos-x64/Gupaxx.app/Contents/MacOS/p2pool/p2pool
|
||||||
rm -r p2pool-v3.10-macos-x64
|
rm -r p2pool-v3.10-macos-x64
|
||||||
|
rm p2pool-v3.10-macos-x64.tar.gz
|
||||||
# download p2pool into directory windows
|
# download p2pool into directory windows
|
||||||
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-windows-x64.zip
|
wget https://github.com/SChernykh/p2pool/releases/download/v3.10/p2pool-v3.10-windows-x64.zip
|
||||||
unzip p2pool-v3.10-windows-x64.zip
|
unzip p2pool-v3.10-windows-x64.zip
|
||||||
mv p2pool-v3.10/p2pool.exe /tmp/${FOLDER}/skel/windows/P2pool/p2pool.exe
|
mv p2pool-v3.10-windows-x64/p2pool.exe /tmp/${FOLDER}/skel/windows/P2Pool/p2pool.exe
|
||||||
rm -r p2pool-v3.10-windows-x64
|
rm -r p2pool-v3.10-windows-x64
|
||||||
|
rm p2pool-v3.10-windows-x64.zip
|
||||||
|
|
||||||
set +ex
|
set +ex
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue