mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 22:59:27 +00:00
fix: modify tests and add back p2pool external hashrate into donation calculation
This commit is contained in:
parent
b0834d4c34
commit
9c49aa9755
2 changed files with 26 additions and 5 deletions
|
@ -678,7 +678,7 @@ Uptime = 0h 2m 4s
|
||||||
|
|
||||||
assert_eq!(algo.stats.target_donation_hashrate, 10000.0);
|
assert_eq!(algo.stats.target_donation_hashrate, 10000.0);
|
||||||
|
|
||||||
lock!(gui_api_p2pool).p2pool_difficulty_u64 = 9_000_000;
|
lock!(gui_api_p2pool).p2pool_difficulty_u64 = 95_000_000;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 10000.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 10000.0;
|
||||||
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::Auto;
|
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::Auto;
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ Uptime = 0h 2m 4s
|
||||||
let xp_alive = false;
|
let xp_alive = false;
|
||||||
let share = 1;
|
let share = 1;
|
||||||
|
|
||||||
lock!(gui_api_p2pool).p2pool_difficulty_u64 = 9_000_000;
|
lock!(gui_api_p2pool).p2pool_difficulty_u64 = 95_000_000;
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m = 20000.0;
|
lock!(gui_api_xmrig).hashrate_raw_15m = 20000.0;
|
||||||
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::Hero;
|
lock!(gui_api_xvb).stats_priv.runtime_mode = RuntimeMode::Hero;
|
||||||
|
|
||||||
|
@ -734,6 +734,25 @@ Uptime = 0h 2m 4s
|
||||||
xp_alive,
|
xp_alive,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(algo.stats.target_donation_hashrate, 10000.0);
|
assert_eq!(algo.stats.target_donation_hashrate, 15382.1);
|
||||||
|
|
||||||
|
lock!(gui_api_p2pool).sidechain_ehr = 25000.0;
|
||||||
|
|
||||||
|
let algo = Algorithm::new(
|
||||||
|
&client,
|
||||||
|
&pub_api,
|
||||||
|
&gui_api_xvb,
|
||||||
|
&gui_api_xmrig,
|
||||||
|
&gui_api_xp,
|
||||||
|
&gui_api_p2pool,
|
||||||
|
token_xmrig,
|
||||||
|
&state_p2pool,
|
||||||
|
share,
|
||||||
|
&time_donated,
|
||||||
|
rig,
|
||||||
|
xp_alive,
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(algo.stats.target_donation_hashrate, 20000.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,7 @@ impl<'a> Algorithm<'a> {
|
||||||
let share_min_hashrate = Self::minimum_hashrate_share(
|
let share_min_hashrate = Self::minimum_hashrate_share(
|
||||||
lock!(gui_api_p2pool).p2pool_difficulty_u64,
|
lock!(gui_api_p2pool).p2pool_difficulty_u64,
|
||||||
state_p2pool.mini,
|
state_p2pool.mini,
|
||||||
|
p2pool_external_hashrate,
|
||||||
);
|
);
|
||||||
|
|
||||||
let spareable_hashrate = hashrate_xmrig - share_min_hashrate;
|
let spareable_hashrate = hashrate_xmrig - share_min_hashrate;
|
||||||
|
@ -478,13 +479,14 @@ impl<'a> Algorithm<'a> {
|
||||||
samples.0.iter().sum::<f32>() / samples.0.len() as f32
|
samples.0.iter().sum::<f32>() / samples.0.len() as f32
|
||||||
}
|
}
|
||||||
|
|
||||||
fn minimum_hashrate_share(difficulty: u64, mini: bool) -> f32 {
|
fn minimum_hashrate_share(difficulty: u64, mini: bool, p2pool_external_hashrate: 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
|
||||||
};
|
};
|
||||||
let mut minimum_hr = (difficulty / (pws * SECOND_PER_BLOCK_P2POOL)) as f32 * XVB_BUFFER;
|
let mut minimum_hr = ((difficulty / (pws * SECOND_PER_BLOCK_P2POOL)) as f32 * XVB_BUFFER)
|
||||||
|
- p2pool_external_hashrate;
|
||||||
info!("Algorithm | (difficulty / (window pplns blocks * seconds per p2pool block) * BUFFER) - outside HR = minimum HR to keep a share\n({difficulty} / ({pws} * {SECOND_PER_BLOCK_P2POOL}) * {XVB_BUFFER}) - {p2pool_external_hashrate} = {minimum_hr}");
|
info!("Algorithm | (difficulty / (window pplns blocks * seconds per p2pool block) * BUFFER) - outside HR = minimum HR to keep a share\n({difficulty} / ({pws} * {SECOND_PER_BLOCK_P2POOL}) * {XVB_BUFFER}) - {p2pool_external_hashrate} = {minimum_hr}");
|
||||||
|
|
||||||
if minimum_hr.is_sign_negative() {
|
if minimum_hr.is_sign_negative() {
|
||||||
|
|
Loading…
Reference in a new issue