fix: rig-id sent on XvB

fix #3
This commit is contained in:
Cyrix126 2024-04-14 18:23:25 +02:00
parent 5c16e779ed
commit 697fd99124
3 changed files with 15 additions and 0 deletions

View file

@ -826,6 +826,7 @@ impl PrivXmrigApi {
node: &XvbNode, node: &XvbNode,
address: &str, address: &str,
pub_api_xmrig: &Arc<Mutex<PubXmrigApi>>, pub_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
rig: &str,
) -> Result<()> { ) -> Result<()> {
// get config // get config
let request = client let request = client
@ -843,6 +844,9 @@ impl PrivXmrigApi {
.ok_or_else(|| anyhow!("pools/0/user does not exist in xmrig config"))? = node .ok_or_else(|| anyhow!("pools/0/user does not exist in xmrig config"))? = node
.user(&address.chars().take(8).collect::<String>()) .user(&address.chars().take(8).collect::<String>())
.into(); .into();
*config
.pointer_mut("/pools/0/rig-id")
.ok_or_else(|| anyhow!("pools/0/rig-id does not exist in xmrig config"))? = rig.into();
*config *config
.pointer_mut("/pools/0/tls") .pointer_mut("/pools/0/tls")
.ok_or_else(|| anyhow!("pools/0/tls does not exist in xmrig config"))? = .ok_or_else(|| anyhow!("pools/0/tls does not exist in xmrig config"))? =

View file

@ -173,6 +173,7 @@ async fn sleep_then_update_node_xmrig(
address: &str, address: &str,
gui_api_xvb: &Arc<Mutex<PubXvbApi>>, gui_api_xvb: &Arc<Mutex<PubXvbApi>>,
gui_api_xmrig: &Arc<Mutex<PubXmrigApi>>, gui_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
rig: &str,
) { ) {
let node = lock!(gui_api_xvb).stats_priv.node; let node = lock!(gui_api_xvb).stats_priv.node;
debug!( debug!(
@ -196,6 +197,7 @@ async fn sleep_then_update_node_xmrig(
&node, &node,
address, address,
gui_api_xmrig, gui_api_xmrig,
rig,
) )
.await .await
{ {
@ -231,6 +233,7 @@ pub(crate) async fn algorithm(
state_p2pool: &crate::disk::state::P2pool, state_p2pool: &crate::disk::state::P2pool,
share: u32, share: u32,
time_donated: &Arc<Mutex<u32>>, time_donated: &Arc<Mutex<u32>>,
rig: &str,
) { ) {
debug!("Xvb Process | Algorithm is started"); debug!("Xvb Process | Algorithm is started");
output_console( output_console(
@ -282,6 +285,7 @@ pub(crate) async fn algorithm(
&XvbNode::P2pool, &XvbNode::P2pool,
address, address,
gui_api_xmrig, gui_api_xmrig,
rig,
) )
.await .await
{ {
@ -305,6 +309,7 @@ pub(crate) async fn algorithm(
address, address,
gui_api_xvb, gui_api_xvb,
gui_api_xmrig, gui_api_xmrig,
"",
) )
.await; .await;
lock!(gui_api_xvb) lock!(gui_api_xvb)
@ -330,6 +335,7 @@ pub(crate) async fn algorithm(
&XvbNode::P2pool, &XvbNode::P2pool,
address, address,
gui_api_xmrig, gui_api_xmrig,
rig,
) )
.await .await
{ {

View file

@ -300,6 +300,7 @@ impl Helper {
&state_p2pool, &state_p2pool,
share, share,
&time_donated, &time_donated,
&state_xmrig.rig,
).await; ).await;
}))); })));
} else { } else {
@ -501,6 +502,7 @@ async fn check_state_outcauses_xvb(
{ {
let token_xmrig = state_xmrig.token.clone(); let token_xmrig = state_xmrig.token.clone();
let address = state_p2pool.address.clone(); let address = state_p2pool.address.clone();
let rig = state_xmrig.rig.clone();
spawn(enc!((client, pub_api_xmrig, gui_api) async move { spawn(enc!((client, pub_api_xmrig, gui_api) async move {
if let Err(err) = PrivXmrigApi::update_xmrig_config( if let Err(err) = PrivXmrigApi::update_xmrig_config(
@ -510,6 +512,7 @@ async fn check_state_outcauses_xvb(
&XvbNode::P2pool, &XvbNode::P2pool,
&address, &address,
&pub_api_xmrig, &pub_api_xmrig,
&rig
) )
.await .await
{ {
@ -618,6 +621,7 @@ fn signal_interrupt(
ProcessSignal::UpdateNodes(node) => { ProcessSignal::UpdateNodes(node) => {
if lock!(process).state != ProcessState::Waiting { if lock!(process).state != ProcessState::Waiting {
let token_xmrig = state_xmrig.token.clone(); let token_xmrig = state_xmrig.token.clone();
let rig = state_xmrig.rig.clone();
let address = state_p2pool.address.clone(); let address = state_p2pool.address.clone();
// check if state is alive. If it is and it is receiving such a signal, it means something a node (XvB or P2Pool) has failed. // check if state is alive. If it is and it is receiving such a signal, it means something a node (XvB or P2Pool) has failed.
// if XvB, xmrig needs to be switch to the other node (both will be checked though to be sure). // if XvB, xmrig needs to be switch to the other node (both will be checked though to be sure).
@ -664,6 +668,7 @@ fn signal_interrupt(
&XvbNode::P2pool, &XvbNode::P2pool,
&address, &address,
&gui_api_xmrig, &gui_api_xmrig,
&rig
) )
.await { .await {
output_console( output_console(