Revamping configuration file.

fixes #141
This commit is contained in:
softsimon
2020-10-19 11:57:02 +07:00
parent 0abe62128e
commit 45efb604c1
17 changed files with 218 additions and 146 deletions

View File

@@ -1,4 +1,3 @@
const config = require('../../mempool-config.json');
import logger from '../logger';
import * as WebSocket from 'ws';
import { Block, TransactionExtended, WebsocketResponse, MempoolBlock, OptimizedStatistic } from '../interfaces';
@@ -10,6 +9,7 @@ import fiatConversion from './fiat-conversion';
import { Common } from './common';
class WebsocketHandler {
private static INITIAL_BLOCK_AMOUNT = 8;
private wss: WebSocket.Server | undefined;
private nativeAssetId = '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d';
private extraInitProperties = {};
@@ -85,7 +85,7 @@ class WebsocketHandler {
'mempoolInfo': memPool.getMempoolInfo(),
'vBytesPerSecond': memPool.getVBytesPerSecond(),
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
'blocks': _blocks.slice(Math.max(_blocks.length - config.INITIAL_BLOCK_AMOUNT, 0)),
'blocks': _blocks.slice(Math.max(_blocks.length - WebsocketHandler.INITIAL_BLOCK_AMOUNT, 0)),
'conversions': fiatConversion.getTickers()['BTCUSD'],
'mempool-blocks': mempoolBlocks.getMempoolBlocks(),
'transactions': memPool.getLatestTransactions(),