From 1df32425058481078fb1bd4182004bced4d256e2 Mon Sep 17 00:00:00 2001 From: oXtxNt9U <120286271+oXtxNt9U@users.noreply.github.com> Date: Fri, 13 Dec 2024 21:40:51 +0900 Subject: [PATCH] fix(database-service): use correct height key when fetching last commit (#802) * fetch height by commit key * Empty commit * use #state.height --- packages/database/source/database-service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/database/source/database-service.ts b/packages/database/source/database-service.ts index 356299479..a2e4ea48b 100644 --- a/packages/database/source/database-service.ts +++ b/packages/database/source/database-service.ts @@ -209,8 +209,7 @@ export class DatabaseService implements Contracts.Database.DatabaseService { return [...this.#commitCache.values()].pop()!; } - const height = this.blockIdStorage.getRange({ limit: 1, reverse: true }).asArray[0].value; - return await this.commitFactory.fromBytes(this.#readCommitBytes(height)!); + return await this.commitFactory.fromBytes(this.#readCommitBytes(this.#state.height)!); } public addCommit(commit: Contracts.Crypto.Commit): void {