backend: more proper int overflow on pool_ttf #141

related to mysql 5.7, int(11) seems no more supported
This commit is contained in:
Tanguy Pruvot 2017-09-13 07:08:56 +02:00
parent 9bfb531d03
commit ad3968fa69

View file

@ -283,16 +283,13 @@ function BackendCoinsUpdate()
} }
if($coin->network_hash) { if($coin->network_hash) {
$coin->network_ttf = $coin->difficulty * 0x100000000 / $coin->network_hash; $coin->network_ttf = intval($coin->difficulty * 0x100000000 / $coin->network_hash);
if($coin->network_ttf > 2147483647) $coin->network_ttf = 2147483647;
// BTC network_hash unit may be wrong... prevent db int(11) overflow
if($coin->network_ttf > 9999999999) $coin->network_ttf = 0;
} }
if(isset($pool_rate[$coin->algo])) if(isset($pool_rate[$coin->algo]))
$coin->pool_ttf = $coin->difficulty * 0x100000000 / $pool_rate[$coin->algo]; $coin->pool_ttf = intval($coin->difficulty * 0x100000000 / $pool_rate[$coin->algo]);
if($coin->pool_ttf > 2147483647) $coin->pool_ttf = 2147483647;
if ($coin->pool_ttf > 9999999999) $coin->pool_ttf = 0;
if(strstr($coin->image, 'http')) if(strstr($coin->image, 'http'))
{ {