rpc: implement getmininginfo.

This commit is contained in:
Christopher Jeffrey 2016-08-05 14:27:10 -07:00
parent ac774fbe3a
commit 6299b99614
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1132,9 +1132,37 @@ RPC.prototype.getblocktemplate = function getblocktemplate(args, callback) {
};
RPC.prototype.getmininginfo = function getmininginfo(args, callback) {
var self = this;
if (args.help || args.length !== 0)
return callback(new Error('getmininginfo'));
callback(new Error('Not implemented.'));
this.chain.getBlock(this.chain.tip.hash, function(err, block) {
if (err)
return callback(err);
if (!block)
return callback(new Error('Block not found.'));
self._hashps(120, -1, function(err, hashps) {
if (err)
return callback(err);
callback(null, {
blocks: self.chain.height,
currentblocksize: block.getSize(),
currentblocktx: block.txs.length,
difficulty: self._getDifficulty(),
errors: '',
genproclimit: self.proclimit,
networkhashps: hashps,
pooledtx: self.mempool.total,
testnet: self.network.type !== 'main',
chain: self.network.type,
generate: self.mining
});
});
});
};
RPC.prototype.getnetworkhashps = function getnetworkhashps(args, callback) {