Remove unescessary data from the blocks-bulk API

This commit is contained in:
nymkappa 2023-02-18 08:28:59 +09:00
parent 73f76474dd
commit 8612dd2d73
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
2 changed files with 10 additions and 1 deletions

View File

@ -783,10 +783,18 @@ class Blocks {
const blocks: any[] = []; const blocks: any[] = [];
while (fromHeight <= toHeight) { while (fromHeight <= toHeight) {
let block = await blocksRepository.$getBlockByHeight(fromHeight); let block: any = await blocksRepository.$getBlockByHeight(fromHeight);
if (!block) { if (!block) {
block = await this.$indexBlock(fromHeight); 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); blocks.push(block);
fromHeight++; fromHeight++;
} }

View File

@ -384,6 +384,7 @@ class BlocksRepository {
} }
rows[0].fee_span = JSON.parse(rows[0].fee_span); rows[0].fee_span = JSON.parse(rows[0].fee_span);
rows[0].fee_percentiles = JSON.parse(rows[0].fee_percentiles);
return rows[0]; return rows[0];
} catch (e) { } catch (e) {
logger.err(`Cannot get indexed block ${height}. Reason: ` + (e instanceof Error ? e.message : e)); logger.err(`Cannot get indexed block ${height}. Reason: ` + (e instanceof Error ? e.message : e));