mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-20 07:00:42 +02:00
Add sizeOnDisk to blockchainInfo
This commit is contained in:
parent
7cb3024143
commit
c41242ff42
@ -25,6 +25,7 @@ module.exports.typeDefs = `
|
|||||||
blocks: Int
|
blocks: Int
|
||||||
blockTime: Int
|
blockTime: Int
|
||||||
headers: Int
|
headers: Int
|
||||||
|
sizeOnDisk: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type MiningInfo {
|
type MiningInfo {
|
||||||
|
@ -5,17 +5,19 @@ const litecoin = require('litecoin');
|
|||||||
|
|
||||||
module.exports = ({ define }) => {
|
module.exports = ({ define }) => {
|
||||||
define('stats', async (payload, { knex, errors, utils }) => {
|
define('stats', async (payload, { knex, errors, utils }) => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const unrefinedStats = await getNodeStats()
|
const unrefinedStats = await getNodeStats()
|
||||||
|
|
||||||
// At this point, no error present
|
// At this point, no error present
|
||||||
|
|
||||||
const unrefinedBlockchainInfo = unrefinedStats[0];
|
const unrefinedBlockchainInfo = unrefinedStats[0];
|
||||||
|
|
||||||
|
// Convert sizeOnDisk to String because number too large
|
||||||
const blockchainInfo = {
|
const blockchainInfo = {
|
||||||
blocks: unrefinedBlockchainInfo.blocks,
|
blocks: unrefinedBlockchainInfo.blocks,
|
||||||
blockTime: unrefinedBlockchainInfo.blockTime,
|
blockTime: unrefinedBlockchainInfo.blockTime,
|
||||||
headers: unrefinedBlockchainInfo.headers
|
headers: unrefinedBlockchainInfo.headers,
|
||||||
|
sizeOnDisk: unrefinedBlockchainInfo.size_on_disk.toString()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Strip miningInfo of unnecessary properties
|
// Strip miningInfo of unnecessary properties
|
||||||
|
Loading…
Reference in New Issue
Block a user