From 0355c8fc3e6384259345d0584b845525a9b8de21 Mon Sep 17 00:00:00 2001 From: Newbie Date: Fri, 19 Jan 2018 21:43:34 +0700 Subject: [PATCH] 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 --- lib/pool.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pool.js b/lib/pool.js index c61c911..96e8d6f 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -830,7 +830,9 @@ if (cluster.isMaster) { registerPool(); 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 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.mysql.query("UPDATE ports SET lastSeen = now(), miners = ? WHERE pool_id = ? AND network_port = ?", [minerCount[portData.port], global.config.pool_id, portData.port]); });