diff --git a/src/Helper.js b/src/Helper.js index 5e25d29..d4130dc 100644 --- a/src/Helper.js +++ b/src/Helper.js @@ -90,6 +90,19 @@ class Helper { return -1; } } + + /** + * @returns {Promise.} + */ + static async getTotalBlocksMined(connectionPool) { + const query = ` + SELECT COUNT(DISTINCT payin.block) AS blockcount FROM payin + INNER JOIN block ON block.id = payin.block + WHERE block.main_chain = 1 + `; + const [rows, fields] = await connectionPool.execute(query); + return rows[0].blockcount; + } } module.exports = exports = Helper;