Skip to content

Commit

Permalink
Fix todo
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastijankuzner committed Jan 9, 2025
1 parent 75c1289 commit 59a0bbe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/database/source/database-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,12 @@ export class DatabaseService implements Contracts.Database.DatabaseService {
await this.rootDb.transaction(() => {
for (const [height, commit] of this.#commitCache.entries()) {
const proofSize = this.proofSize();
const buff = Buffer.from(commit.serialized, "hex"); // TODO: Slice to reduce buffer size
const headerSize = this.headerSize();

const buff = Buffer.from(commit.serialized.slice(0, (proofSize + headerSize) * 2), "hex");

void this.commitStorage.put(height, buff.subarray(0, proofSize));
void this.blockStorage.put(height, buff.subarray(proofSize, proofSize + this.headerSize()));
void this.blockStorage.put(height, buff.subarray(proofSize, proofSize + headerSize));
void this.transactionIdStorage.put(
height,
commit.block.transactions.map((tx) => tx.id),
Expand Down

0 comments on commit 59a0bbe

Please sign in to comment.