diff --git a/backend/src/api/mempool.ts b/backend/src/api/mempool.ts index f9a6b6d0c..915fdb783 100644 --- a/backend/src/api/mempool.ts +++ b/backend/src/api/mempool.ts @@ -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; diff --git a/backend/src/index.ts b/backend/src/index.ts index 47274d8df..727a2811d 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -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) diff --git a/backend/src/logger.ts b/backend/src/logger.ts index 2721301a0..1c0edfa9e 100644 --- a/backend/src/logger.ts +++ b/backend/src/logger.ts @@ -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}`;