From 963a8f7d27f3aa7653ede59a858c98c0351c0c7f Mon Sep 17 00:00:00 2001 From: Bart S Date: Tue, 20 Feb 2018 22:57:16 +0100 Subject: [PATCH 01/14] Fix: Calculate the efficiency correctly in API --- include/pages/api/getpoolstatus.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pages/api/getpoolstatus.inc.php b/include/pages/api/getpoolstatus.inc.php index 915132e0..6312e92e 100644 --- a/include/pages/api/getpoolstatus.inc.php +++ b/include/pages/api/getpoolstatus.inc.php @@ -12,7 +12,7 @@ $aLastBlock = $block->getLast(); // Efficiency $aShares = $statistics->getRoundShares(); -$aShares['valid'] > 0 ? $dEfficiency = round((100 - (100 / $aShares['valid'] * $aShares['invalid'])), 2) : $dEfficiency = 0; +$aShares['valid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 0; // Fetch RPC data if ($bitcoin->can_connect() === true){ From a598e6ecd6704b98b7ebc6396cb31324fdee8fcc Mon Sep 17 00:00:00 2001 From: Bart S Date: Wed, 21 Feb 2018 10:08:21 +0100 Subject: [PATCH 02/14] Don't divide by zero Small change I overlooked --- include/pages/api/getpoolstatus.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pages/api/getpoolstatus.inc.php b/include/pages/api/getpoolstatus.inc.php index 6312e92e..dd48358f 100644 --- a/include/pages/api/getpoolstatus.inc.php +++ b/include/pages/api/getpoolstatus.inc.php @@ -12,7 +12,7 @@ $aLastBlock = $block->getLast(); // Efficiency $aShares = $statistics->getRoundShares(); -$aShares['valid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 0; +$aShares['invalid'] > 0 ? $dEfficiency = round((1 - ($aShares['invalid'] / ($aShares['valid'] + $aShares['invalid']))) * 100, 2) : $dEfficiency = 100; // Fetch RPC data if ($bitcoin->can_connect() === true){ From 83efd6026c829073565fcd139552dea22626ce77 Mon Sep 17 00:00:00 2001 From: Bart S Date: Wed, 21 Feb 2018 13:22:25 +0100 Subject: [PATCH 03/14] Minor changes to the block overview template Often my pool is at 101% because thats just luck, however bright red makes users often think something is wrong I'd say up to 115% make it orange, its less worrying. --- .../statistics/blocks/block_overview_time.tpl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/bootstrap/statistics/blocks/block_overview_time.tpl b/templates/bootstrap/statistics/blocks/block_overview_time.tpl index 61bae492..7fb9941b 100644 --- a/templates/bootstrap/statistics/blocks/block_overview_time.tpl +++ b/templates/bootstrap/statistics/blocks/block_overview_time.tpl @@ -42,7 +42,7 @@ {$LASTBLOCKSBYTIME.TotalShares|number_format} {if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0} - {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -68,7 +68,7 @@ {$LASTBLOCKSBYTIME.1HourShares|number_format} {if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0} - {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -94,7 +94,7 @@ {$LASTBLOCKSBYTIME.24HourShares|number_format} {if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0} - {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -120,7 +120,7 @@ {$LASTBLOCKSBYTIME.7DaysShares|number_format} {if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0} - {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -146,7 +146,7 @@ {$LASTBLOCKSBYTIME.4WeeksShares|number_format} {if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0} - {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} @@ -172,7 +172,7 @@ {$LASTBLOCKSBYTIME.12MonthShares|number_format} {if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0} - {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% + {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% {else} 0.00% {/if} From ef8f66468cbd5a589bbf1d0c89aeb0763061e1d7 Mon Sep 17 00:00:00 2001 From: Bart S Date: Wed, 21 Feb 2018 13:32:47 +0100 Subject: [PATCH 04/14] Add orange colour to blocks found Together with #83efd60 --- .../bootstrap/statistics/blocks/blocks_found_details.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 834c0fe2..1f054a86 100644 --- a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -59,7 +59,7 @@ {$BLOCKSFOUND[block].shares|number_format} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} - {$percentage|number_format:"2"} + {$percentage|number_format:"2"} {/section} @@ -70,7 +70,7 @@ {$pplnsshares|number_format} {/if} {$totalshares|number_format} - {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} + {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} From 1c53b2efb7b21c48cdcf1de8a7d765161543f281 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:27:49 +0100 Subject: [PATCH 05/14] For coins with constant difficulty change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not show in x amount of blocks, if the coin’s difficulty changes on every block --- templates/bootstrap/dashboard/round_statistics/pplns/round.tpl | 2 +- templates/bootstrap/dashboard/round_statistics/pps/round.tpl | 2 +- templates/bootstrap/dashboard/round_statistics/prop/round.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl index 234e31ce..dfa26040 100644 --- a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl index 7fc95e6c..7ed86472 100644 --- a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl @@ -130,7 +130,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl index 1fe67f59..8ea54a2e 100644 --- a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

From 85ef9d521caf53cae64bff13c8e3afd2c3313040 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:31:58 +0100 Subject: [PATCH 06/14] Expend CSRF token expiry time Change it to 15 minutes, 2 minutes is not enough. --- include/classes/csrftoken.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/classes/csrftoken.class.php b/include/classes/csrftoken.class.php index 373a1210..130b4280 100644 --- a/include/classes/csrftoken.class.php +++ b/include/classes/csrftoken.class.php @@ -16,19 +16,22 @@ class CSRFToken Extends Base { } /** - * Returns +1 min and +1 hour rollovers hashes + * Returns +1 min up to +15 min rollovers hashes * @param string $user user or IP/host address * @param string $type page name or other unique per-page identifier - * @return array 1min and 1hour hashes + * @return array 1 minute ago up to 15 minute ago hashes */ + public function checkAdditional($user, $type) { $date = date('m/d/y/H/i'); $d = explode('/', $date); - // minute may have rolled over - $seed1 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], ($d[4]-1)); - // hour may have rolled over - $seed2 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], ($d[3]-1), 59); - return array($this->getHash($seed1), $this->getHash($seed2)); + $hashes = array(); + for ($x = 1; $x < 16; $x++){ + for ($y = 4;$d[$y]-- == 0;$y--); + if ($d[4] < 0) { $d[4] = 59; } + $hashes[$x-1] = $this->getHash($this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], $d[4])); + } + return $hashes; } /** From f0f4e005a0d7563c009f931f65447c1e4dc77a15 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:32:06 +0100 Subject: [PATCH 07/14] Minor spelling correction --- cronjobs/tables_cleanup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cronjobs/tables_cleanup.php b/cronjobs/tables_cleanup.php index b47918ae..c2f42780 100755 --- a/cronjobs/tables_cleanup.php +++ b/cronjobs/tables_cleanup.php @@ -59,7 +59,7 @@ if ($oToken->cleanupTokens()) { } $log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message)); -// Clenaup shares archive +// Cleanup shares archive $start = microtime(true); $status = 'OK'; $message = ''; @@ -73,7 +73,7 @@ if ($affected === false) { } $log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message)); -// Clenaup shares archive +// Cleanup shares archive $start = microtime(true); $status = 'OK'; $message = ''; From 653729e6dc154363d88abe3c794f2ecdb2fc1c11 Mon Sep 17 00:00:00 2001 From: desaerun <34751248+desaerun@users.noreply.github.com> Date: Tue, 27 Feb 2018 23:12:45 -0700 Subject: [PATCH 08/14] add 'start' parameter to getusertransactions api page sets db start row --- include/pages/api/getusertransactions.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 62f60e19..956ca668 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,13 +8,20 @@ $api->isActive(); $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions +if (isset($_REQUEST['start'])) { + $start = $_REQUEST['start']; +} else { + // start at the beginning + $start = 0; +} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } -$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); + +$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From 1b217711a45f9c8123ef0e31531a11eec8e6e9fb Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 3 Mar 2018 16:27:10 +0100 Subject: [PATCH 09/14] Revert "add 'start' parameter to getusertransactions api page" --- include/pages/api/getusertransactions.inc.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 956ca668..62f60e19 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,20 +8,13 @@ $api->isActive(); $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions -if (isset($_REQUEST['start'])) { - $start = $_REQUEST['start']; -} else { - // start at the beginning - $start = 0; -} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } - -$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); +$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From fbdcd9c4e7a4f80ff26f372f06b22a4b031caea0 Mon Sep 17 00:00:00 2001 From: desaerun <34751248+desaerun@users.noreply.github.com> Date: Mon, 5 Mar 2018 03:24:28 -0700 Subject: [PATCH 10/14] add "start" to getusertransactions api --- include/pages/api/getusertransactions.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/pages/api/getusertransactions.inc.php b/include/pages/api/getusertransactions.inc.php index 62f60e19..956ca668 100644 --- a/include/pages/api/getusertransactions.inc.php +++ b/include/pages/api/getusertransactions.inc.php @@ -8,13 +8,20 @@ $api->isActive(); $user_id = $api->checkAccess($user->checkApiKey($_REQUEST['api_key']), @$_REQUEST['id']); // Fetch transactions +if (isset($_REQUEST['start'])) { + $start = $_REQUEST['start']; +} else { + // start at the beginning + $start = 0; +} if (isset($_REQUEST['limit']) && $_REQUEST['limit'] <= 100) { $limit = $_REQUEST['limit']; } else { // Force limit $limit = 100; } -$data['transactions'] = $transaction->getTransactions(0, NULL, $limit, $user_id); + +$data['transactions'] = $transaction->getTransactions($start, NULL, $limit, $user_id); // Fetch summary if enabled if (!$setting->getValue('disable_transactionsummary')) { From 2566b674d893b4000db683a12b459ddae475ef36 Mon Sep 17 00:00:00 2001 From: TopoX84 Date: Mon, 5 Mar 2018 08:17:39 -0600 Subject: [PATCH 11/14] Update status.tpl by adding
it will fix a display issue on the mobile version while looking at wallet status --- templates/bootstrap/admin/wallet/status.tpl | 67 +++++++++++---------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/templates/bootstrap/admin/wallet/status.tpl b/templates/bootstrap/admin/wallet/status.tpl index 87566e13..c1d2f477 100644 --- a/templates/bootstrap/admin/wallet/status.tpl +++ b/templates/bootstrap/admin/wallet/status.tpl @@ -1,32 +1,35 @@ -
-
-
- Wallet Status -
-
- - - - - - - - - - - - - - - - - - - - - -
VersionProtocol VersionWallet VersionPeersStatusBlocksAccounts
{$COININFO.version|default:""}{$COININFO.protocolversion|default:""}{$COININFO.walletversion|default:""}{$COININFO.connections|default:""}{$COININFO.errors|default:"OK"}{$COININFO.blocks|default:"0"}{$ADDRESSCOUNT}
-
-
-
-
+
+
+
+ Wallet Status +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
VersionProtocol VersionWallet VersionPeersStatusBlocksAccounts
{$COININFO.version|default:""}{$COININFO.protocolversion|default:""}{$COININFO.walletversion|default:""}{$COININFO.connections|default:""}{$COININFO.errors|default:"OK"}{$COININFO.blocks|default:"0"}{$ADDRESSCOUNT}
+
+
+
+
From 1448b93e1e279414cb5cfd8f05f95d42338c8466 Mon Sep 17 00:00:00 2001 From: TopoX84 Date: Mon, 5 Mar 2018 08:25:42 -0600 Subject: [PATCH 12/14] Update peers.tpl by adding ```
``` and some ```
``` at the end fixes a display issue on the mobile version while looking at the pees --- templates/bootstrap/admin/wallet/peers.tpl | 66 ++++++++++++---------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/templates/bootstrap/admin/wallet/peers.tpl b/templates/bootstrap/admin/wallet/peers.tpl index 50770d3f..bccd331c 100644 --- a/templates/bootstrap/admin/wallet/peers.tpl +++ b/templates/bootstrap/admin/wallet/peers.tpl @@ -1,31 +1,35 @@ -
-
-
-
- Peer Information -
-
- - - - - - - - - - - -{foreach key=KEY item=ARRAY from=$PEERINFO} - - - - - - - -{/foreach} - -
HostProtocolIdentityConnectedTraffic
{$ARRAY['addr']}{$ARRAY['version']}{$ARRAY['subver']|replace:'/':''}{$ARRAY['conntime']|date_format:$GLOBAL.config.date}{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB
-
-
+
+
+
+
+ Peer Information +
+
+
+ + + + + + + + + + + + {foreach key=KEY item=ARRAY from=$PEERINFO} + + + + + + + + {/foreach} + +
HostProtocolIdentityConnectedTraffic
{$ARRAY['addr']}{$ARRAY['version']}{$ARRAY['subver']|replace:'/':''}{$ARRAY['conntime']|date_format:$GLOBAL.config.date}{(($ARRAY['bytessent']|default:"0" + $ARRAY['bytesrecv']|default:"0") / 1024 / 1024)|number_format:"3"} MB
+
+
+
+
+
From e9c9c0878790bfab60db5a9d6cb45da17c695896 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 6 Mar 2018 08:21:43 +0100 Subject: [PATCH 13/14] [UPDATE] Trying to fix Travis failures --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 274298ef..a00c1287 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,6 +34,7 @@ before_script: - nohup php -S bone:8000 public/index.php & script: + - php vendor/bin/codecept build --env travis - php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis after_script: From 145304bb115d42799d8514bb8d0c2acdf321f83a Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 6 Mar 2018 08:25:18 +0100 Subject: [PATCH 14/14] [UPDATE] Wrong param --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a00c1287..8747dad6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ before_script: - nohup php -S bone:8000 public/index.php & script: - - php vendor/bin/codecept build --env travis + - php vendor/bin/codecept build - php vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml --env travis after_script: