-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dublicate job #5
Comments
OK. I never looked into this code, so it will take time for me to completely understand what is going on here and if fix is helpful. If not yet already done I recommend to submit same issue against main repo too. |
Actually I do not think it is a problem here and moreover fix will lead to harmful effect. Fix rejects new block template if hash of previous block is the same as hash of previous block of active block template, right? This is not right, since monerod can provide updated valid block templates with the same previous block hash (for example if height is not changed and there are new transaction included into block template). This fix will merely allow the first block template to be used for each height and will reject their valid updates that can lead to lower block rewards (because less tx fees are included). Hope it make sense. Feel free to point me if I'm wrong here. |
Ok, I understood you. I did not know it could be that way. |
@1rV1N-git : Snipa’s repo got same bug like yours before |
Yeah, sure. It was merged on the same day: 6a08322 |
I got same error "Duplicate jobs" multiple time and Snipa did fix it, no more that errors after that fix. I've never see that errors again from that day. |
This particular line/fix you mentioned is not related to duplicate jobs. It is fix for frequent block template updates and I decided to rework it after (that is why this line is different). I'm pretty sure in this particular case since actually I'm Mayday30;) Also I'd like to reiterate that according to port number (we do not host 3333 port) this is not MO specific issue (not surprising since I never touched job generation code). Please correct me if I'm wrong. |
I use snipa repo wtih Mayday30 fix in Almost all nodes c addition from your repo becase port 3333)) |
This error does not appear so often during normal operation. it always appears when the pool is restarted and when the block is found. the rest of the time one for 30-50 updates of the block template |
That is very useful statistics and will help me to narrow down the problem area. But why do not you submit that against main Snipa's repo? I will try to investigate and fix that for course but I think he can do that much more easier (not sure if faster:). |
(not sure if faster:) that is why ) |
Looks like I finally managed to get better picture what is going on here. You got the problem right and I was wrong in my first comment about the fact that block template can be updated over time when prev_hash is not changed. Looks like this situation can happen when thread BT update happens before rapid BT update from main thread. In this case newBlockTemplate(...) is called twice (first from worker thread and second from main thread during sendToWorkers({type: 'newBlockTemplate', data: rpcResponse});). |
The fix will be very similar to what you suggested. |
Thanks. This fix concerns pool.js and xmr.js , if I want to apply the fix, what do I need to do ? |
For that fix you only need to restart pool module:
Will do the trick. |
xmr.js fixes are not necessary to fix this particular issue but it is related bug fixes. |
Excellent Job!!. Thanks a lot |
Thank you. |
Hello i think there is need to add code to prevent send duplicate job.
function newBlockTemplate(template) {
let buffer = new Buffer(template.blocktemplate_blob, 'hex');
let previous_hash = new Buffer(32);
buffer.copy(previous_hash, 0, 7, 39);
console.log(threadName + 'New block to mine at height: ' + template.height + '. Difficulty: ' + template.difficulty);
if (activeBlockTemplate) {
if (activeBlockTemplate.previous_hash.toString('hex') === template.prev_hash ) {
console.log(threadName + "Same job");
return;
}
pastBlockTemplates.enq(activeBlockTemplate);
}
activeBlockTemplate = new BlockTemplate(template);
console.log(threadName + "Update workers");
for (let minerId in activeMiners) {
if (activeMiners.hasOwnProperty(minerId)) {
let miner = activeMiners[minerId];
debug(threadName + "Updating worker " + miner.payout + " With new work at height: " + template.height);
miner.sendNewJob();
}
}
}
example:
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 4 - 63492) New block to mine at height: 42585. Difficulty: 75447651
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 4 - 63492) activeBlockTemplate : 1cd23e23e48d238c57e536a8aac2817220ee6be70fad8b5b3c79279ae8515d09
1|pool | (Worker 4 - 63492) 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | (Worker 4 - 63492) Update workers
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 1 - 63474) New block to mine at height: 42585. Difficulty: 75447651
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 1 - 63474) activeBlockTemplate : 1cd23e23e48d238c57e536a8aac2817220ee6be70fad8b5b3c79279ae8515d09
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 1 - 63474) 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 1 - 63474) Update workers
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 2 - 63480) New block to mine at height: 42585. Difficulty: 75447651
1|pool | (Worker 2 - 63480) activeBlockTemplate : 1cd23e23e48d238c57e536a8aac2817220ee6be70fad8b5b3c79279ae8515d09
1|pool | (Worker 2 - 63480) 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | (Worker 2 - 63480) Update workers
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 3 - 63486) New block to mine at height: 42585. Difficulty: 75447651
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 3 - 63486) activeBlockTemplate : 1cd23e23e48d238c57e536a8aac2817220ee6be70fad8b5b3c79279ae8515d09
1|pool | (Worker 3 - 63486) 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | (Worker 3 - 63486) Update workers
1|pool | 2018-01-05 21:18:22 +00:00: (Master) New block to mine at height: 42585. Difficulty: 75447651
1|pool | 2018-01-05 21:18:22 +00:00: (Master) activeBlockTemplate : 1cd23e23e48d238c57e536a8aac2817220ee6be70fad8b5b3c79279ae8515d09
1|pool | (Master) 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | 2018-01-05 21:18:22 +00:00: (Worker 4 - 63492) New block to mine at height: 42585. Difficulty: 75447651
1|pool | (Worker 4 - 63492) activeBlockTemplate : 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | (Worker 4 - 63492) 7062b336bc841d0d0dea6b09e94bf3b3d42371019252dbf1dbd8fdaff5af2140
1|pool | (Worker 4 - 63492) Same job
1|pool | 2018-01-05 21:18:22 +00:00: (Master) Update workers
The text was updated successfully, but these errors were encountered: