diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index 0c8dfeca..4ee9f644 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -25,7 +25,6 @@ chdir(dirname(__FILE__)); // Include all settings and classes require_once('shared.inc.php'); - // Fetch our last block found from the DB as a starting point $aLastBlock = @$block->getLast(); $strLastBlockHash = $aLastBlock['blockhash']; @@ -66,7 +65,8 @@ if (empty($aTransactions['transactions'])) { continue; } if (!$block->addBlock($aData) ) { - $log->logFatal('Unable to add block: ' . $aData['height'] . ': ' . $block->getCronError()); + $log->logFatal('Unable to add block: (' . $aData['height'] . ') ' . $aData['blockhash'] . ': ' . $block->getCronError()); + $monitoring->endCronjob($cron_name, 'E0081', 1, true); } } } diff --git a/public/include/config/error_codes.inc.php b/public/include/config/error_codes.inc.php index d8be9eb3..b6e720ee 100644 --- a/public/include/config/error_codes.inc.php +++ b/public/include/config/error_codes.inc.php @@ -76,4 +76,5 @@ $aErrorCodes['E0077'] = 'RPC method or connection failed'; $aErrorCodes['E0078'] = 'RPC method did not return 200 OK'; $aErrorCodes['E0079'] = 'Wallet does not cover payouts total amount'; $aErrorCodes['E0080'] = 'No new unaccounted shares since last run'; +$aErrorCodes['E0081'] = 'Failed to insert new block into database'; ?> diff --git a/public/include/pages/statistics/blocks.inc.php b/public/include/pages/statistics/blocks.inc.php index ccffdb3a..90ea8425 100644 --- a/public/include/pages/statistics/blocks.inc.php +++ b/public/include/pages/statistics/blocks.inc.php @@ -13,18 +13,21 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { } $iHeight = 0; - if (@$_REQUEST['next'] && !empty($_REQUEST['height']) && is_numeric($_REQUEST['height'])) { - $iHeight = @$roundstats->getNextBlockForStats($_REQUEST['height'], $iLimit); - if (!$iHeight) { - $iBlock = $block->getLast(); - $iHeight = $iBlock['height']; - } - } else if (@$_REQUEST['prev'] && !empty($_REQUEST['height']) && is_numeric($_REQUEST['height'])) { - $iHeight = $_REQUEST['height']; + if (@$_REQUEST['next'] && !empty($_REQUEST['height'])) { + $iHeight = @$roundstats->getNextBlock($_REQUEST['height']); + if (!$iHeight) { + $iBlock = $block->getLast(); + $iHeight = $iBlock['height']; + } + } else if (@$_REQUEST['prev'] && !empty($_REQUEST['height'])) { + $iHeight = $roundstats->getPreviousBlock($_REQUEST['height']); } else if (empty($_REQUEST['height'])) { - $aBlock = $block->getLast(); - $iHeight = $aBlock['height']; + $iBlock = $block->getLast(); + $iHeight = $iBlock['height']; + } else { + $iHeight = $_REQUEST['height']; } + $_REQUEST['height'] = $iHeight; $test = false; if (@$_REQUEST['test'] && $user->isAdmin($_SESSION['USERDATA']['id'])) { @@ -48,8 +51,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { } } } else if ($config['payout_system'] == 'prop' || $config['payout_system'] == 'pps') { - if ($setting->getValue('statistics_show_block_average') && !$test) { - foreach($aBlocksFoundData as $key => $aData) { + if ($setting->getValue('statistics_show_block_average') && !$test) { + foreach($aBlocksFoundData as $key => $aData) { $aBlocksFoundData[$key]['block_avg'] = round($block->getAvgBlockShares($aData['height'], $config['pplns']['blockavg']['blockcount'])); $use_average = true; } diff --git a/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl b/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl index 611b859a..9c768fb4 100644 --- a/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl +++ b/public/templates/bootstrap/statistics/blocks/block_shares_graph.tpl @@ -44,6 +44,8 @@ $(function () {
+ +
diff --git a/public/templates/mpos/statistics/pool/general_stats.tpl b/public/templates/mpos/statistics/pool/general_stats.tpl index 7506f013..4ac58bb6 100644 --- a/public/templates/mpos/statistics/pool/general_stats.tpl +++ b/public/templates/mpos/statistics/pool/general_stats.tpl @@ -8,15 +8,15 @@ {$GLOBAL.hashrate|number_format:"3"} {$GLOBAL.hashunits.pool} - Pool Efficiency + Pool Efficiency {if $GLOBAL.roundshares.valid > 0}{($GLOBAL.roundshares.valid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%{else}0%{/if} - Current Active Workers + Current Active Workers {$GLOBAL.workers} - Current Difficulty + Current Difficulty {if ! $GLOBAL.website.chaininfo.disabled} {$NETWORK.difficulty} {else} @@ -24,7 +24,7 @@ {/if} - Est. Next Difficulty + Est. Next Difficulty {if ! $GLOBAL.website.chaininfo.disabled} {$NETWORK.EstNextDifficulty} (Change in {$NETWORK.BlocksUntilDiffChange} Blocks) {else} @@ -32,34 +32,34 @@ {/if} - Est. Avg. Time per Round (Network) + Est. Avg. Time per Round (Network) {$NETWORK.EstTimePerBlock|seconds_to_words} - Est. Avg. Time per Round (Pool) + Est. Avg. Time per Round (Pool) {$ESTTIME|seconds_to_words} - Est. Shares this Round + Est. Shares this Round {$ESTIMATES.shares} (done: {$ESTIMATES.percent}%) {if ! $GLOBAL.website.blockexplorer.disabled} - Next Network Block + Next Network Block {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) {else} - Next Network Block + Next Network Block {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) {/if} - Last Block Found + Last Block Found {$LASTBLOCK|default:"0"} - Time Since Last Block + Time Since Last Block {$TIMESINCELAST|seconds_to_words}