Skip to content

Commit

Permalink
backend: more proper int overflow on pool_ttf #141
Browse files Browse the repository at this point in the history
related to mysql 5.7, int(11) seems no more supported
  • Loading branch information
tpruvot committed Sep 13, 2017
1 parent 9bfb531 commit ad3968f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions web/yaamp/core/backend/coins.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,13 @@ function BackendCoinsUpdate()
}

if($coin->network_hash) {
$coin->network_ttf = $coin->difficulty * 0x100000000 / $coin->network_hash;

// BTC network_hash unit may be wrong... prevent db int(11) overflow
if($coin->network_ttf > 9999999999) $coin->network_ttf = 0;
$coin->network_ttf = intval($coin->difficulty * 0x100000000 / $coin->network_hash);
if($coin->network_ttf > 2147483647) $coin->network_ttf = 2147483647;
}

if(isset($pool_rate[$coin->algo]))
$coin->pool_ttf = $coin->difficulty * 0x100000000 / $pool_rate[$coin->algo];

if ($coin->pool_ttf > 9999999999) $coin->pool_ttf = 0;
$coin->pool_ttf = intval($coin->difficulty * 0x100000000 / $pool_rate[$coin->algo]);
if($coin->pool_ttf > 2147483647) $coin->pool_ttf = 2147483647;

if(strstr($coin->image, 'http'))
{
Expand Down

0 comments on commit ad3968f

Please sign in to comment.