diff --git a/src/database/doctor.ts b/src/database/doctor.ts index c1310b4..5a9999d 100644 --- a/src/database/doctor.ts +++ b/src/database/doctor.ts @@ -47,12 +47,11 @@ export const findBlockGaps = async ( ); const missingHeights: number[] = []; - - for (const heightGroup of queryHeightGroups) { + for (const [index, heightGroup] of queryHeightGroups.entries()) { const blockQ: { rows: unknown[] } = await cassandraClient.execute( - `SELECT block_height FROM ${KEYSPACE}.block_height_sorted_asc WHERE height >= ${R.head( + `SELECT block_height FROM ${KEYSPACE}.block_height_sorted_asc WHERE nth_million = ${index} AND block_height >= ${R.head( heightGroup - )} AND height <= ${R.last(heightGroup)}` + )} AND block_height <= ${R.last(heightGroup)}` ); for (const height of R.range( R.head(heightGroup), diff --git a/src/workers/import-block.ts b/src/workers/import-block.ts index 8902fcb..e695d18 100644 --- a/src/workers/import-block.ts +++ b/src/workers/import-block.ts @@ -56,7 +56,7 @@ export async function importBlock( try { await blockHeightToHashMapper.insert({ - block_heigh: height, + block_height: height, block_hash: newBlock.indep_hash, }); } catch (error) { @@ -94,6 +94,7 @@ export async function importBlock( try { await blockSortedAscMapper.insert({ + block_height: height, block_hash: newBlock.indep_hash, nth_million: nthMillBlock, }); @@ -103,6 +104,7 @@ export async function importBlock( try { await blockSortedDescMapper.insert({ + block_height: height, block_hash: newBlock.indep_hash, nth_million: nthMillBlock, });