From bac8d452e964d59a24b8fb1ec439f50a8c0c9ea0 Mon Sep 17 00:00:00 2001 From: bz888 Date: Wed, 8 Nov 2023 13:30:44 +1300 Subject: [PATCH 1/4] Update toBlockResponse --- packages/node/src/indexer/worker/worker.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node/src/indexer/worker/worker.service.ts b/packages/node/src/indexer/worker/worker.service.ts index 39d557f51..e2d93203b 100644 --- a/packages/node/src/indexer/worker/worker.service.ts +++ b/packages/node/src/indexer/worker/worker.service.ts @@ -59,7 +59,7 @@ export class WorkerService extends BaseWorkerService< protected toBlockResponse(block: BlockContent): FetchBlockResponse { return { - parentHash: block.block.header.lastBlockId.hash.toString(), + parentHash: block.block.header.lastBlockId?.hash.toString(), }; } From 8e235b1a3675d3be29a5b22b0120940f500cfc81 Mon Sep 17 00:00:00 2001 From: bz888 Date: Wed, 8 Nov 2023 13:43:43 +1300 Subject: [PATCH 2/4] update chaneglog --- packages/node/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 5fe319196..453850134 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Reading `null` on first block (#204) ## [3.3.0] - 2023-11-06 ### Added From c10087838a384c5f3f7725bff609cdb56474dbec Mon Sep 17 00:00:00 2001 From: bz888 Date: Wed, 8 Nov 2023 14:08:08 +1300 Subject: [PATCH 3/4] update fetchBlockReponse type --- packages/node/src/indexer/worker/worker.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node/src/indexer/worker/worker.service.ts b/packages/node/src/indexer/worker/worker.service.ts index e2d93203b..3989d6ba0 100644 --- a/packages/node/src/indexer/worker/worker.service.ts +++ b/packages/node/src/indexer/worker/worker.service.ts @@ -18,7 +18,7 @@ import { IndexerManager } from '../indexer.manager'; import { BlockContent } from '../types'; export type FetchBlockResponse = { - parentHash: string; + parentHash: string | null; }; export type WorkerStatusResponse = { From 676bd951313ead88d5bf9acea997184b28b3ad61 Mon Sep 17 00:00:00 2001 From: bz888 Date: Wed, 8 Nov 2023 16:01:51 +1300 Subject: [PATCH 4/4] update repsones type --- packages/node/src/indexer/worker/worker.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node/src/indexer/worker/worker.service.ts b/packages/node/src/indexer/worker/worker.service.ts index 3989d6ba0..4e142d119 100644 --- a/packages/node/src/indexer/worker/worker.service.ts +++ b/packages/node/src/indexer/worker/worker.service.ts @@ -18,7 +18,7 @@ import { IndexerManager } from '../indexer.manager'; import { BlockContent } from '../types'; export type FetchBlockResponse = { - parentHash: string | null; + parentHash: string | undefined; }; export type WorkerStatusResponse = {