Skip to content

Commit

Permalink
Update for CN/r
Browse files Browse the repository at this point in the history
  • Loading branch information
Snipa22 committed Mar 4, 2019
1 parent 0fcabef commit 76148a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions lib/pool.js
Expand Up @@ -500,7 +500,8 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer
blob: blob, blob: blob,
job_id: newJob.id, job_id: newJob.id,
target: target, target: target,
id: this.id id: this.id,
height: newJob.height
}; };
} else { } else {
let blob = activeBlockTemplate.nextBlobWithChildNonce(); let blob = activeBlockTemplate.nextBlobWithChildNonce();
Expand Down Expand Up @@ -621,25 +622,29 @@ function processShare(miner, job, blockTemplate, params, sendReply) {
} }
else { else {
convertedBlob = global.coinFuncs.convertBlob(shareBuffer); convertedBlob = global.coinFuncs.convertBlob(shareBuffer);
hash = global.coinFuncs.cryptoNight(convertedBlob); hash = multiHashing.cryptonight(convertedBlob, convertedBlob[0] >= 10 ? 13 : 8, job.height);
shareType = false; shareType = false;
} }
if (hash.toString('hex') !== resultHash) { if (hash.toString('hex') !== resultHash) {
if (job.height >= 1546000 && coinFuncs.isxmr) { if (job.height >= 1546000 && coinFuncs.isxmr) {
hash = multiHashing.cryptonight(convertedBlob, 0); if (multiHashing.cryptonight(convertedBlob, 0).toString("hex") === resultHash) {
if (hash.toString("hex") === resultHash) {
console.error(threadName + "Bad hashing algo (CN/0) from miner " + miner.logString); console.error(threadName + "Bad hashing algo (CN/0) from miner " + miner.logString);
process.send({type: "invalidShare"}); process.send({type: "invalidShare"});
miner.oldVersion = true; miner.oldVersion = true;
return false; return false;
} }
hash = multiHashing.cryptonight(convertedBlob, 1); if (multiHashing.cryptonight(convertedBlob, 1).toString("hex") === resultHash) {
if (hash.toString("hex") === resultHash) {
console.error(threadName + "Bad hashing algo (CN/1) from miner " + miner.logString); console.error(threadName + "Bad hashing algo (CN/1) from miner " + miner.logString);
process.send({type: "invalidShare"}); process.send({type: "invalidShare"});
miner.oldVersion = true; miner.oldVersion = true;
return false; return false;
} }
if (multiHashing.cryptonight(convertedBlob, 8).toString("hex") === resultHash) {
console.error(threadName + "Bad hashing algo (CN/2) from miner " + miner.logString);
process.send({type: "invalidShare"});
miner.oldVersion = true;
return false;
}
} }
console.error(threadName + "Bad share from miner " + miner.logString); console.error(threadName + "Bad share from miner " + miner.logString);
process.send({type: 'invalidShare'}); process.send({type: 'invalidShare'});
Expand Down Expand Up @@ -857,7 +862,7 @@ if (cluster.isMaster) {
global.mysql.query("UPDATE pools SET last_checkin = ?, active = ? WHERE id = ?", [global.support.formatDate(Date.now()), true, global.config.pool_id]); global.mysql.query("UPDATE pools SET last_checkin = ?, active = ? WHERE id = ?", [global.support.formatDate(Date.now()), true, global.config.pool_id]);
if (activeBlockTemplate) { if (activeBlockTemplate) {
global.mysql.query("UPDATE pools SET blockIDTime = now(), blockID = ? where id = ?", [activeBlockTemplate.height, global.config.pool_id]); global.mysql.query("UPDATE pools SET blockIDTime = now(), blockID = ? where id = ?", [activeBlockTemplate.height, global.config.pool_id]);
} }
global.config.ports.forEach(function (portData) { global.config.ports.forEach(function (portData) {
global.mysql.query("UPDATE ports SET lastSeen = now(), miners = ? WHERE pool_id = ? AND network_port = ?", [minerCount[portData.port], global.config.pool_id, portData.port]); global.mysql.query("UPDATE ports SET lastSeen = now(), miners = ? WHERE pool_id = ? AND network_port = ?", [minerCount[portData.port], global.config.pool_id, portData.port]);
}); });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -43,7 +43,7 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"cryptonote-util": "git://github.com/Snipa22/node-cryptonote-util.git#xmr-Nan-2.0", "cryptonote-util": "git://github.com/Snipa22/node-cryptonote-util.git#xmr-Nan-2.0",
"cryptonight-hashing": "git+https://github.com/MoneroOcean/node-cryptonight-hashing.git", "cryptonight-hashing": "git+https://github.com/MoneroOcean/node-cryptonight-hashing.git#v8.0.0",
"multi-hashing": "git+https://github.com/Snipa22/node-multi-hashing-aesni.git#v0.1" "multi-hashing": "git+https://github.com/Snipa22/node-multi-hashing-aesni.git#v0.1"
} }
} }

0 comments on commit 76148a0

Please sign in to comment.