Index block summaries in db

This commit is contained in:
nymkappa
2022-06-18 16:48:02 +02:00
parent 95d645255d
commit 72a603ac37
11 changed files with 166 additions and 8 deletions

View File

@@ -652,6 +652,19 @@ class BlocksRepository {
throw e;
}
}
/**
* Get a list of blocks that have been indexed
*/
public async $getIndexedBlocks(): Promise<any[]> {
try {
const [rows]: any = await DB.query(`SELECT height, hash FROM blocks ORDER BY height DESC`);
return rows;
} catch (e) {
logger.err('Cannot generate block size and weight history. Reason: ' + (e instanceof Error ? e.message : e));
throw e;
}
}
}
export default new BlocksRepository();