From 15c7c02268ae84ed73ec233588b5973dc7c67ff7 Mon Sep 17 00:00:00 2001 From: Kyle Tse Date: Fri, 29 Sep 2017 05:01:20 +0800 Subject: [PATCH 1/2] Update findblock.php Fixed Invalid Blockhash for listsinceblock. --- cronjobs/findblock.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index eb848180..bf700511 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -28,7 +28,9 @@ require_once('shared.inc.php'); // Fetch our last block found from the DB as a starting point $aLastBlock = @$block->getLastValid(); $strLastBlockHash = $aLastBlock['blockhash']; -if (!$strLastBlockHash) $strLastBlockHash = ''; +if (!$strLastBlockHash) { + $strLastBlockHash = $bitcoin->getblockhash(1); +} // Fetch all transactions since our last block if ( $bitcoin->can_connect() === true ){ From 94d67b30135f6fd2c6541081391f6408be36dae5 Mon Sep 17 00:00:00 2001 From: Kyle Tse Date: Fri, 29 Sep 2017 05:50:48 +0800 Subject: [PATCH 2/2] 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