From e1c24559f09af18418affe7e07ae0546c20f3096 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Wed, 15 Jan 2014 21:54:41 -0700 Subject: [PATCH] Added initial vardiff. Needs testing... --- lib/pool.js | 5 ++++- lib/varDiff.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pool.js b/lib/pool.js index 6d449ac..b51ffa4 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -41,11 +41,14 @@ var pool = module.exports = function pool(options, authorizeFn){ function SetupVarDiff(){ - _this.varDiff = new varDifff(options.varDiff, options.difficulty); + _this.varDiff = new varDiff(options.varDiff, options.difficulty); _this.varDiff.on('difficultyRequest', function(){ emitLog('varDiff', 'Difficulty requested for vardiff'); if (_this.stratumServer) RequestDifficulty(function(){}); + }).on('newDifficulty', function(client, newDiff){ + client.sendDifficulty(newDiff); + client.sendMiningJob(_this.jobManager.currentJob.getJobParams()); }); } diff --git a/lib/varDiff.js b/lib/varDiff.js index ba90c02..63d6574 100644 --- a/lib/varDiff.js +++ b/lib/varDiff.js @@ -121,7 +121,7 @@ var varDiff = module.exports = function varDiff(options, poolDifficulty){ console.log('sending new difficutly ' + newDiff); - client.sendDifficulty(newDiff); + _this.emit('newDifficulty', client, newDiff); }); }; };