diff --git a/backend/mempool-config.sample.json b/backend/mempool-config.sample.json index 5987673aa..9a9fae5cb 100644 --- a/backend/mempool-config.sample.json +++ b/backend/mempool-config.sample.json @@ -7,7 +7,7 @@ "DB_DATABASE": "mempool", "API_ENDPOINT": "/api/v1/", "ELECTRS_POLL_RATE_MS": 2000, - "MEMPOOL_REFRESH_RATE_MS": 10000, + "MEMPOOL_REFRESH_RATE_MS": 2000, "DEFAULT_PROJECTED_BLOCKS_AMOUNT": 3, "KEEP_BLOCK_AMOUNT": 24, "INITIAL_BLOCK_AMOUNT": 8, diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 447165b66..9ea215f90 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -63,8 +63,8 @@ class Blocks { console.log(`${found} of ${txIds.length} found in mempool. ${notFound} not found.`); transactions.sort((a, b) => b.feePerVsize - a.feePerVsize); - block.medianFee = this.median(transactions.map((tx) => tx.feePerVsize)); - block.feeRange = this.getFeesInRange(transactions, 8); + block.medianFee = transactions.length ? this.median(transactions.map((tx) => tx.feePerVsize)) : 0; + block.feeRange = transactions.length ? this.getFeesInRange(transactions, 8) : []; this.blocks.push(block); if (this.blocks.length > config.KEEP_BLOCK_AMOUNT) {