From eef41032960b1e7d1991c683066cd2f4d559a83a Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 4 Jan 2016 05:07:53 -0800 Subject: [PATCH] miner: status event. --- lib/bcoin/miner.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/bcoin/miner.js b/lib/bcoin/miner.js index c4d7f44f..2e7772a5 100644 --- a/lib/bcoin/miner.js +++ b/lib/bcoin/miner.js @@ -119,7 +119,7 @@ exports.miner = function miner(options, callback) { function iter(block) { timeout = setTimeout(function() { - var hash, begin, hps; + var hash, begin, rate; begin = utils.now(); @@ -133,7 +133,7 @@ exports.miner = function miner(options, callback) { block.nonce++; } - hps = (0xffffffff / (utils.now() - begin)) * 2; + rate = (0xffffffff / (utils.now() - begin)) * 2; block.nonce = 0; block.extraNonce.iaddn(1); @@ -144,10 +144,10 @@ exports.miner = function miner(options, callback) { updateMerkle(block); e.emit('status', { - block: nextBlock, - extraNonce: block.extraNonce, - hps: hps, - target: block.bits + block: block, + target: utils.fromCompact(block.bits), + hashes: block.extraNonce.mul(0xffffffff), + hashrate: rate }); return iter(block); @@ -203,7 +203,7 @@ module.exports = function mine(pool, options) { miner.on('status', function(stat) { if (options.log) - console.log('Hashes per second: %s', stat.hps); + console.log('Hashes per second: %s', stat.hashrate); }); miner.start();