Skip to content

Commit

Permalink
fix(database-service): use correct height key when fetching last comm…
Browse files Browse the repository at this point in the history
…it (#802)

* fetch height by commit key

* Empty commit

* use #state.height
  • Loading branch information
oXtxNt9U authored Dec 13, 2024
1 parent 99fe19d commit 1df3242
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/database/source/database-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1df3242

Please sign in to comment.