From 0fa890f627711514f5f346429dfaa60091fec8b0 Mon Sep 17 00:00:00 2001 From: Zitao Xiong Date: Wed, 16 Feb 2022 21:38:04 +0800 Subject: [PATCH] feat: add index_block_hash to by height result --- docs/entities/blocks/block.schema.json | 8 ++++++++ docs/generated.d.ts | 8 ++++++++ src/api/controllers/db-controller.ts | 2 ++ 3 files changed, 18 insertions(+) diff --git a/docs/entities/blocks/block.schema.json b/docs/entities/blocks/block.schema.json index 0292bc72..a07faba2 100644 --- a/docs/entities/blocks/block.schema.json +++ b/docs/entities/blocks/block.schema.json @@ -37,6 +37,14 @@ "type": "string", "description": "Hash representing the block" }, + "index_block_hash": { + "type": "string", + "description": "Hash of the index block" + }, + "parent_index_block_hash": { + "type": "string", + "description": "Hash of the parent index block" + }, "parent_block_hash": { "type": "string", "description": "Hash of the parent block" diff --git a/docs/generated.d.ts b/docs/generated.d.ts index 7ea2099e..b2c9c6d8 100644 --- a/docs/generated.d.ts +++ b/docs/generated.d.ts @@ -1219,6 +1219,14 @@ export interface Block { * Hash representing the block */ hash: string; + /** + * Hash of the index block + */ + index_block_hash?: string; + /** + * Hash of the parent index block + */ + parent_index_block_hash?: string; /** * Hash of the parent block */ diff --git a/src/api/controllers/db-controller.ts b/src/api/controllers/db-controller.ts index 86f88d95..293d7376 100644 --- a/src/api/controllers/db-controller.ts +++ b/src/api/controllers/db-controller.ts @@ -458,6 +458,8 @@ function parseDbBlock( canonical: dbBlock.canonical, height: dbBlock.block_height, hash: dbBlock.block_hash, + index_block_hash: dbBlock.index_block_hash, + parent_index_block_hash: dbBlock.parent_index_block_hash, parent_block_hash: dbBlock.parent_block_hash, burn_block_time: dbBlock.burn_block_time, burn_block_time_iso: unixEpochToIso(dbBlock.burn_block_time),