From 6ce8a049e4223b92393354fef542cac0d16e7b2a Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 31 Mar 2014 15:49:38 +0200 Subject: [PATCH] [FIX] Est. next diff with 0 hashrate --- public/include/classes/coins/coin_base.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/include/classes/coins/coin_base.class.php b/public/include/classes/coins/coin_base.class.php index 1eb5470c..ae726321 100644 --- a/public/include/classes/coins/coin_base.class.php +++ b/public/include/classes/coins/coin_base.class.php @@ -53,7 +53,12 @@ class CoinBase extends Base { * Calculate next expected difficulty based on current difficulty **/ 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; + } } }