Removing unnused config MINED_BLOCKS_CACHE.
This commit is contained in:
		
							parent
							
								
									5750c00a64
								
							
						
					
					
						commit
						04d1c9cb12
					
				@ -2,7 +2,6 @@
 | 
			
		||||
  "MEMPOOL": {
 | 
			
		||||
    "NETWORK": "mainnet",
 | 
			
		||||
    "HTTP_PORT": 8999,
 | 
			
		||||
    "MINED_BLOCKS_CACHE": 144,
 | 
			
		||||
    "SPAWN_CLUSTER_PROCS": 0,
 | 
			
		||||
    "API_URL_PREFIX": "/api/v1/",
 | 
			
		||||
    "WEBSOCKET_REFRESH_RATE_MS": 2000
 | 
			
		||||
 | 
			
		||||
@ -6,8 +6,7 @@ import { Common } from './common';
 | 
			
		||||
import diskCache from './disk-cache';
 | 
			
		||||
 | 
			
		||||
class Blocks {
 | 
			
		||||
  private static INITIAL_BLOCK_AMOUNT = 8;
 | 
			
		||||
  private static KEEP_BLOCK_AMOUNT = 24;
 | 
			
		||||
  private static KEEP_BLOCK_AMOUNT = 8;
 | 
			
		||||
  private blocks: Block[] = [];
 | 
			
		||||
  private currentBlockHeight = 0;
 | 
			
		||||
  private lastDifficultyAdjustmentTime = 0;
 | 
			
		||||
@ -31,14 +30,14 @@ class Blocks {
 | 
			
		||||
    const blockHeightTip = await bitcoinApi.getBlockHeightTip();
 | 
			
		||||
 | 
			
		||||
    if (this.blocks.length === 0) {
 | 
			
		||||
      this.currentBlockHeight = blockHeightTip - Blocks.INITIAL_BLOCK_AMOUNT;
 | 
			
		||||
      this.currentBlockHeight = blockHeightTip - Blocks.KEEP_BLOCK_AMOUNT;
 | 
			
		||||
    } else {
 | 
			
		||||
      this.currentBlockHeight = this.blocks[this.blocks.length - 1].height;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (blockHeightTip - this.currentBlockHeight > Blocks.INITIAL_BLOCK_AMOUNT * 2) {
 | 
			
		||||
      logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${Blocks.INITIAL_BLOCK_AMOUNT} recent blocks`);
 | 
			
		||||
      this.currentBlockHeight = blockHeightTip - Blocks.INITIAL_BLOCK_AMOUNT;
 | 
			
		||||
    if (blockHeightTip - this.currentBlockHeight > Blocks.KEEP_BLOCK_AMOUNT * 2) {
 | 
			
		||||
      logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${Blocks.KEEP_BLOCK_AMOUNT} recent blocks`);
 | 
			
		||||
      this.currentBlockHeight = blockHeightTip - Blocks.KEEP_BLOCK_AMOUNT;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!this.lastDifficultyAdjustmentTime) {
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,6 @@ 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 +84,7 @@ class WebsocketHandler {
 | 
			
		||||
              'mempoolInfo': memPool.getMempoolInfo(),
 | 
			
		||||
              'vBytesPerSecond': memPool.getVBytesPerSecond(),
 | 
			
		||||
              'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
 | 
			
		||||
              'blocks': _blocks.slice(Math.max(_blocks.length - WebsocketHandler.INITIAL_BLOCK_AMOUNT, 0)),
 | 
			
		||||
              'blocks': _blocks,
 | 
			
		||||
              'conversions': fiatConversion.getTickers()['BTCUSD'],
 | 
			
		||||
              'mempool-blocks': mempoolBlocks.getMempoolBlocks(),
 | 
			
		||||
              'transactions': memPool.getLatestTransactions(),
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,6 @@ interface IConfig {
 | 
			
		||||
  MEMPOOL: {
 | 
			
		||||
    NETWORK: 'mainnet' | 'testnet' | 'liquid';
 | 
			
		||||
    HTTP_PORT: number;
 | 
			
		||||
    MINED_BLOCKS_CACHE: number;
 | 
			
		||||
    SPAWN_CLUSTER_PROCS: number;
 | 
			
		||||
    API_URL_PREFIX: string;
 | 
			
		||||
    WEBSOCKET_REFRESH_RATE_MS: number;
 | 
			
		||||
@ -46,7 +45,6 @@ const defaults: IConfig = {
 | 
			
		||||
  'MEMPOOL': {
 | 
			
		||||
    'NETWORK': 'mainnet',
 | 
			
		||||
    'HTTP_PORT': 8999,
 | 
			
		||||
    'MINED_BLOCKS_CACHE': 144,
 | 
			
		||||
    'SPAWN_CLUSTER_PROCS': 0,
 | 
			
		||||
    'API_URL_PREFIX': '/api/v1/',
 | 
			
		||||
    'WEBSOCKET_REFRESH_RATE_MS': 2000
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user