Allow stratum authentication with mining key on non-switching ports

This commit is contained in:
Matt 2014-05-07 01:23:50 -06:00
parent baadebd97d
commit 036f246ab7
1 changed files with 15 additions and 21 deletions

View File

@ -134,30 +134,24 @@ module.exports = function(logger){
if (poolOptions.validateWorkerUsername !== true) if (poolOptions.validateWorkerUsername !== true)
authCallback(true); authCallback(true);
else { else {
port = port.toString(); if (workerName.length === 40) {
if (portalConfig.switching) { try {
for (var switchName in portalConfig.switching) { new Buffer(workerName, 'hex');
if (portalConfig.switching[switchName].enabled && Object.keys(portalConfig.switching[switchName].ports).indexOf(port) !== -1) { authCallback(true);
if (workerName.length === 40) { }
try { catch (e) {
new Buffer(workerName, 'hex'); authCallback(false);
authCallback(true);
}
catch (e) {
authCallback(false);
}
}
else
authCallback(false);
return;
}
} }
} }
else {
pool.daemon.cmd('validateaddress', [workerName], function (results) {
var isValid = results.filter(function (r) {
return r.response.isvalid
}).length > 0;
authCallback(isValid);
});
}
pool.daemon.cmd('validateaddress', [workerName], function(results){
var isValid = results.filter(function(r){return r.response.isvalid}).length > 0;
authCallback(isValid);
});
} }
}; };