Skip to content

Commit 94d67b3

Browse files
authored
Update findblock.php
Try-Catch any exception thrown from `getblockhash` for safety.
1 parent 15c7c02 commit 94d67b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cronjobs/findblock.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@
2929
$aLastBlock = @$block->getLastValid();
3030
$strLastBlockHash = $aLastBlock['blockhash'];
3131
if (!$strLastBlockHash) {
32-
$strLastBlockHash = $bitcoin->getblockhash(1);
32+
try {
33+
$strLastBlockHash = $bitcoin->getblockhash(1);
34+
} catch (Exception $e) {
35+
$strLastBlockHash = "";
36+
}
3337
}
3438

3539
// Fetch all transactions since our last block

0 commit comments

Comments
 (0)