Added events for mpos compatibility

This commit is contained in:
Matthew Little 2014-01-16 17:21:23 -07:00
parent f2438a4259
commit 6cdc9214ac
3 changed files with 8 additions and 2 deletions

View File

@ -136,7 +136,7 @@ pool.on('share', function(isValidShare, isValidBlock, data){
*/
pool.on('log', function(severity, logKey, logText){
console.log(severity + ': ' + '[' + logKey + '] ' + logText);
};
});
```
Start pool

View File

@ -230,7 +230,9 @@ var pool = module.exports = function pool(options, authorizeFn){
if (options.varDiff.enabled)
_this.varDiff.manageClient(client);
client.on('subscription', function(params, resultCallback){
client.on('difficultyChanged', function(diff){
_this.emit('difficultyUpdate', client.workerName, diff);
}).on('subscription', function(params, resultCallback){
var extraNonce = _this.jobManager.extraNonceCounter.next();
var extraNonce2Size = _this.jobManager.extraNonce2Size;

View File

@ -141,6 +141,10 @@ var StratumClient = function(options){
});
}
);
if (_this.lastEmittedDiff !== _this.difficulty){
_this.lastEmittedDiff = _this.difficulty
_this.emit('difficultyChanged', _this.difficulty);
}
}
function sendJson(){