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,
address: &str,
pub_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
rig: &str,
) -> Result<()> {
// get config
let request = client
@ -843,6 +844,9 @@ impl PrivXmrigApi {
.ok_or_else(|| anyhow!("pools/0/user does not exist in xmrig config"))? = node
.user(&address.chars().take(8).collect::<String>())
.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
.pointer_mut("/pools/0/tls")
.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,
gui_api_xvb: &Arc<Mutex<PubXvbApi>>,
gui_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
rig: &str,
) {
let node = lock!(gui_api_xvb).stats_priv.node;
debug!(
@ -196,6 +197,7 @@ async fn sleep_then_update_node_xmrig(
&node,
address,
gui_api_xmrig,
rig,
)
.await
{
@ -231,6 +233,7 @@ pub(crate) async fn algorithm(
state_p2pool: &crate::disk::state::P2pool,
share: u32,
time_donated: &Arc<Mutex<u32>>,
rig: &str,
) {
debug!("Xvb Process | Algorithm is started");
output_console(
@ -282,6 +285,7 @@ pub(crate) async fn algorithm(
&XvbNode::P2pool,
address,
gui_api_xmrig,
rig,
)
.await
{
@ -305,6 +309,7 @@ pub(crate) async fn algorithm(
address,
gui_api_xvb,
gui_api_xmrig,
"",
)
.await;
lock!(gui_api_xvb)
@ -330,6 +335,7 @@ pub(crate) async fn algorithm(
&XvbNode::P2pool,
address,
gui_api_xmrig,
rig,
)
.await
{

View file

@ -300,6 +300,7 @@ impl Helper {
&state_p2pool,
share,
&time_donated,
&state_xmrig.rig,
).await;
})));
} else {
@ -501,6 +502,7 @@ async fn check_state_outcauses_xvb(
{
let token_xmrig = state_xmrig.token.clone();
let address = state_p2pool.address.clone();
let rig = state_xmrig.rig.clone();
spawn(enc!((client, pub_api_xmrig, gui_api) async move {
if let Err(err) = PrivXmrigApi::update_xmrig_config(
@ -510,6 +512,7 @@ async fn check_state_outcauses_xvb(
&XvbNode::P2pool,
&address,
&pub_api_xmrig,
&rig
)
.await
{
@ -618,6 +621,7 @@ fn signal_interrupt(
ProcessSignal::UpdateNodes(node) => {
if lock!(process).state != ProcessState::Waiting {
let token_xmrig = state_xmrig.token.clone();
let rig = state_xmrig.rig.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.
// 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,
&address,
&gui_api_xmrig,
&rig
)
.await {
output_console(