Readding "BISQ_ENABLED". Display 'bisq' in logs.
This commit is contained in:
		
							parent
							
								
									d8857f1073
								
							
						
					
					
						commit
						e7a7b45ad0
					
				@ -135,7 +135,7 @@ class Mempool {
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Prevent mempool from clear on bitcoind restart by delaying the deletion
 | 
			
		||||
      if ((config.NETWORK === 'mainnet' || config.NETWORK === 'bisq' || !config.NETWORK)
 | 
			
		||||
      if ((config.NETWORK === 'mainnet' || !config.NETWORK)
 | 
			
		||||
        && this.mempoolProtection === 0 && transactions.length / currentMempoolSize <= 0.80) {
 | 
			
		||||
        this.mempoolProtection = 1;
 | 
			
		||||
        this.inSync = false;
 | 
			
		||||
 | 
			
		||||
@ -94,7 +94,7 @@ class Server {
 | 
			
		||||
    fiatConversion.startService();
 | 
			
		||||
    diskCache.loadMempoolCache();
 | 
			
		||||
 | 
			
		||||
    if (config.NETWORK === 'bisq') {
 | 
			
		||||
    if (config.BISQ_ENABLED) {
 | 
			
		||||
      bisq.startBisqService();
 | 
			
		||||
      bisq.setPriceCallbackFunction((price) => websocketHandler.setExtraInitProperties('bsq-price', price));
 | 
			
		||||
      blocks.setNewBlockCallback(bisq.handleNewBitcoinBlock.bind(bisq));
 | 
			
		||||
@ -146,7 +146,7 @@ class Server {
 | 
			
		||||
      .get(config.API_ENDPOINT + 'backend-info', routes.getBackendInfo)
 | 
			
		||||
    ;
 | 
			
		||||
 | 
			
		||||
    if (config.NETWORK === 'bisq') {
 | 
			
		||||
    if (config.BISQ_ENABLED) {
 | 
			
		||||
      this.app
 | 
			
		||||
        .get(config.API_ENDPOINT + 'bisq/stats', routes.getBisqStats)
 | 
			
		||||
        .get(config.API_ENDPOINT + 'bisq/tx/:txId', routes.getBisqTransaction)
 | 
			
		||||
 | 
			
		||||
@ -54,6 +54,7 @@ class Logger {
 | 
			
		||||
  private loghost: string;
 | 
			
		||||
  private logport: number;
 | 
			
		||||
  private client: dgram.Socket;
 | 
			
		||||
  private network: string;
 | 
			
		||||
 | 
			
		||||
  constructor(fac) {
 | 
			
		||||
    let prio;
 | 
			
		||||
@ -66,6 +67,7 @@ class Logger {
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    this.client = dgram.createSocket('udp4');
 | 
			
		||||
    this.network = this.getNetwork();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private addprio(prio): void {
 | 
			
		||||
@ -76,6 +78,16 @@ class Logger {
 | 
			
		||||
    })(this);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private getNetwork(): string {
 | 
			
		||||
    if (config.BISQ_ENABLED) {
 | 
			
		||||
      return 'bisq';
 | 
			
		||||
    }
 | 
			
		||||
    if (config.NETWORK && config.NETWORK !== 'mainnet') {
 | 
			
		||||
      return config.NETWORK;
 | 
			
		||||
    }
 | 
			
		||||
    return '';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private msg(priority, msg) {
 | 
			
		||||
    let consolemsg, prionum, syslogmsg;
 | 
			
		||||
    if (typeof msg === 'string' && msg.length > 0) {
 | 
			
		||||
@ -83,7 +95,7 @@ class Logger {
 | 
			
		||||
        msg = msg.slice(0, msg.length - 1);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    const network = (config.NETWORK === 'mainnet' || !config.NETWORK) ? '' : ' <' + config.NETWORK + '>';
 | 
			
		||||
    const network = this.network ? ' <' + this.network + '>' : '';
 | 
			
		||||
    prionum = Logger.priorities[priority] || Logger.priorities.info;
 | 
			
		||||
    syslogmsg = `<${(this.fac * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`;
 | 
			
		||||
    consolemsg = `${this.ts()} [${process.pid}] ${priority.toUpperCase()}:${network} ${msg}`;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user