Skip to content

Commit

Permalink
Only count block on the main chain
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Apr 20, 2018
1 parent 53b0d0e commit fb6dfa5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ class Helper {
* @returns {Promise.<number>}
*/
static async getTotalBlocksMined(connectionPool) {
const [rows, fields] = await connectionPool.execute("SELECT COUNT(DISTINCT block) AS blockcount FROM payin");
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;
}
}
Expand Down

0 comments on commit fb6dfa5

Please sign in to comment.