fix: compile error

This commit is contained in:
mostafaei2002 2024-07-20 16:57:50 +03:30
parent 35593c2c9f
commit 53edeff791

View file

@ -91,7 +91,7 @@ struct Stats {
spareable_hashrate: f32, spareable_hashrate: f32,
spared_time: u32, spared_time: u32,
api_url: String, api_url: String,
msg_xmrig_or_xp: &str, msg_xmrig_or_xp: String,
} }
impl<'a> Algorithm<'a> { impl<'a> Algorithm<'a> {
@ -131,7 +131,7 @@ impl<'a> Algorithm<'a> {
p2pool_external_hashrate = 0.0; p2pool_external_hashrate = 0.0;
} }
let mut 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, p2pool_external_hashrate,
@ -141,7 +141,7 @@ impl<'a> Algorithm<'a> {
let api_url = api_url_xmrig(xp_alive, true); let api_url = api_url_xmrig(xp_alive, true);
let msg_xmrig_or_xp = if xp_alive { "XMRig-Proxy" } else { "XMRig" }; let msg_xmrig_or_xp = (if xp_alive { "XMRig-Proxy" } else { "XMRig" }).to_string();
info!("xp alive: {:?}", xp_alive); info!("xp alive: {:?}", xp_alive);
// TODO consider printing algorithm stats instead of spreadout print statements // TODO consider printing algorithm stats instead of spreadout print statements
@ -202,14 +202,11 @@ impl<'a> Algorithm<'a> {
} }
async fn target_p2pool_node(&self) { async fn target_p2pool_node(&self) {
let msg_xmrig_or_xp = if self.xp_alive {
"XMRig-Proxy"
} else {
"XMRig"
};
if lock!(self.gui_api_xvb).current_node != Some(XvbNode::P2pool) { if lock!(self.gui_api_xvb).current_node != Some(XvbNode::P2pool) {
info!("Xvb Process | request {msg_xmrig_or_xp} to mine on p2pool"); info!(
"Xvb Process | request {} to mine on p2pool",
self.stats.msg_xmrig_or_xp
);
if let Err(err) = update_xmrig_config( if let Err(err) = update_xmrig_config(
self.client, self.client,
@ -221,17 +218,23 @@ impl<'a> Algorithm<'a> {
) )
.await .await
{ {
warn!("Xvb Process | Failed request HTTP API {msg_xmrig_or_xp}"); warn!(
"Xvb Process | Failed request HTTP API {}",
self.stats.msg_xmrig_or_xp
);
output_console( output_console(
&mut lock!(self.gui_api_xvb).output, &mut lock!(self.gui_api_xvb).output,
&format!( &format!(
"Failure to update {msg_xmrig_or_xp} config with HTTP API.\nError: {}", "Failure to update {} config with HTTP API.\nError: {}",
err self.stats.msg_xmrig_or_xp, err
), ),
crate::helper::ProcessName::Xvb, crate::helper::ProcessName::Xvb,
); );
} else { } else {
debug!("Xvb Process | {msg_xmrig_or_xp} mining on p2pool pool"); debug!(
"Xvb Process | {} mining on p2pool pool",
self.stats.msg_xmrig_or_xp
);
} }
} }
} }
@ -239,7 +242,10 @@ impl<'a> Algorithm<'a> {
async fn target_xvb_node(&self) { async fn target_xvb_node(&self) {
let node = lock!(self.gui_api_xvb).stats_priv.node; let node = lock!(self.gui_api_xvb).stats_priv.node;
debug!("Xvb Process | request {msg_xmrig_or_xp} to mine on XvB"); debug!(
"Xvb Process | request {} to mine on XvB",
self.stats.msg_xmrig_or_xp
);
if lock!(self.gui_api_xvb).current_node.is_none() if lock!(self.gui_api_xvb).current_node.is_none()
|| lock!(self.gui_api_xvb) || lock!(self.gui_api_xvb)
@ -258,12 +264,15 @@ impl<'a> Algorithm<'a> {
.await .await
{ {
// show to console error about updating xmrig config // show to console error about updating xmrig config
warn!("Xvb Process | Failed request HTTP API {msg_xmrig_or_xp}"); warn!(
"Xvb Process | Failed request HTTP API {}",
self.stats.msg_xmrig_or_xp
);
output_console( output_console(
&mut lock!(self.gui_api_xvb).output, &mut lock!(self.gui_api_xvb).output,
&format!( &format!(
"Failure to update {msg_xmrig_or_xp} config with HTTP API.\nError: {}", "Failure to update {} config with HTTP API.\nError: {}",
err self.stats.msg_xmrig_or_xp, err
), ),
crate::helper::ProcessName::Xvb, crate::helper::ProcessName::Xvb,
); );
@ -273,7 +282,10 @@ impl<'a> Algorithm<'a> {
} else { } else {
lock!(self.gui_api_xmrig).node = node.to_string(); lock!(self.gui_api_xmrig).node = node.to_string();
} }
debug!("Xvb Process | {msg_xmrig_or_xp} mining on XvB pool"); debug!(
"Xvb Process | {} mining on XvB pool",
self.stats.msg_xmrig_or_xp
);
} }
} }
} }