Skip to content

Commit

Permalink
fix: rig-id sent on XvB
Browse files Browse the repository at this point in the history
fix #4
  • Loading branch information
Cyrix126 committed Apr 15, 2024
1 parent a4dded9 commit 8234f7e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/helper/xmrig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ impl PrivXmrigApi {
node: &XvbNode,
address: &str,
pub_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
rig: &str,
) -> Result<()> {
// get config
let request = client
Expand All @@ -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"))? =
Expand Down
6 changes: 6 additions & 0 deletions src/helper/xvb/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -196,6 +197,7 @@ async fn sleep_then_update_node_xmrig(
&node,
address,
gui_api_xmrig,
rig,
)
.await
{
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -282,6 +285,7 @@ pub(crate) async fn algorithm(
&XvbNode::P2pool,
address,
gui_api_xmrig,
rig,
)
.await
{
Expand All @@ -305,6 +309,7 @@ pub(crate) async fn algorithm(
address,
gui_api_xvb,
gui_api_xmrig,
"",
)
.await;
lock!(gui_api_xvb)
Expand All @@ -330,6 +335,7 @@ pub(crate) async fn algorithm(
&XvbNode::P2pool,
address,
gui_api_xmrig,
rig,
)
.await
{
Expand Down
5 changes: 5 additions & 0 deletions src/helper/xvb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ impl Helper {
&state_p2pool,
share,
&time_donated,
&state_xmrig.rig,
).await;
})));
} else {
Expand Down Expand Up @@ -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(
Expand All @@ -510,6 +512,7 @@ async fn check_state_outcauses_xvb(
&XvbNode::P2pool,
&address,
&pub_api_xmrig,
&rig
)
.await
{
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -664,6 +668,7 @@ fn signal_interrupt(
&XvbNode::P2pool,
&address,
&gui_api_xmrig,
&rig
)
.await {
output_console(
Expand Down

0 comments on commit 8234f7e

Please sign in to comment.