[FIX] Devision by 0 on missing nethashrate

This commit is contained in:
Sebastian Grewe 2014-04-02 10:46:30 +02:00
parent 09b303fa49
commit 7a87c09056

View File

@ -47,7 +47,11 @@ class CoinBase extends Base {
* Calculate our networks expected time per block
**/
public function calcNetworkExpectedTimePerBlock($dDifficulty, $dNetworkHashrate) {
return pow(2, 32) * $dDifficulty / $dNetworkHashrate;
if ($dNetworkHashrate > 0) {
return pow(2, 32) * $dDifficulty / $dNetworkHashrate;
} else {
return 0;
}
}
/**
* Calculate next expected difficulty based on current difficulty