Skip to content

Commit

Permalink
Fixed setting first pool job in case of miner delayed start
Browse files Browse the repository at this point in the history
  • Loading branch information
MoneroOcean committed Oct 4, 2018
1 parent 6c68068 commit a92a6d4
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions mm.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const child_process = require('child_process');
// *** CONSTS ***
// *****************************************************************************

const VERSION = "v0.9";
const VERSION = "v1.0";
const DEFAULT_ALGO = "cn/1"; // this is algo that is assumed to be sent by pool if its job does not contain algo stratum extension
const AGENT = "Meta Miner " + VERSION;

Expand Down Expand Up @@ -451,6 +451,17 @@ function pool_new_msg(is_new_job, json) {
err("Ignoring job with unknown algo " + next_algo + " sent by the pool (" + c.pools[curr_pool_num] + ")");
return;
}

if ("params" in json) {
if (curr_pool_job1) {
curr_pool_job1.result.job = json.params;
} else {
err("[INTERNAL ERROR] Can not update pool (" + c.pools[curr_pool_num] + ") job since its first job is missing");
}
} else {
curr_pool_job1 = json;
}

const next_perf_class = algo_perf_class(next_algo);
if (curr_perf_class != next_perf_class) last_perf_class_change_time = Date.now();
curr_perf_class = next_perf_class;
Expand All @@ -465,16 +476,6 @@ function pool_new_msg(is_new_job, json) {
curr_miner = next_miner;
replace_miner(next_miner);
}

if ("params" in json) {
if (curr_pool_job1) {
curr_pool_job1.result.job = json.params;
} else {
err("[INTERNAL ERROR] Can not update pool (" + c.pools[curr_pool_num] + ") job since its first job is missing");
}
} else {
curr_pool_job1 = json;
}
}

if (curr_miner_socket) curr_miner_socket.write(JSON.stringify(json) + "\n");
Expand Down

0 comments on commit a92a6d4

Please sign in to comment.