Skip to content

Commit

Permalink
Enhanced Switch Pool functionality: if a pool doesn't exist nodeminer…
Browse files Browse the repository at this point in the history
… will attempt to add the pool and then switch to it
  • Loading branch information
brandon-barker committed Feb 17, 2014
1 parent c2b7ce3 commit 1d7f159
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/modules/bfgminer.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ module.exports = {
}

if (data.POOLS && data.POOLS.length > 0) {
var poolId = -1;

data.POOLS.forEach(function (p) {
if (p.URL == pool.url + ':' + pool.port) {
var poolId = p.POOL;
poolId = p.POOL;

self.send('switchpool', poolId, function(error, result) {
if (error) {
Expand All @@ -139,7 +141,20 @@ module.exports = {
callback(null, result);
});
}
})
});

if (poolId == -1) {
// Try add the pool to bf/c/sgminer
self.send('addpool', pool.url + ':' + pool.port + ',' + pool.workerName + ',' + pool.workerPassword, function (error, result) {
if (error) {
callback(error);
}

if (result.STATUS && result.STATUS[0].STATUS == 'S') {
self.changePool(miner, pool, callback);
}
});
}
}
});
},
Expand Down

0 comments on commit 1d7f159

Please sign in to comment.