mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-06-02 15:32:30 +02:00
Fixed BTC node
This commit is contained in:
parent
71d0146b03
commit
c1bccaed65
2
apolloui
2
apolloui
@ -1 +1 @@
|
|||||||
Subproject commit f2ec08faad3fd084061ecadf8c84f24c42f8737c
|
Subproject commit 9a6bbff237eef8b3f8535531278350684338fe38
|
@ -23,11 +23,11 @@ cat << EOF
|
|||||||
}],
|
}],
|
||||||
"memory":
|
"memory":
|
||||||
{
|
{
|
||||||
"total": 245760,
|
"total": 2457600,
|
||||||
"available": 109952,
|
"available": 1099520,
|
||||||
"used": 233220,
|
"used": 2332200,
|
||||||
"cache": 97412,
|
"cache": 974120,
|
||||||
"swap": 1280
|
"swap": 12800
|
||||||
},
|
},
|
||||||
"cpu":
|
"cpu":
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const moment = require('moment');
|
||||||
|
|
||||||
function getData() {
|
function getData() {
|
||||||
const hashrate = getRandomFloat(3700, 4000).toFixed(1);
|
const hashrate = getRandomFloat(3700, 4000).toFixed(1);
|
||||||
return {
|
return {
|
||||||
"date": "2021-01-26 15:54:19",
|
"date": moment().format('YYYY-MM-DD HH:mm:ss'), //"2021-01-26 15:54:19"
|
||||||
"statVersion": "1.2",
|
"statVersion": "1.2",
|
||||||
"versions": {
|
"versions": {
|
||||||
"miner": "v13.16.1",
|
"miner": "v13.16.1",
|
||||||
|
@ -50,7 +50,7 @@ exports.up = async function (knex) {
|
|||||||
await knex('pools').insert({
|
await knex('pools').insert({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
donation: 1,
|
donation: 1,
|
||||||
url: 'stratum+tcp://us.litecoinpool.org:3333',
|
url: 'stratum+tcp://stratum.slushpool.com:3333',
|
||||||
username: 'jstefanop.a1',
|
username: 'jstefanop.a1',
|
||||||
password: 'a1',
|
password: 'a1',
|
||||||
index: 99
|
index: 99
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
const { exec } = require('child_process')
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
const litecoin = require('litecoin');
|
const bitcoin = require('litecoin');
|
||||||
|
|
||||||
module.exports = ({ define }) => {
|
module.exports = ({ define }) => {
|
||||||
define('stats', async (payload, { knex, errors, utils }) => {
|
define('stats', async (payload, { knex, errors, utils }) => {
|
||||||
@ -63,7 +63,7 @@ module.exports = ({ define }) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const litecoinClient = new litecoin.Client({
|
const bitcoinClient = new bitcoin.Client({
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 8332,
|
port: 8332,
|
||||||
user: 'futurebit',
|
user: 'futurebit',
|
||||||
@ -74,14 +74,14 @@ const litecoinClient = new litecoin.Client({
|
|||||||
|
|
||||||
function getNodeStats () {
|
function getNodeStats () {
|
||||||
const getBlockchainInfoPromise = new Promise((resolve, reject) => {
|
const getBlockchainInfoPromise = new Promise((resolve, reject) => {
|
||||||
litecoinClient.getBlockchainInfo((error, blockchainInfo) => {
|
bitcoinClient.getBlockchainInfo((error, blockchainInfo) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error)
|
reject(error)
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// Use bestblockhash to call bestBlock, to retrieve time of last block calculation
|
// Use bestblockhash to call bestBlock, to retrieve time of last block calculation
|
||||||
const bestBlockHash = blockchainInfo.bestblockhash
|
const bestBlockHash = blockchainInfo.bestblockhash
|
||||||
litecoinClient.getBlock(bestBlockHash, (error, block) => {
|
bitcoinClient.getBlock(bestBlockHash, (error, block) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error)
|
reject(error)
|
||||||
} else {
|
} else {
|
||||||
@ -98,7 +98,7 @@ function getNodeStats () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const getConnectionCountPromise = new Promise((resolve, reject) => {
|
const getConnectionCountPromise = new Promise((resolve, reject) => {
|
||||||
litecoinClient.getConnectionCount((error, connectionCount) => {
|
bitcoinClient.getConnectionCount((error, connectionCount) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error)
|
reject(error)
|
||||||
} else {
|
} else {
|
||||||
@ -112,7 +112,7 @@ function getNodeStats () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const getMiningInfoPromise = new Promise((resolve, reject) => {
|
const getMiningInfoPromise = new Promise((resolve, reject) => {
|
||||||
litecoinClient.getMiningInfo((error, miningInfo) => {
|
bitcoinClient.getMiningInfo((error, miningInfo) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error)
|
reject(error)
|
||||||
} else {
|
} else {
|
||||||
@ -126,7 +126,7 @@ function getNodeStats () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const getPeerInfoPromise = new Promise((resolve, reject) => {
|
const getPeerInfoPromise = new Promise((resolve, reject) => {
|
||||||
litecoinClient.getPeerInfo((error, peerInfo) => {
|
bitcoinClient.getPeerInfo((error, peerInfo) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error)
|
reject(error)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user