[FIX] Est. next diff with 0 hashrate
This commit is contained in:
parent
fc94ec4df7
commit
6ce8a049e4
@ -53,7 +53,12 @@ class CoinBase extends Base {
|
|||||||
* Calculate next expected difficulty based on current difficulty
|
* Calculate next expected difficulty based on current difficulty
|
||||||
**/
|
**/
|
||||||
public function calcExpectedNextDifficulty($dDifficulty, $dNetworkHashrate) {
|
public function calcExpectedNextDifficulty($dDifficulty, $dNetworkHashrate) {
|
||||||
return round($dDifficulty * $this->config['cointarget'] / $this->calcNetworkExpectedTimePerBlock($dDifficulty, $dNetworkHashrate), 8);
|
$iExpectedTimePerBlock = $this->calcNetworkExpectedTimePerBlock($dDifficulty, $dNetworkHashrate);
|
||||||
|
if (!empty($iExpectedTimePerBlock) && $iExpectedTimePerBlock > 0) {
|
||||||
|
return round($dDifficulty * $this->config['cointarget'] / $iExpectedTimePerBlock, 8);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user