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 2114211..b816ed4 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.includes('MinerGate')){ + this.identifier = "MinerGate"; + } this.paymentID = null; this.valid_miner = true; this.port = port; @@ -220,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]); @@ -568,13 +575,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);