Merge branch 'master' into nymkappa/bugfix/block-url-link

This commit is contained in:
wiz
2022-05-31 18:20:47 +09:00
committed by GitHub
48 changed files with 3438 additions and 3254 deletions

View File

@@ -121,6 +121,19 @@ class BlocksRepository {
}
}
/**
* Return most recent block height
*/
public async $mostRecentBlockHeight(): Promise<number> {
try {
const [row] = await DB.query('SELECT MAX(height) as maxHeight from blocks');
return row[0]['maxHeight'];
} catch (e) {
logger.err(`Cannot count blocks for this pool (using offset). Reason: ` + (e instanceof Error ? e.message : e));
throw e;
}
}
/**
* Get blocks count for a period
*/