mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
feat: merge into upstream main branch
This commit is contained in:
commit
35593c2c9f
3 changed files with 13 additions and 8 deletions
|
@ -27,7 +27,10 @@ pub async fn update_xmrig_config(
|
|||
let mut config = request.send().await?.json::<Value>().await?;
|
||||
// modify node configuration
|
||||
let uri = [node.url(), ":".to_string(), node.port()].concat();
|
||||
info!("replace xmrig config with node {}", uri);
|
||||
info!(
|
||||
"replace xmrig from api url {api_uri} config with node {}",
|
||||
uri
|
||||
);
|
||||
*config
|
||||
.pointer_mut("/pools/0/url")
|
||||
.ok_or_else(|| anyhow!("pools/0/url does not exist in xmrig config"))? = uri.into();
|
||||
|
|
|
@ -91,6 +91,7 @@ struct Stats {
|
|||
spareable_hashrate: f32,
|
||||
spared_time: u32,
|
||||
api_url: String,
|
||||
msg_xmrig_or_xp: &str,
|
||||
}
|
||||
|
||||
impl<'a> Algorithm<'a> {
|
||||
|
@ -140,6 +141,9 @@ impl<'a> Algorithm<'a> {
|
|||
|
||||
let api_url = api_url_xmrig(xp_alive, true);
|
||||
|
||||
let msg_xmrig_or_xp = if xp_alive { "XMRig-Proxy" } else { "XMRig" };
|
||||
info!("xp alive: {:?}", xp_alive);
|
||||
|
||||
// TODO consider printing algorithm stats instead of spreadout print statements
|
||||
let stats = Stats {
|
||||
share,
|
||||
|
@ -158,6 +162,7 @@ impl<'a> Algorithm<'a> {
|
|||
spareable_hashrate,
|
||||
spared_time: u32::default(),
|
||||
api_url,
|
||||
msg_xmrig_or_xp,
|
||||
};
|
||||
|
||||
let mut new_instace = Self {
|
||||
|
@ -232,11 +237,6 @@ impl<'a> Algorithm<'a> {
|
|||
}
|
||||
|
||||
async fn target_xvb_node(&self) {
|
||||
let msg_xmrig_or_xp = if self.xp_alive {
|
||||
"XMRig-Proxy"
|
||||
} else {
|
||||
"XMRig"
|
||||
};
|
||||
let node = lock!(self.gui_api_xvb).stats_priv.node;
|
||||
|
||||
debug!("Xvb Process | request {msg_xmrig_or_xp} to mine on XvB");
|
||||
|
|
|
@ -836,8 +836,10 @@ fn update_indicator_algo(
|
|||
);
|
||||
|
||||
lock!(pub_api).stats_priv.time_switch_node = XVB_TIME_ALGO
|
||||
- last_algorithm.lock().unwrap().elapsed().as_secs() as u32
|
||||
- time_donated;
|
||||
.checked_sub(last_algorithm.lock().unwrap().elapsed().as_secs() as u32)
|
||||
.unwrap_or_default()
|
||||
.checked_sub(time_donated)
|
||||
.unwrap_or_default();
|
||||
"time until switch to mining on XvB".to_string()
|
||||
}
|
||||
_ => {
|
||||
|
|
Loading…
Reference in a new issue