]> git.mxchange.org Git - core.git/blobdiff - contrib/chash/chash.php
Continued with chash:
[core.git] / contrib / chash / chash.php
index ed583d9946b113fb9faf42b40e779696cfc919b4..e04f03a472c17ff65968f9b9a3a6d0d249b7a186 100644 (file)
@@ -257,10 +257,10 @@ while (true) {
                        // Next round
                        $GLOBALS['iteration']++;
                        $GLOBALS['iteration_second']++;
-                       //print ('nonce=' . $GLOBALS['nonce'] . ',iteration=' . $GLOBALS['iteration'] . PHP_EOL);
-                       //print ('nonceHash=' . $nonceHash . PHP_EOL);
-                       //print ('sumNonce=' . $sumNonce . PHP_EOL);
-                       //print ('sumGenesis=' . $GLOBALS['sum_genesis'] . PHP_EOL);
+                       //* NOISY-DEBUG: */ print('nonce=' . $GLOBALS['nonce'] . ',iteration=' . $GLOBALS['iteration'] . PHP_EOL);
+                       //* NOISY-DEBUG: */ print('nonceHash=' . $nonceHash . PHP_EOL);
+                       //* NOISY-DEBUG: */ print('sumNonce=' . $sumNonce . PHP_EOL);
+                       //* NOISY-DEBUG: */ print('sumGenesis=' . $GLOBALS['sum_genesis'] . PHP_EOL);
                } // END - while
 
                // If the iteration is zero, then no hash is found
@@ -269,7 +269,7 @@ while (true) {
                        $timeBadHashes += abs(microtime(true) - $timeHash);
 
                        // And next round
-                       print('BAD:nonce=' . $GLOBALS['nonce'] . PHP_EOL);
+                       //* NOISY-DEBUG: */ print('BAD:nonce=' . $GLOBALS['nonce'] . PHP_EOL);
 
                        // Nothing found, so calculate new nonce
                        calculateNonce();
@@ -287,7 +287,7 @@ while (true) {
        $timeBlock = abs(microtime(true) - $timeBlock);
 
        // Calculate reward
-       $reward = abs($timeBlock - $timeBadHashes) / $hashRate * $GLOBALS['hashes_block'] / max(1, $GLOBALS['block_size']) * 1000;
+       $reward = abs($timeBlock - $timeBadHashes) / max(1, $hashRate) * $GLOBALS['hashes_block'] / max(1, $GLOBALS['block_size']) * 1000;
        print('timeBlock=' . $timeBlock . ',timeBadHashes=' . $timeBadHashes . ',hashesPerBlock=' . $GLOBALS['hashes_block'] .',reward=' . $reward . PHP_EOL);
 
        // Double difficulty