Browse Source
return chain in /sync and use port from env variable
master
Mayank
5 years ago
No known key found for this signature in database
GPG Key ID: D037D60476CE748C
8 changed files with
32 additions and
28 deletions
-
.dockerignore
-
.gitignore
-
README.md
-
app.js
-
logic/bitcoind.js
-
package.json
-
services/bitcoind.js
|
|
@ -18,3 +18,4 @@ test/ |
|
|
|
coverage |
|
|
|
.nyc_output |
|
|
|
Makefile |
|
|
|
*.env |
|
|
@ -8,6 +8,5 @@ logs/ |
|
|
|
package-lock.json |
|
|
|
*.bak |
|
|
|
lb_settings.json |
|
|
|
.env |
|
|
|
.nyc_output |
|
|
|
coverage |
|
|
|
|
|
@ -13,8 +13,8 @@ |
|
|
|
volumes: |
|
|
|
- "/home/umbrel/lnd:/lnd" |
|
|
|
environment: |
|
|
|
BITCOIN_NETWORK: "mainnet" |
|
|
|
BITCOIN_HOST: "0.0.0.0" |
|
|
|
RPC_PORT: "8332" |
|
|
|
RPC_USER: "<your rpc username>" |
|
|
|
RPC_PASSWORD: "<your rpc password>" |
|
|
|
LND_NETWORK: "mainnet" |
|
|
|
|
|
@ -1,5 +1,7 @@ |
|
|
|
require('module-alias/register'); |
|
|
|
require('module-alias').addPath('.'); |
|
|
|
require('dotenv').config(); |
|
|
|
|
|
|
|
const express = require('express'); |
|
|
|
const path = require('path'); |
|
|
|
const morgan = require('morgan'); |
|
|
|
|
|
@ -68,13 +68,14 @@ async function getLocalSyncInfo() { |
|
|
|
const info = await bitcoindService.getBlockChainInfo(); |
|
|
|
|
|
|
|
var blockChainInfo = info.result; |
|
|
|
|
|
|
|
var chain = blockChainInfo.chain; |
|
|
|
var blockCount = blockChainInfo.blocks; |
|
|
|
var headerCount = blockChainInfo.headers; |
|
|
|
|
|
|
|
const percentSynced = (Math.trunc(blockCount / headerCount * 10000) / 10000).toFixed(4); // eslint-disable-line no-magic-numbers, max-len
|
|
|
|
|
|
|
|
return { |
|
|
|
chain: chain, |
|
|
|
percent: percentSynced, |
|
|
|
currentBlock: blockCount, |
|
|
|
headerCount: headerCount // eslint-disable-line object-shorthand,
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
{ |
|
|
|
"name": "umbrel-middleware", |
|
|
|
"version": "0.0.4", |
|
|
|
"version": "0.0.5", |
|
|
|
"description": "Middleware for Umbrel Node", |
|
|
|
"author": "Umbrel", |
|
|
|
"scripts": { |
|
|
@ -18,6 +18,7 @@ |
|
|
|
"continuation-local-storage": "^3.2.1", |
|
|
|
"cors": "^2.8.5", |
|
|
|
"debug": "^2.6.1", |
|
|
|
"dotenv": "^8.2.0", |
|
|
|
"express": "^4.16.3", |
|
|
|
"grpc": "^1.8.0", |
|
|
|
"module-alias": "^2.1.0", |
|
|
|
|
|
@ -3,7 +3,7 @@ const camelizeKeys = require('camelize-keys'); |
|
|
|
|
|
|
|
const BitcoindError = require('models/errors.js').BitcoindError; |
|
|
|
|
|
|
|
const BITCOIND_RPC_PORT = process.env.BITCOIN_NETWORK === 'testnet' ? 18332 : 8332; // eslint-disable-line no-magic-numbers, max-len
|
|
|
|
const BITCOIND_RPC_PORT = process.env.RPC_PORT || 8332; // eslint-disable-line no-magic-numbers, max-len
|
|
|
|
const BITCOIND_HOST = process.env.BITCOIN_HOST || '127.0.0.1'; |
|
|
|
const BITCOIND_RPC_USER = process.env.RPC_USER; |
|
|
|
const BITCOIND_RPC_PASSWORD = process.env.RPC_PASSWORD; |
|
|
|