From 389bcc08390bfb18223033a1ecb1b327cdb3fad0 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 17 Apr 2024 17:46:33 +0100 Subject: [PATCH] fix: actually check the latestBlockhash if it's null --- packages/core/src/lib/lit-core.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/lib/lit-core.ts b/packages/core/src/lib/lit-core.ts index 0deba36e13..54234bced2 100644 --- a/packages/core/src/lib/lit-core.ts +++ b/packages/core/src/lib/lit-core.ts @@ -490,7 +490,13 @@ export class LitCore { getLatestBlockhash = async (): Promise => { await this.connect(); - return this.latestBlockhash as string; + if (!this.latestBlockhash) { + throw new Error( + `latestBlockhash is not available. Received: "${this.latestBlockhash}"` + ); + } + + return this.latestBlockhash; }; /**