Readding "BISQ_ENABLED". Display 'bisq' in logs.

This commit is contained in:
softsimon 2020-10-15 11:54:21 +07:00
parent d8857f1073
commit e7a7b45ad0
No known key found for this signature in database
GPG key ID: 488D7DCFB5A430D7
3 changed files with 16 additions and 4 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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}`;