Fixed loading of chash.pos (wrong indexes) + added cast to float for nonce.
authorRoland Haeder <roland@mxchange.org>
Fri, 13 Mar 2015 03:10:55 +0000 (04:10 +0100)
committerRoland Haeder <roland@mxchange.org>
Fri, 13 Mar 2015 03:10:55 +0000 (04:10 +0100)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
contrib/chash/chash.php

index acba7c9..408b466 100644 (file)
@@ -218,7 +218,7 @@ function flushCheckPointFile ($hash) {
                $GLOBALS['total_found'] . ':' .
                $GLOBALS['total_restarts'] . ':' .
                $GLOBALS['hash_cycles'] . ':' .
-               base64_encode($GLOBALS['nonce']) . ':' .
+               base64_encode((float) $GLOBALS['nonce']) . ':' .
                $hash . ':' .
                $GLOBALS['root_hash'] . ':' .
                base64_encode(gzcompress(serialize($GLOBALS['found_hashes'])))
@@ -243,7 +243,7 @@ function addFoundHash ($hash) {
                'modula_hash'  => $GLOBALS['modula_hash'],
                'genesis_hash' => $GLOBALS['genesis_hash'],
                'root_hash'    => $GLOBALS['root_hash'],
-               'nonce'        => $GLOBALS['nonce'],
+               'nonce'        => (float) $GLOBALS['nonce'],
                'iter'         => $GLOBALS['iteration'],
                'hashes_block' => $GLOBALS['hashes_block'],
                'hash_cycles'  => $GLOBALS['hash_cycles'],
@@ -364,12 +364,12 @@ if (is_readable(CHECK_POINT)) {
        $GLOBALS['total_found']    = $data[3];
        $GLOBALS['total_restarts'] = $data[4];
        $GLOBALS['hash_cycles']    = intval($data[5]);
-       $GLOBALS['nonce']          = base64_decode($data[7]);
+       $GLOBALS['nonce']          = (float) base64_decode($data[6]);
        $GLOBALS['root_hash']      = $data[8];
        $GLOBALS['found_hashes']   = unserialize(gzuncompress(base64_decode($data[9])));
 
        // Set modula hash
-       setModulaHash($data[6]);
+       setModulaHash($data[7]);
 } else {
        // Create nonce (small)
        initNonce();