mirror of
https://github.com/mempool/mempool.git
synced 2025-03-15 04:11:48 +01:00
Readding "BISQ_ENABLED". Display 'bisq' in logs.
This commit is contained in:
parent
d8857f1073
commit
e7a7b45ad0
3 changed files with 16 additions and 4 deletions
|
@ -135,7 +135,7 @@ class Mempool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent mempool from clear on bitcoind restart by delaying the deletion
|
// 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 === 0 && transactions.length / currentMempoolSize <= 0.80) {
|
||||||
this.mempoolProtection = 1;
|
this.mempoolProtection = 1;
|
||||||
this.inSync = false;
|
this.inSync = false;
|
||||||
|
|
|
@ -94,7 +94,7 @@ class Server {
|
||||||
fiatConversion.startService();
|
fiatConversion.startService();
|
||||||
diskCache.loadMempoolCache();
|
diskCache.loadMempoolCache();
|
||||||
|
|
||||||
if (config.NETWORK === 'bisq') {
|
if (config.BISQ_ENABLED) {
|
||||||
bisq.startBisqService();
|
bisq.startBisqService();
|
||||||
bisq.setPriceCallbackFunction((price) => websocketHandler.setExtraInitProperties('bsq-price', price));
|
bisq.setPriceCallbackFunction((price) => websocketHandler.setExtraInitProperties('bsq-price', price));
|
||||||
blocks.setNewBlockCallback(bisq.handleNewBitcoinBlock.bind(bisq));
|
blocks.setNewBlockCallback(bisq.handleNewBitcoinBlock.bind(bisq));
|
||||||
|
@ -146,7 +146,7 @@ class Server {
|
||||||
.get(config.API_ENDPOINT + 'backend-info', routes.getBackendInfo)
|
.get(config.API_ENDPOINT + 'backend-info', routes.getBackendInfo)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (config.NETWORK === 'bisq') {
|
if (config.BISQ_ENABLED) {
|
||||||
this.app
|
this.app
|
||||||
.get(config.API_ENDPOINT + 'bisq/stats', routes.getBisqStats)
|
.get(config.API_ENDPOINT + 'bisq/stats', routes.getBisqStats)
|
||||||
.get(config.API_ENDPOINT + 'bisq/tx/:txId', routes.getBisqTransaction)
|
.get(config.API_ENDPOINT + 'bisq/tx/:txId', routes.getBisqTransaction)
|
||||||
|
|
|
@ -54,6 +54,7 @@ class Logger {
|
||||||
private loghost: string;
|
private loghost: string;
|
||||||
private logport: number;
|
private logport: number;
|
||||||
private client: dgram.Socket;
|
private client: dgram.Socket;
|
||||||
|
private network: string;
|
||||||
|
|
||||||
constructor(fac) {
|
constructor(fac) {
|
||||||
let prio;
|
let prio;
|
||||||
|
@ -66,6 +67,7 @@ class Logger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.client = dgram.createSocket('udp4');
|
this.client = dgram.createSocket('udp4');
|
||||||
|
this.network = this.getNetwork();
|
||||||
}
|
}
|
||||||
|
|
||||||
private addprio(prio): void {
|
private addprio(prio): void {
|
||||||
|
@ -76,6 +78,16 @@ class Logger {
|
||||||
})(this);
|
})(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getNetwork(): string {
|
||||||
|
if (config.BISQ_ENABLED) {
|
||||||
|
return 'bisq';
|
||||||
|
}
|
||||||
|
if (config.NETWORK && config.NETWORK !== 'mainnet') {
|
||||||
|
return config.NETWORK;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
private msg(priority, msg) {
|
private msg(priority, msg) {
|
||||||
let consolemsg, prionum, syslogmsg;
|
let consolemsg, prionum, syslogmsg;
|
||||||
if (typeof msg === 'string' && msg.length > 0) {
|
if (typeof msg === 'string' && msg.length > 0) {
|
||||||
|
@ -83,7 +95,7 @@ class Logger {
|
||||||
msg = msg.slice(0, msg.length - 1);
|
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;
|
prionum = Logger.priorities[priority] || Logger.priorities.info;
|
||||||
syslogmsg = `<${(this.fac * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`;
|
syslogmsg = `<${(this.fac * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`;
|
||||||
consolemsg = `${this.ts()} [${process.pid}] ${priority.toUpperCase()}:${network} ${msg}`;
|
consolemsg = `${this.ts()} [${process.pid}] ${priority.toUpperCase()}:${network} ${msg}`;
|
||||||
|
|
Loading…
Add table
Reference in a new issue