TypeError: Cannot read property 'height' of undefined

I think the Interval could be called too soon and there isn't activeBlockTemplate yet. If I'm not right, you can cancel this PR.
https://github.com/Snipa22/nodejs-pool/issues/269
https://github.com/Snipa22/nodejs-pool/issues/150
This commit is contained in:
Newbie
2018-01-19 21:43:34 +07:00
committed by GitHub
parent ffc6b3dfe6
commit 0355c8fc3e
+3 -1
View File
@@ -830,7 +830,9 @@ if (cluster.isMaster) {
registerPool(); registerPool();
setInterval(function () { setInterval(function () {
global.mysql.query("UPDATE pools SET last_checkin = ?, active = ? WHERE id = ?", [global.support.formatDate(Date.now()), true, global.config.pool_id]); global.mysql.query("UPDATE pools SET last_checkin = ?, active = ? WHERE id = ?", [global.support.formatDate(Date.now()), true, global.config.pool_id]);
global.mysql.query("UPDATE pools SET blockIDTime = now(), blockID = ? where id = ?", [activeBlockTemplate.height, global.config.pool_id]); if (activeBlockTemplate) {
global.mysql.query("UPDATE pools SET blockIDTime = now(), blockID = ? where id = ?", [activeBlockTemplate.height, global.config.pool_id]);
}
global.config.ports.forEach(function (portData) { global.config.ports.forEach(function (portData) {
global.mysql.query("UPDATE ports SET lastSeen = now(), miners = ? WHERE pool_id = ? AND network_port = ?", [minerCount[portData.port], global.config.pool_id, portData.port]); global.mysql.query("UPDATE ports SET lastSeen = now(), miners = ? WHERE pool_id = ? AND network_port = ?", [minerCount[portData.port], global.config.pool_id, portData.port]);
}); });