Remove unescessary data from the blocks-bulk API

This commit is contained in:
nymkappa committed 2023-02-25 14:22:12 +09:00
1 parent 73f76474dd
commit 8612dd2d73
2 files changed
+10 -1

No files matched your search

+9 -1
View File
@@ -783,10 +783,18 @@ class Blocks {
const blocks: any[] = [];
while (fromHeight <= toHeight) {
let block = await blocksRepository.$getBlockByHeight(fromHeight);
let block: any = await blocksRepository.$getBlockByHeight(fromHeight);
if (!block) {
block = await this.$indexBlock(fromHeight);
}
delete(block.hash);
delete(block.previous_block_hash);
delete(block.pool_name);
delete(block.pool_link);
delete(block.pool_addresses);
delete(block.pool_regexes);
blocks.push(block);
fromHeight++;
}
@@ -384,6 +384,7 @@ class BlocksRepository {
}
rows[0].fee_span = JSON.parse(rows[0].fee_span);
rows[0].fee_percentiles = JSON.parse(rows[0].fee_percentiles);
return rows[0];
} catch (e) {
logger.err(`Cannot get indexed block ${height}. Reason: ` + (e instanceof Error ? e.message : e));