Remove deprecated "getinfo" method.

This commit is contained in:
Valera Rozuvan 2018-03-13 17:51:49 +02:00 committed by Matthew Little
parent 57ce104c96
commit c9ec10ee5c
2 changed files with 15 additions and 13 deletions

View File

@ -4,7 +4,7 @@ var events = require('events');
var async = require('async'); var async = require('async');
/** /**
* The daemon interface interacts with the coin daemon by using the rpc interface. * 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 * in order to make it work it needs, as constructor, an array of objects containing
* - 'host' : hostname where the coin lives * - 'host' : hostname where the coin lives
@ -37,7 +37,7 @@ function DaemonInterface(daemons, logger){
} }
function isOnline(callback){ function isOnline(callback){
cmd('getinfo', [], function(results){ cmd('getnetworkinfo', [], function(results){
var allOnline = results.every(function(result){ var allOnline = results.every(function(result){
return !results.error; return !results.error;
}); });
@ -189,4 +189,4 @@ function DaemonInterface(daemons, logger){
DaemonInterface.prototype.__proto__ = events.EventEmitter.prototype; DaemonInterface.prototype.__proto__ = events.EventEmitter.prototype;
exports.interface = DaemonInterface; exports.interface = DaemonInterface;

View File

@ -146,7 +146,7 @@ var pool = module.exports = function pool(options, authorizeFn){
var generateProgress = function(){ var generateProgress = function(){
_this.daemon.cmd('getinfo', [], function(results) { _this.daemon.cmd('getblockchaininfo', [], function(results) {
var blockCount = results.sort(function (a, b) { var blockCount = results.sort(function (a, b) {
return b.response.blocks - a.response.blocks; return b.response.blocks - a.response.blocks;
})[0].response.blocks; })[0].response.blocks;
@ -369,7 +369,8 @@ var pool = module.exports = function pool(options, authorizeFn){
var batchRpcCalls = [ var batchRpcCalls = [
['validateaddress', [options.address]], ['validateaddress', [options.address]],
['getdifficulty', []], ['getdifficulty', []],
['getinfo', []], ['getblockchaininfo', []],
['getnetworkinfo', []],
['getmininginfo', []], ['getmininginfo', []],
['submitblock', []] ['submitblock', []]
]; ];
@ -422,12 +423,13 @@ var pool = module.exports = function pool(options, authorizeFn){
} }
})(); })();
options.testnet = rpcResults.getinfo.testnet; options.testnet = (rpcResults.getblockchaininfo.chain === 'test') ? true : false;
options.protocolVersion = rpcResults.getinfo.protocolversion;
options.protocolVersion = rpcResults.getnetworkinfo.protocolversion;
options.initStats = { options.initStats = {
connections: rpcResults.getinfo.connections, connections: rpcResults.getnetworkinfo.connections,
difficulty: rpcResults.getinfo.difficulty * algos[options.coin.algorithm].multiplier, difficulty: rpcResults.getblockchaininfo.difficulty * algos[options.coin.algorithm].multiplier,
networkHashRate: rpcResults.getmininginfo.networkhashps networkHashRate: rpcResults.getmininginfo.networkhashps
}; };
@ -488,9 +490,9 @@ var pool = module.exports = function pool(options, authorizeFn){
} else { } else {
this.sendDifficulty(8); this.sendDifficulty(8);
} }
this.sendMiningJob(_this.jobManager.currentJob.getJobParams()); this.sendMiningJob(_this.jobManager.currentJob.getJobParams());
}).on('submit', function(params, resultCallback){ }).on('submit', function(params, resultCallback){
var result =_this.jobManager.processShare( var result =_this.jobManager.processShare(
params.jobId, params.jobId,
@ -635,7 +637,7 @@ var pool = module.exports = function pool(options, authorizeFn){
cObj.client.removeAllListeners(); cObj.client.removeAllListeners();
_this.stratumServer.removeStratumClientBySubId(cObj.subId); _this.stratumServer.removeStratumClientBySubId(cObj.subId);
}); });
process.nextTick(function () { process.nextTick(function () {
resultCback( resultCback(
clientsToRelinquish.map( clientsToRelinquish.map(
@ -643,7 +645,7 @@ var pool = module.exports = function pool(options, authorizeFn){
return item.client; return item.client;
} }
) )
); );
}); });
} }
) )