fix: round type add margin 1h average and fix countdown when donating time + round up needed time if float

This commit is contained in:
Cyrix126 2024-04-03 08:34:42 +02:00
parent a4d09c2a3a
commit 41a3eda41f
5 changed files with 107 additions and 131 deletions

View file

@ -551,14 +551,12 @@ Uptime = 0h 2m 4s
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::Vip));
// verify that hero mode will give x seconds
lock!(gui_api_xvb).stats_priv.runtime_hero_mode = true;
@ -570,14 +568,12 @@ Uptime = 0h 2m 4s
);
assert_eq!(given_time, 45);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), 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
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
@ -594,14 +590,12 @@ Uptime = 0h 2m 4s
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::Donor));
// verify that hero mode will give x seconds
lock!(gui_api_xvb).stats_priv.runtime_hero_mode = true;
@ -613,14 +607,12 @@ Uptime = 0h 2m 4s
);
assert_eq!(given_time, 253);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), 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
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
@ -633,18 +625,16 @@ Uptime = 0h 2m 4s
&state_p2pool,
);
// verify that default mode will give x seconds
assert_eq!(given_time, 315);
assert_eq!(given_time, 316);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::DonorVip));
// verify that hero mode will give x seconds
lock!(gui_api_xvb).stats_priv.runtime_hero_mode = true;
@ -656,14 +646,12 @@ Uptime = 0h 2m 4s
);
assert_eq!(given_time, 454);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), 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
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
@ -676,18 +664,16 @@ Uptime = 0h 2m 4s
&state_p2pool,
);
// verify that default mode will give x seconds
assert_eq!(given_time, 571);
assert_eq!(given_time, 572);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::DonorWhale));
// verify that hero mode will give x seconds
lock!(gui_api_xvb).stats_priv.runtime_hero_mode = true;
@ -699,14 +685,12 @@ Uptime = 0h 2m 4s
);
assert_eq!(given_time, 573);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), 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
lock!(gui_api_xvb).stats_priv.donor_1hr_avg = 0.0;
@ -719,18 +703,16 @@ Uptime = 0h 2m 4s
&state_p2pool,
);
// verify that default mode will give x seconds
assert_eq!(given_time, 497);
assert_eq!(given_time, 498);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::DonorMega));
// verify that hero mode will give x seconds
lock!(gui_api_xvb).stats_priv.runtime_hero_mode = true;
@ -742,14 +724,12 @@ Uptime = 0h 2m 4s
);
assert_eq!(given_time, 597);
// 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)
/ 1000.0)
* 1.2;
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), 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();
@ -767,18 +747,14 @@ Uptime = 0h 2m 4s
// 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)
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0)
* 1.2;
/ 1000.0;
assert_eq!(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 = 5.0;
@ -791,18 +767,14 @@ Uptime = 0h 2m 4s
);
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)
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)
/ 1000.0)
* 1.2;
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)
/ 1000.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)
/ 1000.0)
* 1.2;
/ 1000.0;
assert_eq!(round_type(share, &gui_api_xvb), Some(XvbRound::DonorVip));
}
}

View file

@ -97,7 +97,9 @@ fn time_that_could_be_spared(hr: f32, min_hr: f32) -> u32 {
// 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;
// we remove one second that could possibly be sent, because if the time needed is a float, it will be rounded up.
// this subtraction can not fail because mnimum spared time is >= 6.
let hr_for_xvb = ((st - 1) as f32 / XVB_TIME_ALGO as f32) * lhr;
info!(
"hr for xvb is: ({st} / {}) * {lhr} = {hr_for_xvb}H/s",
XVB_TIME_ALGO
@ -124,15 +126,14 @@ fn minimum_time_for_highest_accessible_round(st: u32, lhr: f32, chr: f32, shr: f
"minimum required HR for donor round is: {} - {ohr} = {min_donor}H/s",
XVB_ROUND_DONOR_MIN_HR
);
match hr_for_xvb {
let min = match hr_for_xvb {
x if x > min_mega => {
info!("trying to get Mega round");
info!(
"minimum second to send = ((({x} - ({x} - {min_mega})) / {lhr}) * {}) ",
XVB_TIME_ALGO
);
(((x - (x - min_mega)) / lhr) * XVB_TIME_ALGO as f32) as u32
min_mega
}
x if x > min_whale => {
info!("trying to get Whale round");
@ -140,7 +141,7 @@ fn minimum_time_for_highest_accessible_round(st: u32, lhr: f32, chr: f32, shr: f
"minimum second to send = ((({x} - ({x} - {min_whale})) / {lhr}) * {}) ",
XVB_TIME_ALGO
);
(((x - (x - min_whale)) / lhr) * XVB_TIME_ALGO as f32) as u32
min_whale
}
x if x > min_donorvip => {
info!("trying to get Vip Donor round");
@ -148,7 +149,7 @@ fn minimum_time_for_highest_accessible_round(st: u32, lhr: f32, chr: f32, shr: f
"minimum second to send = ((({x} - ({x} - {min_donorvip})) / {lhr}) * {}) ",
XVB_TIME_ALGO
);
(((x - (x - min_donorvip)) / lhr) * XVB_TIME_ALGO as f32) as u32
min_donorvip
}
x if x > min_donor => {
info!("trying to get Donor round");
@ -156,10 +157,12 @@ fn minimum_time_for_highest_accessible_round(st: u32, lhr: f32, chr: f32, shr: f
"minimum second to send = ((({x} - ({x} - {min_donor})) / {lhr}) * {}) ",
XVB_TIME_ALGO
);
(((x - (x - min_donor)) / lhr) * XVB_TIME_ALGO as f32) as u32
}
_ => 0,
min_donor
}
_ => return 0,
};
(((hr_for_xvb - (hr_for_xvb - min)) / lhr) * XVB_TIME_ALGO as f32).ceil() as u32
}
#[allow(clippy::too_many_arguments)]
async fn sleep_then_update_node_xmrig(
@ -229,7 +232,7 @@ pub(crate) async fn algorithm(
token_xmrig: &str,
state_p2pool: &crate::disk::state::P2pool,
share: u32,
time_donated: &mut u32,
time_donated: &Arc<Mutex<u32>>,
) {
debug!("Xvb Process | Algorithm is started");
output_console(
@ -257,21 +260,21 @@ pub(crate) async fn algorithm(
lock!(gui_api_xmrig).hashrate_raw
}
};
*time_donated =
*lock!(time_donated) =
calcul_donated_time(hashrate_xmrig, gui_api_p2pool, gui_api_xvb, state_p2pool);
let time_donated = *lock!(time_donated);
debug!("Xvb Process | Donated time {} ", time_donated);
output_console(
gui_api_xvb,
&format!(
"Mining on P2pool node for {} seconds then on XvB for {} seconds.",
XVB_TIME_ALGO - *time_donated,
XVB_TIME_ALGO - time_donated,
time_donated
),
);
// p2pool need to be mined if donated time is not equal to xvb_time_algo
if *time_donated != XVB_TIME_ALGO
&& lock!(gui_api_xvb).current_node != Some(XvbNode::P2pool)
if time_donated != XVB_TIME_ALGO && lock!(gui_api_xvb).current_node != Some(XvbNode::P2pool)
{
debug!("Xvb Process | request xmrig to mine on p2pool");
if let Err(err) = PrivXmrigApi::update_xmrig_config(
@ -298,7 +301,7 @@ pub(crate) async fn algorithm(
// sleep 10m less spared time then request XMrig to mine on XvB
sleep_then_update_node_xmrig(
last_algorithm,
*time_donated,
time_donated,
client,
XMRIG_CONFIG_URI,
token_xmrig,
@ -310,11 +313,11 @@ pub(crate) async fn algorithm(
lock!(gui_api_xvb)
.p2pool_sent_last_hour_samples
.0
.push_back(hashrate_xmrig * ((XVB_TIME_ALGO - *time_donated) / XVB_TIME_ALGO) as f32);
.push_back(hashrate_xmrig * ((XVB_TIME_ALGO - time_donated) / XVB_TIME_ALGO) as f32);
lock!(gui_api_xvb)
.xvb_sent_last_hour_samples
.0
.push_back(hashrate_xmrig * (*time_donated / XVB_TIME_ALGO) as f32);
.push_back(hashrate_xmrig * (time_donated / XVB_TIME_ALGO) as f32);
} else {
// no share, so we mine on p2pool. We update xmrig only if it was still mining on XvB.
if lock!(gui_api_xvb).current_node != Some(XvbNode::P2pool) {

View file

@ -177,7 +177,7 @@ impl Helper {
// retry will be accessed from the 1m spawn, it can influence the start of algo.
let retry = Arc::new(Mutex::new(false));
// time donated by algorithm. With being persistent across loop, we can construct the indicator.
let mut time_donated = 0;
let time_donated = Arc::new(Mutex::new(0));
// let handles;
let handle_algo = Arc::new(Mutex::new(None));
let mut handle_request = None;
@ -240,7 +240,7 @@ impl Helper {
// first_loop is false here but could be changed to true under some conditions.
// will send a stop signal if public stats failed or update data with new one.
handle_request = Some(spawn(
enc!((client, pub_api, gui_api, gui_api_p2pool, gui_api_xmrig, state_xvb, state_p2pool, state_xmrig, process, last_algorithm, retry, handle_algo) async move {
enc!((client, pub_api, gui_api, gui_api_p2pool, gui_api_xmrig, state_xvb, state_p2pool, state_xmrig, process, last_algorithm, retry, handle_algo, time_donated) async move {
// needs to wait here for public stats to get private stats.
if last_request.elapsed() >= Duration::from_secs(60) || first_loop || lock!(last_algorithm).elapsed() >= Duration::from_secs((XVB_TIME_ALGO as f32 * 0.95)as u64) {
XvbPubStats::update_stats(&client, &gui_api, &pub_api, &process).await;
@ -283,7 +283,7 @@ impl Helper {
let last_algorithm = *lock!(last_algorithm);
*lock!(handle_algo) = Some(spawn(enc!((client, gui_api, gui_api_xmrig, state_xmrig) async move {
*lock!(handle_algo) = Some(spawn(enc!((client, gui_api, gui_api_xmrig, state_xmrig, time_donated) async move {
algorithm(
&client,
last_algorithm,
@ -293,7 +293,7 @@ impl Helper {
&state_xmrig.token,
&state_p2pool,
share,
&mut time_donated,
&time_donated,
).await;
})));
} else {
@ -332,7 +332,7 @@ impl Helper {
is_algo_finished,
process,
pub_api,
time_donated,
*lock!(time_donated),
&last_algorithm,
);
// first_loop is done, but maybe retry will allow the algorithm to retry again.

View file

@ -5,7 +5,7 @@ use serde::Deserialize;
use crate::{
macros::lock, XVB_ROUND_DONOR_MEGA_MIN_HR, XVB_ROUND_DONOR_MIN_HR, XVB_ROUND_DONOR_VIP_MIN_HR,
XVB_ROUND_DONOR_WHALE_MIN_HR,
XVB_ROUND_DONOR_WHALE_MIN_HR, XVB_SIDE_MARGIN_1H,
};
use super::PubXvbApi;
@ -32,7 +32,7 @@ pub(crate) fn round_type(share: u32, pub_api: &Arc<Mutex<PubXvbApi>>) -> Option<
if share > 0 {
let stats_priv = &lock!(pub_api).stats_priv;
match (
(stats_priv.donor_1hr_avg * 1000.0) as u32,
((stats_priv.donor_1hr_avg * 1000.0) * XVB_SIDE_MARGIN_1H) as u32,
(stats_priv.donor_24hr_avg * 1000.0) as u32,
) {
x if x.0 >= XVB_ROUND_DONOR_MEGA_MIN_HR && x.1 >= XVB_ROUND_DONOR_MEGA_MIN_HR => {

View file

@ -419,6 +419,7 @@ pub const XVB_NODE_NA: &str = "na.xmrvsbeast.com";
pub const XVB_NODE_RPC: &str = "18089";
pub const XVB_URL_RULES: &str = "https://xmrvsbeast.com/p2pool/rules.html";
// buffer in percentage of HR to have plus the requirement.
pub const XVB_SIDE_MARGIN_1H: f32 = 1.20;
pub const XVB_BUFFER: f32 = 1.05;
pub const XVB_TIME_ALGO: u32 = 600;
pub const XVB_TOKEN_LEN: usize = 9;