diff --git a/lib/daemon.js b/lib/daemon.js index 7e5ace1..30db842 100644 --- a/lib/daemon.js +++ b/lib/daemon.js @@ -4,7 +4,7 @@ var events = require('events'); var async = require('async'); -/** +/** * The daemon interface interacts with the coin daemon by using the rpc interface. * in order to make it work it needs, as constructor, an array of objects containing * - 'host' : hostname where the coin lives @@ -37,7 +37,7 @@ function DaemonInterface(daemons, logger){ } function isOnline(callback){ - cmd('getinfo', [], function(results){ + cmd('getnetworkinfo', [], function(results){ var allOnline = results.every(function(result){ return !results.error; }); @@ -189,4 +189,4 @@ function DaemonInterface(daemons, logger){ DaemonInterface.prototype.__proto__ = events.EventEmitter.prototype; -exports.interface = DaemonInterface; \ No newline at end of file +exports.interface = DaemonInterface; diff --git a/lib/pool.js b/lib/pool.js index 2b6ad4d..72c057b 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -146,7 +146,7 @@ var pool = module.exports = function pool(options, authorizeFn){ var generateProgress = function(){ - _this.daemon.cmd('getinfo', [], function(results) { + _this.daemon.cmd('getblockchaininfo', [], function(results) { var blockCount = results.sort(function (a, b) { return b.response.blocks - a.response.blocks; })[0].response.blocks; @@ -369,7 +369,8 @@ var pool = module.exports = function pool(options, authorizeFn){ var batchRpcCalls = [ ['validateaddress', [options.address]], ['getdifficulty', []], - ['getinfo', []], + ['getblockchaininfo', []], + ['getnetworkinfo', []], ['getmininginfo', []], ['submitblock', []] ]; @@ -422,12 +423,13 @@ var pool = module.exports = function pool(options, authorizeFn){ } })(); - options.testnet = rpcResults.getinfo.testnet; - options.protocolVersion = rpcResults.getinfo.protocolversion; + options.testnet = (rpcResults.getblockchaininfo.chain === 'test') ? true : false; + + options.protocolVersion = rpcResults.getnetworkinfo.protocolversion; options.initStats = { - connections: rpcResults.getinfo.connections, - difficulty: rpcResults.getinfo.difficulty * algos[options.coin.algorithm].multiplier, + connections: rpcResults.getnetworkinfo.connections, + difficulty: rpcResults.getblockchaininfo.difficulty * algos[options.coin.algorithm].multiplier, networkHashRate: rpcResults.getmininginfo.networkhashps }; @@ -488,9 +490,9 @@ var pool = module.exports = function pool(options, authorizeFn){ } else { this.sendDifficulty(8); } - + this.sendMiningJob(_this.jobManager.currentJob.getJobParams()); - + }).on('submit', function(params, resultCallback){ var result =_this.jobManager.processShare( params.jobId, @@ -635,7 +637,7 @@ var pool = module.exports = function pool(options, authorizeFn){ cObj.client.removeAllListeners(); _this.stratumServer.removeStratumClientBySubId(cObj.subId); }); - + process.nextTick(function () { resultCback( clientsToRelinquish.map( @@ -643,7 +645,7 @@ var pool = module.exports = function pool(options, authorizeFn){ return item.client; } ) - ); + ); }); } )