Dont compute fee percentile / median fee when indexing is disabled because we need summaries

This commit is contained in:
nymkappa 2023-02-19 19:17:51 +09:00
parent 6965c8f41b
commit eceedf0bdf
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
2 changed files with 7 additions and 4 deletions

View File

@ -207,9 +207,11 @@ class Blocks {
blk.extras.blockTime = 0; // TODO blk.extras.blockTime = 0; // TODO
blk.extras.feePercentiles = await BlocksSummariesRepository.$getFeePercentilesByBlockId(block.id); if (Common.indexingEnabled()) {
if (blk.extras.feePercentiles !== null) { blk.extras.feePercentiles = await BlocksSummariesRepository.$getFeePercentilesByBlockId(block.id);
blk.extras.medianFeeAmt = blk.extras.feePercentiles[3]; if (blk.extras.feePercentiles !== null) {
blk.extras.medianFeeAmt = blk.extras.feePercentiles[3];
}
} }
blk.extras.virtualSize = block.weight / 4.0; blk.extras.virtualSize = block.weight / 4.0;

View File

@ -24,7 +24,8 @@ import { FieldPacket, OkPacket, PoolOptions, ResultSetHeader, RowDataPacket } fr
private checkDBFlag() { private checkDBFlag() {
if (config.DATABASE.ENABLED === false) { if (config.DATABASE.ENABLED === false) {
logger.err('Trying to use DB feature but config.DATABASE.ENABLED is set to false, please open an issue'); const stack = new Error().stack;
logger.err(`Trying to use DB feature but config.DATABASE.ENABLED is set to false, please open an issue.\nStack trace: ${stack}}`);
} }
} }