From 94d67b30135f6fd2c6541081391f6408be36dae5 Mon Sep 17 00:00:00 2001 From: Kyle Tse Date: Fri, 29 Sep 2017 05:50:48 +0800 Subject: [PATCH] Update findblock.php Try-Catch any exception thrown from `getblockhash` for safety. --- cronjobs/findblock.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index bf700511..43e8e48a 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -29,7 +29,11 @@ require_once('shared.inc.php'); $aLastBlock = @$block->getLastValid(); $strLastBlockHash = $aLastBlock['blockhash']; if (!$strLastBlockHash) { - $strLastBlockHash = $bitcoin->getblockhash(1); + try { + $strLastBlockHash = $bitcoin->getblockhash(1); + } catch (Exception $e) { + $strLastBlockHash = ""; + } } // Fetch all transactions since our last block