X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=contrib%2Fchash%2Flib%2Ffunctions.php;h=c56cd6f06662bd31ca384a498aed54274918d324;hp=8401a1084772b08252b2376aa54e03cbf44bf66d;hb=2273f8f3471380e97ef9bac1cbca7598d06cb615;hpb=e470a1e08a95da8e83878b94fc322f8400ba15ec diff --git a/contrib/chash/lib/functions.php b/contrib/chash/lib/functions.php index 8401a108..c56cd6f0 100644 --- a/contrib/chash/lib/functions.php +++ b/contrib/chash/lib/functions.php @@ -80,7 +80,7 @@ function flushCheckPointFile ($hash) { // Flush data file_put_contents( - CHECK_POINT, + CHECKPOINT_FILE, $GLOBALS['total_blocks'] . '|' . $GLOBALS['total_reward'] . '|' . $GLOBALS['total_hashes'] . '|' . @@ -110,7 +110,7 @@ function addFoundHash ($hash) { $GLOBALS['total_found']++; // Add hash to array - array_push($GLOBALS['found_hashes'][$GLOBALS['total_blocks']], array( + array_push($GLOBALS['found_hashes'][$GLOBALS['total_blocks']], [ 'current_hash' => $GLOBALS['current_hash'], 'root_hash' => $GLOBALS['root_hash'], 'nonce' => (float) $GLOBALS['nonce'], @@ -119,7 +119,7 @@ function addFoundHash ($hash) { 'hash_cycles' => $GLOBALS['hash_cycles'], 'difficulty' => $GLOBALS['difficulty'], 'nonce_hash' => $hash, - )); + ]); // Found hash: print ('FOUND: hash=' . $hash . ',nonce=' . $GLOBALS['nonce'] . ',total_found=' . $GLOBALS['total_found'] . PHP_EOL); @@ -165,9 +165,9 @@ function sumHash ($hash) { */ function loadCheckpointFile () { // Is the check point there? - if (is_readable(CHECK_POINT)) { + if (is_readable(CHECKPOINT_FILE)) { // Then load it - $checkPoint = file_get_contents(CHECK_POINT); + $checkPoint = file_get_contents(CHECKPOINT_FILE); // Explode it $data = explode('|', $checkPoint); @@ -187,6 +187,6 @@ function loadCheckpointFile () { $GLOBALS['nonce'] = (float) base64_decode($data[8]); $GLOBALS['current_hash'] = $data[9]; $GLOBALS['root_hash'] = $data[9]; - $GLOBALS['found_hashes'] = json_decode(gzuncompress(base64_decode($data[11]))); + $GLOBALS['found_hashes'] = json_decode(gzuncompress(base64_decode($data[11])), TRUE); } // END - if }