mirror of
https://github.com/mempool/mempool.git
synced 2025-01-18 05:12:35 +01:00
New backend config "NETWORK".
Only activate mempool protection. Log network to fixes #140
This commit is contained in:
parent
372c116283
commit
86c654f22f
@ -8,7 +8,7 @@
|
||||
"DB_DISABLED": false,
|
||||
"API_ENDPOINT": "/api/v1/",
|
||||
"ELECTRS_POLL_RATE_MS": 2000,
|
||||
"LIQUID": true,
|
||||
"NETWORK": "mainnet",
|
||||
"MEMPOOL_REFRESH_RATE_MS": 2000,
|
||||
"DEFAULT_PROJECTED_BLOCKS_AMOUNT": 8,
|
||||
"KEEP_BLOCK_AMOUNT": 24,
|
||||
|
@ -5,7 +5,7 @@ import projectedBlocks from './mempool-blocks';
|
||||
class FeeApi {
|
||||
constructor() { }
|
||||
|
||||
defaultFee = config.LIQUID ? 0.1 : 1;
|
||||
defaultFee = config.NETWORK === 'liquid' ? 0.1 : 1;
|
||||
|
||||
public getRecommendedFee() {
|
||||
const pBlocks = projectedBlocks.getMempoolBlocks();
|
||||
|
@ -135,7 +135,8 @@ class Mempool {
|
||||
}
|
||||
|
||||
// Prevent mempool from clear on bitcoind restart by delaying the deletion
|
||||
if (this.mempoolProtection === 0 && transactions.length / currentMempoolSize <= 0.80) {
|
||||
if ((config.NETWORK === 'mainnet' || !config.NETWORK)
|
||||
&& this.mempoolProtection === 0 && transactions.length / currentMempoolSize <= 0.80) {
|
||||
this.mempoolProtection = 1;
|
||||
this.inSync = false;
|
||||
logger.warn(`Mempool clear protection triggered because transactions.length: ${transactions.length} and currentMempoolSize: ${currentMempoolSize}.`);
|
||||
|
@ -1,3 +1,4 @@
|
||||
const config = require('../mempool-config.json');
|
||||
import * as dgram from 'dgram';
|
||||
|
||||
class Logger {
|
||||
@ -82,9 +83,10 @@ class Logger {
|
||||
msg = msg.slice(0, msg.length - 1);
|
||||
}
|
||||
}
|
||||
const network = (config.NETWORK === 'mainnet' || !config.NETWORK) ? '' : ' <' + config.NETWORK + '>';
|
||||
prionum = Logger.priorities[priority] || Logger.priorities.info;
|
||||
syslogmsg = `<${(this.fac * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()} ${msg}`;
|
||||
consolemsg = `${this.ts()} [${process.pid}] ${priority.toUpperCase()}: ${msg}`;
|
||||
syslogmsg = `<${(this.fac * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`;
|
||||
consolemsg = `${this.ts()} [${process.pid}] ${priority.toUpperCase()}:${network} ${msg}`;
|
||||
|
||||
this.syslog(syslogmsg);
|
||||
if (priority === 'warning') {
|
||||
|
Loading…
Reference in New Issue
Block a user