From ea8226ccac01d31c26f3ddee0e69fddb0edf7bdd Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Fri, 17 Feb 2017 16:08:36 -0800 Subject: [PATCH 1/2] Minergate bypass --- lib/pool.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/pool.js b/lib/pool.js index 2114211..246b84b 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -184,7 +184,7 @@ let VarDiff = (function () { }; })(); -function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVersion, portType, port) { +function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVersion, portType, port, agent) { // Username Layout -
. // Password Layout - .. // Default function is to use the password so they can login. Identifiers can be unique, payment ID is last. @@ -195,6 +195,9 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer let pass_split = pass.split(":"); this.error = ""; this.identifier = pass_split[0]; + if (agent.contains('MinerGate')){ + this.identifier = "MinerGate"; + } this.paymentID = null; this.valid_miner = true; this.port = port; @@ -568,13 +571,13 @@ function handleMinerData(method, params, ip, portData, sendReply, pushMessage) { } switch (method) { case 'login': - if (!params.login || !params.pass) { + if (!params.login || (!params.pass && !params.agent.includes('MinerGate'))) { sendReply("No login/password specified"); return; } let difficulty = portData.difficulty; let minerId = uuidV4(); - miner = new Miner(minerId, params.login, params.pass, ip, difficulty, pushMessage, 1, portData.portType, portData.port); + miner = new Miner(minerId, params.login, params.pass, ip, difficulty, pushMessage, 1, portData.portType, portData.port, params.agent); if (!miner.valid_miner) { console.log("Invalid miner, disconnecting due to: " + miner.error); sendReply(miner.error); From 33e2f08eeb77033c66a32b5eb059bc7d674657eb Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Fri, 17 Feb 2017 16:13:58 -0800 Subject: [PATCH 2/2] NiceHash fixing at 90k diff. --- lib/coins/xmr.js | 2 ++ lib/pool.js | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/coins/xmr.js b/lib/coins/xmr.js index 5365ce1..44259b6 100644 --- a/lib/coins/xmr.js +++ b/lib/coins/xmr.js @@ -33,6 +33,8 @@ function Coin(data){ this.intPrefix = 54; } + this.niceHashDiff = 90000; + this.getBlockHeaderByID = function(blockId, callback){ global.support.rpcDaemon('getblockheaderbyheight', {"height": blockId}, function (body) { if (body.hasOwnProperty('result')){ diff --git a/lib/pool.js b/lib/pool.js index 246b84b..b816ed4 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -195,7 +195,7 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer let pass_split = pass.split(":"); this.error = ""; this.identifier = pass_split[0]; - if (agent.contains('MinerGate')){ + if (agent.includes('MinerGate')){ this.identifier = "MinerGate"; } this.paymentID = null; @@ -223,6 +223,10 @@ function Miner(id, login, pass, ipAddress, startingDiff, messageSender, protoVer this.fixed_diff = false; this.difficulty = startingDiff; this.connectTime = Date.now(); + if (agent.includes('NiceHash')){ + this.fixed_diff = true; + this.difficulty = global.coinFuncs.niceHashDiff; + } if (diffSplit.length === 2) { this.fixed_diff = true; this.difficulty = Number(diffSplit[1]);