rpc: implement getmininginfo.
This commit is contained in:
parent
ac774fbe3a
commit
6299b99614
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user