mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
fix: wait for p2pool difficulty value before starting algo and fix process stuck in middle.
This commit is contained in:
parent
c4d1eda590
commit
5cf4837e25
1 changed files with 15 additions and 10 deletions
|
@ -211,6 +211,8 @@ impl Helper {
|
||||||
// check if first loop the state of Xmrig-Proxy
|
// check if first loop the state of Xmrig-Proxy
|
||||||
if first_loop {
|
if first_loop {
|
||||||
xp_alive = lock!(process_xp).state == ProcessState::Alive;
|
xp_alive = lock!(process_xp).state == ProcessState::Alive;
|
||||||
|
msg_retry_done = false;
|
||||||
|
*lock!(retry) = false;
|
||||||
}
|
}
|
||||||
// verify if p2pool and xmrig are running, else XvB must be reloaded with another token/address to start verifying the other process.
|
// verify if p2pool and xmrig are running, else XvB must be reloaded with another token/address to start verifying the other process.
|
||||||
if check_state_outcauses_xvb(
|
if check_state_outcauses_xvb(
|
||||||
|
@ -234,11 +236,11 @@ impl Helper {
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check signal
|
// check signal
|
||||||
debug!("XvB | check signal");
|
debug!("XvB | check signal");
|
||||||
if signal_interrupt(
|
if signal_interrupt(
|
||||||
process,
|
process,
|
||||||
|
if xp_alive { process_xp } else { process_xmrig },
|
||||||
start.into(),
|
start.into(),
|
||||||
&client,
|
&client,
|
||||||
pub_api,
|
pub_api,
|
||||||
|
@ -317,7 +319,8 @@ impl Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let hashrate = current_controllable_hr(xp_alive, &gui_api_xp, &gui_api_xmrig);
|
let hashrate = current_controllable_hr(xp_alive, &gui_api_xp, &gui_api_xmrig);
|
||||||
if (first_loop || *lock!(retry)|| is_algo_finished) && hashrate > 0.0 && lock!(process).state == ProcessState::Alive
|
let difficulty_data_is_ready = lock!(gui_api_p2pool).p2pool_difficulty_u64 > 100_000;
|
||||||
|
if (first_loop || *lock!(retry)|| is_algo_finished) && hashrate > 0.0 && lock!(process).state == ProcessState::Alive && difficulty_data_is_ready
|
||||||
{
|
{
|
||||||
// if algo was started, it must not retry next loop.
|
// if algo was started, it must not retry next loop.
|
||||||
*lock!(retry) = false;
|
*lock!(retry) = false;
|
||||||
|
@ -352,7 +355,7 @@ impl Helper {
|
||||||
} else {
|
} else {
|
||||||
// if xmrig is still at 0 HR but is alive and algorithm is skipped, recheck first 10s of xmrig inside algorithm next time (in one minute). Don't check if algo failed to start because state was not alive after getting private stats.
|
// if xmrig is still at 0 HR but is alive and algorithm is skipped, recheck first 10s of xmrig inside algorithm next time (in one minute). Don't check if algo failed to start because state was not alive after getting private stats.
|
||||||
|
|
||||||
if current_controllable_hr(xp_alive, &gui_api_xp, &gui_api_xmrig) == 0.0 && lock!(process).state == ProcessState::Alive {
|
if (hashrate == 0.0 || !difficulty_data_is_ready) && lock!(process).state == ProcessState::Alive {
|
||||||
*lock!(retry) = true
|
*lock!(retry) = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,9 +372,9 @@ impl Helper {
|
||||||
// show this message only once before the start of algo
|
// show this message only once before the start of algo
|
||||||
if *lock!(retry) && !msg_retry_done {
|
if *lock!(retry) && !msg_retry_done {
|
||||||
let msg = if xp_alive {
|
let msg = if xp_alive {
|
||||||
"Algorithm is waiting for 1 minute average HR of XMRig-Proxy"
|
"Algorithm is waiting for 1 minute average HR of XMRig-Proxy or p2pool data"
|
||||||
} else {
|
} else {
|
||||||
"Algorithm is waiting for 10 seconds average HR of XMRig."
|
"Algorithm is waiting for 10 seconds average HR of XMRig or p2pool data"
|
||||||
};
|
};
|
||||||
output_console(&mut lock!(gui_api).output, msg, ProcessName::Xvb);
|
output_console(&mut lock!(gui_api).output, msg, ProcessName::Xvb);
|
||||||
msg_retry_done = true;
|
msg_retry_done = true;
|
||||||
|
@ -491,7 +494,7 @@ async fn check_conditions_for_start(
|
||||||
output_console(&mut lock!(gui_api).output, msg, ProcessName::Xvb);
|
output_console(&mut lock!(gui_api).output, msg, ProcessName::Xvb);
|
||||||
ProcessState::Syncing
|
ProcessState::Syncing
|
||||||
} else if lock!(process_xmrig).state != ProcessState::Alive
|
} else if lock!(process_xmrig).state != ProcessState::Alive
|
||||||
|| lock!(process_xp).state != ProcessState::Alive
|
&& lock!(process_xp).state != ProcessState::Alive
|
||||||
{
|
{
|
||||||
// send to console: xmrig process is not running
|
// 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.");
|
||||||
|
@ -677,6 +680,7 @@ async fn check_state_outcauses_xvb(
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn signal_interrupt(
|
fn signal_interrupt(
|
||||||
process: &Arc<Mutex<Process>>,
|
process: &Arc<Mutex<Process>>,
|
||||||
|
process_xrig: &Arc<Mutex<Process>>,
|
||||||
start: Instant,
|
start: Instant,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
pub_api: &Arc<Mutex<PubXvbApi>>,
|
pub_api: &Arc<Mutex<PubXvbApi>>,
|
||||||
|
@ -745,13 +749,12 @@ fn signal_interrupt(
|
||||||
// if both XvB nodes fail after checking, process will be partially stopped and a new spawn will verify if nodes are again online and so will continue the process completely if that's the case.
|
// if both XvB nodes fail after checking, process will be partially stopped and a new spawn will verify if nodes are again online and so will continue the process completely if that's the case.
|
||||||
// if P2pool, the process has to stop the algo and continue partially. The process will continue completely if the confitions are met again.
|
// if P2pool, the process has to stop the algo and continue partially. The process will continue completely if the confitions are met again.
|
||||||
// if XvB was not alive, then if it is for XvB nodes, it will check and update preferred node and set XMRig to P2pool if that's not the case.
|
// if XvB was not alive, then if it is for XvB nodes, it will check and update preferred node and set XMRig to P2pool if that's not the case.
|
||||||
// if XvB was not alive and update was for P2pool, XvB must ignore. XMRig will stop sending signals because current node will be none.
|
let was_alive = lock!(process).state == ProcessState::Alive;
|
||||||
let was_alive = lock!(process).state != ProcessState::Alive;
|
|
||||||
// so it won't execute another signal of update nodes if it is already doing it.
|
// so it won't execute another signal of update nodes if it is already doing it.
|
||||||
lock!(process).state = ProcessState::Waiting;
|
lock!(process).state = ProcessState::Waiting;
|
||||||
lock!(process).signal = ProcessSignal::None;
|
lock!(process).signal = ProcessSignal::None;
|
||||||
spawn(
|
spawn(
|
||||||
enc!((node, process, client, gui_api, pub_api, was_alive, address, token_xmrig, gui_api_xmrig, gui_api_xp) async move {
|
enc!((node, process, client, gui_api, pub_api, was_alive, address, token_xmrig, gui_api_xmrig, gui_api_xp,process_xrig) async move {
|
||||||
warn!("in spawn of UpdateNodes");
|
warn!("in spawn of UpdateNodes");
|
||||||
match node {
|
match node {
|
||||||
XvbNode::NorthAmerica|XvbNode::Europe if was_alive => {
|
XvbNode::NorthAmerica|XvbNode::Europe if was_alive => {
|
||||||
|
@ -778,7 +781,8 @@ fn signal_interrupt(
|
||||||
// Probably a start. We don't consider XMRig using XvB nodes without algo.
|
// Probably a start. We don't consider XMRig using XvB nodes without algo.
|
||||||
// can update xmrig and check status of state in the same time.
|
// can update xmrig and check status of state in the same time.
|
||||||
// Need to set XMRig to P2Pool if it wasn't. XMRig should have populated this value at his start.
|
// Need to set XMRig to P2Pool if it wasn't. XMRig should have populated this value at his start.
|
||||||
|
// but if xmrig didn't start, don't update it.
|
||||||
|
if lock!(process_xrig).state == ProcessState::Alive {
|
||||||
if lock!(gui_api).current_node != Some(XvbNode::P2pool) {
|
if lock!(gui_api).current_node != Some(XvbNode::P2pool) {
|
||||||
spawn(enc!((client, token_xmrig, address, gui_api_xmrig, gui_api_xp, gui_api) async move{
|
spawn(enc!((client, token_xmrig, address, gui_api_xmrig, gui_api_xp, gui_api) async move{
|
||||||
let url_api = api_url_xmrig(xp_alive, true);
|
let url_api = api_url_xmrig(xp_alive, true);
|
||||||
|
@ -814,6 +818,7 @@ fn signal_interrupt(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
));}
|
));}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => {}
|
_ => {}
|
||||||
} } ),
|
} } ),
|
||||||
|
|
Loading…
Reference in a new issue