From 02b154f990792bea76e413347027dd610d850c13 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Mon, 27 Apr 2020 00:51:33 +0700 Subject: [PATCH] Hashes per second in case we use this --- logic/bitcoind.js | 7 ++++++- services/bitcoind.js | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/logic/bitcoind.js b/logic/bitcoind.js index 0fbd9b4..15dd624 100644 --- a/logic/bitcoind.js +++ b/logic/bitcoind.js @@ -164,12 +164,17 @@ async function nodeStatusSummary() { const networkInfo = await bitcoindService.getNetworkInfo(); const mempoolInfo = await bitcoindService.getMempoolInfo(); + // This line requires upstream changes + //const hashespersec = await bitcoindService.getHashesPerSec(); + return { blocks: blockchainInfo.result.blocks, difficulty: blockchainInfo.result.difficulty, size: blockchainInfo.result.sizeOnDisk, mempool: mempoolInfo.result, - connections: networkInfo.result.connections, + connections: networkInfo.result.connections + // Below requires upstream changes to bitcoind-rpc library + // hashespersec: hashespersec.result } } diff --git a/services/bitcoind.js b/services/bitcoind.js index 871208a..6acea75 100644 --- a/services/bitcoind.js +++ b/services/bitcoind.js @@ -96,6 +96,10 @@ function getNetworkInfo() { return promiseify(rpcClient, rpcClient.getNetworkInfo, 'network info'); } +function getHashesPerSec() { + return promiseify(rpcClient, rpcClient.getNetworkHashPs, 'network hash per second'); +} + function help() { // TODO: missing from the library, but can add it not sure how to package. // rpc.uptime(function (err, res) { @@ -109,6 +113,7 @@ function help() { } module.exports = { + getHashesPerSec, getBlockHash, getBlock, getTransaction,