From a136f922c6bb7e85d38abedea2a7fe6a4b30c5c9 Mon Sep 17 00:00:00 2001 From: Matthew Little Date: Wed, 8 Jan 2014 19:57:32 -0500 Subject: [PATCH] updated --- daemon.js | 2 +- main.js | 6 ------ pool.js | 18 +++++++++++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/daemon.js b/daemon.js index 01033c1..cc243e1 100644 --- a/daemon.js +++ b/daemon.js @@ -73,7 +73,7 @@ function DaemonInterface(options){ }); res.on('end', function(){ var dataJson = JSON.parse(data); - callback(null, dataJson.result); + callback(dataJson.error, dataJson.result); }); }); diff --git a/main.js b/main.js index 7c12cbe..182b84b 100644 --- a/main.js +++ b/main.js @@ -4,12 +4,6 @@ var bignum = require('bignum'); var pool = require('./pool.js'); -var fff = "03be78733329d27a63d6ca058a1e3e1048d90e945c2ee985f4bc9042da280a4b"; -var ff = new Buffer(fff, 'hex'); -var nn = bignum.fromBuffer(ff); -var aa = nn.toBuffer(); -console.log(aa.toString('hex')); - function Coin(options){ this.options = options; diff --git a/pool.js b/pool.js index 84fe952..2faae2f 100644 --- a/pool.js +++ b/pool.js @@ -63,11 +63,23 @@ var pool = module.exports = function pool(coin){ callback(error, result); } ); + }, + submitMethod: function(callback){ + _this.daemon.cmd('submitblock', + [], + function(error, result){ + console.log(error); + if (error && error.message === 'Method not found') + callback(null, false); + else + callback(null, true); + } + ); } }, function(err, results){ if (err) return; - + coin.options.hasSubmitMethod = results.submitMethod; publicKeyBuffer = coin.options.reward === 'POW' ? util.script_to_address(results.addressInfo.address) : @@ -75,8 +87,8 @@ var pool = module.exports = function pool(coin){ _this.jobManager.newTemplate(results.rpcTemplate, publicKeyBuffer); - console.log(results.rpcTemplate); - console.log(_this.jobManager.currentJob.getJobParams()); + //console.log(results.rpcTemplate); + //console.log(_this.jobManager.currentJob.getJobParams()); });