Skip to content

Commit

Permalink
Switch to readBlocks in build index
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Jun 4, 2024
1 parent 32559fa commit 34f200b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions scripts/build-raw-near-lake-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { mkdir, writeFile, access } = require('fs/promises');

const sha256 = require('../utils/sha256');
const { writeChangesFile, readChangesFile, changeKey, mergeChangesFiles } = require('../storage/lake/changes-index');
const { readShardBlocks } = require('../source/lake');
const { readBlocks } = require('../source/lake');

const debug = require('debug')('build-index');

Expand Down Expand Up @@ -37,11 +37,10 @@ async function main() {
const end = Math.min(start + BLOCKS_PER_BATCH, endBlockNumber);
console.log('Processing batch', start, end);

const blocksStream = readShardBlocks({ dataDir, shard, startBlockHeight: start, endBlockHeight: end });
const parseBlocksStream = mapStream(blocksStream, ({ data }) => JSON.parse(data.toString('utf-8')));
const blocksStream = readBlocks({ dataDir, shards: [shard], startBlockHeight: start, endBlockHeight: end });

let changesByAccountList = [];
for await (const { chunk, state_changes } of parseBlocksStream) {
for await (const { shards: [{ chunk, state_changes }] } of blocksStream) {
if (!chunk) {
continue;
}
Expand Down

0 comments on commit 34f200b

Please sign in to comment.