From bda4c57bd9ebb3e7163266705a78d52cbe82d957 Mon Sep 17 00:00:00 2001 From: Andrea Baccega Date: Fri, 14 Feb 2014 12:03:25 +0100 Subject: [PATCH] Fixed crash when running over a POS coin Added emitLog for debugging the Block Submit --- lib/jobManager.js | 14 ++++++++++++++ lib/pool.js | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/jobManager.js b/lib/jobManager.js index 608eca6..9d9ff73 100644 --- a/lib/jobManager.js +++ b/lib/jobManager.js @@ -199,6 +199,20 @@ var JobManager = module.exports = function JobManager(options){ return shareError([23, 'low difficulty share']); } } + if (!!blockHex) { + _this.emit('debugBlockShare', + { + 'extraNonce1': extraNonce1, + 'extraNonce2': extraNonce2, + 'nTime': nTime, + 'nonce': nonce, + 'headerBuffer': headerBuffer.toString('hex'), + 'headerHash': headerHash.toString('hex'), + 'blockHex': blockHex, + 'blockHash': blockHash + } + ); + } _this.emit('share', { job: jobId, diff --git a/lib/pool.js b/lib/pool.js index e49ac1f..140f100 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -110,7 +110,9 @@ var pool = module.exports = function pool(options, authorizeFn){ function SetupJobManager(){ _this.jobManager = new jobManager({ algorithm : options.algorithm, - address : options.address + address : options.address, + reward : options.reward, + txMessages: options.txMessages }); _this.jobManager.on('newBlock', function(blockTemplate){ //Check if stratumServer has been initialized yet @@ -140,6 +142,8 @@ var pool = module.exports = function pool(options, authorizeFn){ }); }); } + }).on('debugBlockShare', function(debugData) { + emitLog('debugBlockSubmit', JSON.stringify(debugData)); }); }