fix: fix failing CI actions

This commit is contained in:
mostafaei2002 2024-07-24 22:47:39 +03:30
parent ce82e84cc3
commit a4ce4bc04e

View file

@ -15,10 +15,7 @@ use tokio::time::sleep;
use crate::{ use crate::{
helper::{ helper::{
p2pool::PubP2poolApi, p2pool::PubP2poolApi,
xrig::{ xrig::{update_xmrig_config, xmrig::PubXmrigApi},
update_xmrig_config,
xmrig::{PrivXmrigApi, PubXmrigApi},
},
xvb::{nodes::XvbNode, priv_stats::RuntimeMode}, xvb::{nodes::XvbNode, priv_stats::RuntimeMode},
}, },
macros::lock, macros::lock,
@ -61,6 +58,7 @@ pub(crate) async fn algorithm(
algorithm.run().await; algorithm.run().await;
} }
#[allow(dead_code)]
pub struct Algorithm<'a> { pub struct Algorithm<'a> {
client: &'a Client, client: &'a Client,
pub_api: &'a Arc<Mutex<PubXvbApi>>, pub_api: &'a Arc<Mutex<PubXvbApi>>,
@ -77,6 +75,7 @@ pub struct Algorithm<'a> {
} }
#[derive(Debug)] #[derive(Debug)]
#[allow(dead_code)]
pub struct Stats { pub struct Stats {
share: u32, share: u32,
hashrate_xmrig: f32, hashrate_xmrig: f32,
@ -98,6 +97,7 @@ pub struct Stats {
} }
impl<'a> Algorithm<'a> { impl<'a> Algorithm<'a> {
#[allow(clippy::too_many_arguments)]
pub fn new( pub fn new(
client: &'a Client, client: &'a Client,
pub_api: &'a Arc<Mutex<PubXvbApi>>, pub_api: &'a Arc<Mutex<PubXvbApi>>,
@ -392,7 +392,7 @@ impl<'a> Algorithm<'a> {
} }
pub fn get_target_donation_hashrate(&self) -> f32 { pub fn get_target_donation_hashrate(&self) -> f32 {
let target_donation_hashrate = match self.stats.runtime_mode { match self.stats.runtime_mode {
RuntimeMode::Auto => self.get_auto_mode_target_donation_hashrate(), RuntimeMode::Auto => self.get_auto_mode_target_donation_hashrate(),
RuntimeMode::Hero => self.get_hero_mode_target_donation_hashrate(), RuntimeMode::Hero => self.get_hero_mode_target_donation_hashrate(),
RuntimeMode::ManualXvb => { RuntimeMode::ManualXvb => {
@ -405,7 +405,7 @@ impl<'a> Algorithm<'a> {
} }
RuntimeMode::ManualP2pool => { RuntimeMode::ManualP2pool => {
let target_donation_hashrate = let target_donation_hashrate =
(self.stats.hashrate_xmrig as f32) - (self.stats.runtime_amount as f32); self.stats.hashrate_xmrig - (self.stats.runtime_amount as f32);
info!("Algorithm | ManualP2poolMode target_donation_hashrate({})=hashrate_xmrig({})-runtime_amount({})", info!("Algorithm | ManualP2poolMode target_donation_hashrate({})=hashrate_xmrig({})-runtime_amount({})",
target_donation_hashrate, target_donation_hashrate,
@ -423,9 +423,7 @@ impl<'a> Algorithm<'a> {
target_donation_hashrate target_donation_hashrate
} }
}; }
target_donation_hashrate
} }
fn get_auto_mode_target_donation_hashrate(&self) -> f32 { fn get_auto_mode_target_donation_hashrate(&self) -> f32 {