parent
4a14085908
commit
3d374fd9d9
@ -82,7 +82,7 @@ class Bisq {
|
|||||||
|
|
||||||
private checkForBisqDataFolder() {
|
private checkForBisqDataFolder() {
|
||||||
if (!fs.existsSync(config.BISQ_BLOCKS_DATA_PATH + Bisq.BLOCKS_JSON_FILE_PATH)) {
|
if (!fs.existsSync(config.BISQ_BLOCKS_DATA_PATH + Bisq.BLOCKS_JSON_FILE_PATH)) {
|
||||||
logger.info(config.BISQ_BLOCKS_DATA_PATH + Bisq.BLOCKS_JSON_FILE_PATH + ` doesn't exist. Make sure Bisq is running and the config is correct before starting the server.`);
|
logger.warn(config.BISQ_BLOCKS_DATA_PATH + Bisq.BLOCKS_JSON_FILE_PATH + ` doesn't exist. Make sure Bisq is running and the config is correct before starting the server.`);
|
||||||
return process.exit(1);
|
return process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ class Bisq {
|
|||||||
this.subdirectoryWatcher.close();
|
this.subdirectoryWatcher.close();
|
||||||
}
|
}
|
||||||
fsWait = setTimeout(() => {
|
fsWait = setTimeout(() => {
|
||||||
logger.info(`Bisq restart detected. Resetting both watchers in 3 minutes.`);
|
logger.debug(`Bisq restart detected. Resetting both watchers in 3 minutes.`);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.startTopDirectoryWatcher();
|
this.startTopDirectoryWatcher();
|
||||||
this.startSubDirectoryWatcher();
|
this.startSubDirectoryWatcher();
|
||||||
@ -125,7 +125,7 @@ class Bisq {
|
|||||||
clearTimeout(fsWait);
|
clearTimeout(fsWait);
|
||||||
}
|
}
|
||||||
fsWait = setTimeout(() => {
|
fsWait = setTimeout(() => {
|
||||||
logger.info(`Change detected in the Bisq data folder.`);
|
logger.debug(`Change detected in the Bisq data folder.`);
|
||||||
this.loadBisqDumpFile();
|
this.loadBisqDumpFile();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
});
|
});
|
||||||
@ -198,7 +198,7 @@ class Bisq {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const time = new Date().getTime() - start;
|
const time = new Date().getTime() - start;
|
||||||
logger.info('Bisq data index rebuilt in ' + time + ' ms');
|
logger.debug('Bisq data index rebuilt in ' + time + ' ms');
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculateStats() {
|
private calculateStats() {
|
||||||
@ -236,14 +236,14 @@ class Bisq {
|
|||||||
private async loadBisqBlocksDump(cacheData: string): Promise<void> {
|
private async loadBisqBlocksDump(cacheData: string): Promise<void> {
|
||||||
const start = new Date().getTime();
|
const start = new Date().getTime();
|
||||||
if (cacheData && cacheData.length !== 0) {
|
if (cacheData && cacheData.length !== 0) {
|
||||||
logger.info('Processing Bisq data dump...');
|
logger.debug('Processing Bisq data dump...');
|
||||||
const data: BisqBlocks = JSON.parse(cacheData);
|
const data: BisqBlocks = JSON.parse(cacheData);
|
||||||
if (data.blocks && data.blocks.length !== this.blocks.length) {
|
if (data.blocks && data.blocks.length !== this.blocks.length) {
|
||||||
this.blocks = data.blocks.filter((block) => block.txs.length > 0);
|
this.blocks = data.blocks.filter((block) => block.txs.length > 0);
|
||||||
this.blocks.reverse();
|
this.blocks.reverse();
|
||||||
this.latestBlockHeight = data.chainHeight;
|
this.latestBlockHeight = data.chainHeight;
|
||||||
const time = new Date().getTime() - start;
|
const time = new Date().getTime() - start;
|
||||||
logger.info('Bisq dump processed in ' + time + ' ms');
|
logger.debug('Bisq dump processed in ' + time + ' ms');
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Bisq dump didn't contain any blocks`);
|
throw new Error(`Bisq dump didn't contain any blocks`);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class Bisq {
|
|||||||
clearTimeout(fsWait);
|
clearTimeout(fsWait);
|
||||||
}
|
}
|
||||||
fsWait = setTimeout(() => {
|
fsWait = setTimeout(() => {
|
||||||
logger.info(`Change detected in the Bisq market data folder.`);
|
logger.debug(`Change detected in the Bisq market data folder.`);
|
||||||
this.loadBisqDumpFile();
|
this.loadBisqDumpFile();
|
||||||
}, Bisq.FOLDER_WATCH_CHANGE_DETECTION_DEBOUNCE);
|
}, Bisq.FOLDER_WATCH_CHANGE_DETECTION_DEBOUNCE);
|
||||||
});
|
});
|
||||||
@ -66,7 +66,7 @@ class Bisq {
|
|||||||
if (cryptoMtime > this.cryptoCurrencyLastMtime || fiatMtime > this.fiatCurrencyLastMtime) {
|
if (cryptoMtime > this.cryptoCurrencyLastMtime || fiatMtime > this.fiatCurrencyLastMtime) {
|
||||||
const cryptoCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.cryptoCurrency);
|
const cryptoCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.cryptoCurrency);
|
||||||
const fiatCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.fiatCurrency);
|
const fiatCurrencyData = await this.loadData<Currency[]>(Bisq.MARKET_JSON_FILE_PATHS.fiatCurrency);
|
||||||
logger.info('Updating Bisq Market Currency Data');
|
logger.debug('Updating Bisq Market Currency Data');
|
||||||
bisqMarket.setCurrencyData(cryptoCurrencyData, fiatCurrencyData);
|
bisqMarket.setCurrencyData(cryptoCurrencyData, fiatCurrencyData);
|
||||||
if (cryptoMtime > this.cryptoCurrencyLastMtime) {
|
if (cryptoMtime > this.cryptoCurrencyLastMtime) {
|
||||||
this.cryptoCurrencyLastMtime = cryptoMtime;
|
this.cryptoCurrencyLastMtime = cryptoMtime;
|
||||||
@ -79,7 +79,7 @@ class Bisq {
|
|||||||
const offersMtime = this.getFileMtime(Bisq.MARKET_JSON_FILE_PATHS.offers);
|
const offersMtime = this.getFileMtime(Bisq.MARKET_JSON_FILE_PATHS.offers);
|
||||||
if (offersMtime > this.offersLastMtime) {
|
if (offersMtime > this.offersLastMtime) {
|
||||||
const offersData = await this.loadData<OffersData[]>(Bisq.MARKET_JSON_FILE_PATHS.offers);
|
const offersData = await this.loadData<OffersData[]>(Bisq.MARKET_JSON_FILE_PATHS.offers);
|
||||||
logger.info('Updating Bisq Market Offers Data');
|
logger.debug('Updating Bisq Market Offers Data');
|
||||||
bisqMarket.setOffersData(offersData);
|
bisqMarket.setOffersData(offersData);
|
||||||
this.offersLastMtime = offersMtime;
|
this.offersLastMtime = offersMtime;
|
||||||
marketsDataUpdated = true;
|
marketsDataUpdated = true;
|
||||||
@ -87,7 +87,7 @@ class Bisq {
|
|||||||
const tradesMtime = this.getFileMtime(Bisq.MARKET_JSON_FILE_PATHS.trades);
|
const tradesMtime = this.getFileMtime(Bisq.MARKET_JSON_FILE_PATHS.trades);
|
||||||
if (tradesMtime > this.tradesLastMtime) {
|
if (tradesMtime > this.tradesLastMtime) {
|
||||||
const tradesData = await this.loadData<TradesData[]>(Bisq.MARKET_JSON_FILE_PATHS.trades);
|
const tradesData = await this.loadData<TradesData[]>(Bisq.MARKET_JSON_FILE_PATHS.trades);
|
||||||
logger.info('Updating Bisq Market Trades Data');
|
logger.debug('Updating Bisq Market Trades Data');
|
||||||
bisqMarket.setTradesData(tradesData);
|
bisqMarket.setTradesData(tradesData);
|
||||||
this.tradesLastMtime = tradesMtime;
|
this.tradesLastMtime = tradesMtime;
|
||||||
marketsDataUpdated = true;
|
marketsDataUpdated = true;
|
||||||
@ -95,7 +95,7 @@ class Bisq {
|
|||||||
if (marketsDataUpdated) {
|
if (marketsDataUpdated) {
|
||||||
bisqMarket.updateCache();
|
bisqMarket.updateCache();
|
||||||
const time = new Date().getTime() - start;
|
const time = new Date().getTime() - start;
|
||||||
logger.info('Bisq market data updated in ' + time + ' ms');
|
logger.debug('Bisq market data updated in ' + time + ' ms');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.err('loadBisqMarketDataDumpFile() error.' + e.message);
|
logger.err('loadBisqMarketDataDumpFile() error.' + e.message);
|
||||||
|
@ -79,7 +79,7 @@ class Blocks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`${found} of ${txIds.length} found in mempool. ${notFound} not found.`);
|
logger.debug(`${found} of ${txIds.length} found in mempool. ${notFound} not found.`);
|
||||||
|
|
||||||
block.reward = transactions[0].vout.reduce((acc, curr) => acc + curr.value, 0);
|
block.reward = transactions[0].vout.reduce((acc, curr) => acc + curr.value, 0);
|
||||||
block.coinbaseTx = this.stripCoinbaseTransaction(transactions[0]);
|
block.coinbaseTx = this.stripCoinbaseTransaction(transactions[0]);
|
||||||
|
@ -46,7 +46,7 @@ class Donations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async $handleWebhookRequest(data: any) {
|
async $handleWebhookRequest(data: any) {
|
||||||
logger.debug('Received BTCPayServer webhook data: ' + JSON.stringify(data));
|
logger.notice('Received BTCPayServer webhook data: ' + JSON.stringify(data));
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class FiatConversion {
|
|||||||
|
|
||||||
private updateCurrency() {
|
private updateCurrency() {
|
||||||
request('https://api.opennode.co/v1/rates', { json: true }, (err, res, body) => {
|
request('https://api.opennode.co/v1/rates', { json: true }, (err, res, body) => {
|
||||||
if (err) { return logger.info(err); }
|
if (err) { return logger.err(err); }
|
||||||
if (body && body.data) {
|
if (body && body.data) {
|
||||||
this.tickers = body.data;
|
this.tickers = body.data;
|
||||||
}
|
}
|
||||||
|
@ -138,10 +138,10 @@ class Mempool {
|
|||||||
if (this.mempoolProtection === 0 && transactions.length / currentMempoolSize <= 0.80) {
|
if (this.mempoolProtection === 0 && transactions.length / currentMempoolSize <= 0.80) {
|
||||||
this.mempoolProtection = 1;
|
this.mempoolProtection = 1;
|
||||||
this.inSync = false;
|
this.inSync = false;
|
||||||
logger.info('Mempool clear protection triggered.');
|
logger.warn('Mempool clear protection triggered.');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.mempoolProtection = 2;
|
this.mempoolProtection = 2;
|
||||||
logger.info('Mempool clear protection resumed.');
|
logger.warn('Mempool clear protection resumed.');
|
||||||
}, 1000 * 60 * 2);
|
}, 1000 * 60 * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class Server {
|
|||||||
|
|
||||||
cluster.on('exit', (worker, code, signal) => {
|
cluster.on('exit', (worker, code, signal) => {
|
||||||
const workerId = worker.process['env'].workerId;
|
const workerId = worker.process['env'].workerId;
|
||||||
logger.info(`Mempool Worker PID #${worker.process.pid} workerId: ${workerId} died. Restarting in 10 seconds... ${signal || code}`);
|
logger.warn(`Mempool Worker PID #${worker.process.pid} workerId: ${workerId} died. Restarting in 10 seconds... ${signal || code}`);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const env = { workerId: workerId };
|
const env = { workerId: workerId };
|
||||||
const newWorker = cluster.fork(env);
|
const newWorker = cluster.fork(env);
|
||||||
|
@ -29,7 +29,7 @@ class Routes {
|
|||||||
this.cache['3m'] = await statistics.$list3M();
|
this.cache['3m'] = await statistics.$list3M();
|
||||||
this.cache['6m'] = await statistics.$list6M();
|
this.cache['6m'] = await statistics.$list6M();
|
||||||
this.cache['1y'] = await statistics.$list1Y();
|
this.cache['1y'] = await statistics.$list1Y();
|
||||||
logger.info('Statistics cache created');
|
logger.debug('Statistics cache created');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async get2HStatistics(req: Request, res: Response) {
|
public async get2HStatistics(req: Request, res: Response) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user