Update findblock.php

Try-Catch any exception thrown from `getblockhash` for safety.
This commit is contained in:
Kyle Tse 2017-09-29 05:50:48 +08:00 committed by GitHub
parent 15c7c02268
commit 94d67b3013

View File

@ -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