From 73ec70738186cf7b1e0ef62972a408b8785ceb72 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 18 Jul 2013 09:43:16 +0200 Subject: [PATCH 1/3] Adds blockhash to blockexplorer URL * Changed blockexplorer URL to use Blockhash instead of height * Added calls to find current networks blocks blockhash * Propagated changes onto temmplate * Added new dist configuration for new blockexplorer URL Fixes #446 --- public/include/config/global.inc.dist.php | 7 ++++--- public/include/pages/statistics/pool.inc.php | 10 +++++++++- .../templates/mmcFE/statistics/pool/authenticated.tpl | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/public/include/config/global.inc.dist.php b/public/include/config/global.inc.dist.php index e66197fe..22fe69cd 100644 --- a/public/include/config/global.inc.dist.php +++ b/public/include/config/global.inc.dist.php @@ -243,9 +243,10 @@ $config['payout_system'] = 'prop'; $config['archive']['maxrounds'] = 10; $config['archive']['maxage'] = 60 * 24; -// URL prefix for block searches, used for block links, default: `http://explorer.litecoin.net/search?q=` -// If empty, the block link to the block information page will be removed -$config['blockexplorer'] = 'http://explorer.litecoin.net/search?q='; +// URL prefix for block searches, used for block links, default: `http://explorer.litecoin.net/block/` +// The Blockhash is appended on the templates to this URL +// If this config is empty, the block link to the block information page will be removed +$config['blockexplorer'] = 'http://explorer.litecoin.net/block/'; // Link to blockchain information, used for difficulty link, default: `http://allchains.info` // If empty, the difficulty link to the chain information will be removed diff --git a/public/include/pages/statistics/pool.inc.php b/public/include/pages/statistics/pool.inc.php index 256d4edf..9aafadcf 100644 --- a/public/include/pages/statistics/pool.inc.php +++ b/public/include/pages/statistics/pool.inc.php @@ -11,6 +11,8 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { if (is_array($dDifficulty) && array_key_exists('proof-of-work', $dDifficulty)) $dDifficulty = $dDifficulty['proof-of-work']; $iBlock = $bitcoin->getblockcount(); + $sBlockHash = $bitcoin->query('getblockhash', $iBlock); + var_dump($sBlockHash); } else { $dDifficulty = 1; $iBlock = 0; @@ -51,7 +53,13 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $smarty->assign("CONTRIBSHARES", $aContributorsShares); $smarty->assign("CONTRIBHASHES", $aContributorsHashes); $smarty->assign("CURRENTBLOCK", $iBlock); - count($aBlockData) > 0 ? $smarty->assign("LASTBLOCK", $aBlockData['height']) : $smarty->assign("LASTBLOCK", 0); + $smarty->assign("CURRENTBLOCKHASH", $sBlockHash); + if (count($aBlockData) > 0) { + $smarty->assign("LASTBLOCK", $aBlockData['height']); + $smarty->assign("LASTBLOCKHASH", $aBlockData['blockhash']); + } else { + $smarty->assign("LASTBLOCK", 0); + } $smarty->assign("DIFFICULTY", $dDifficulty); $smarty->assign("REWARD", $config['reward']); } else { diff --git a/public/templates/mmcFE/statistics/pool/authenticated.tpl b/public/templates/mmcFE/statistics/pool/authenticated.tpl index 9e41b6d3..7834b9b5 100644 --- a/public/templates/mmcFE/statistics/pool/authenticated.tpl +++ b/public/templates/mmcFE/statistics/pool/authenticated.tpl @@ -22,7 +22,7 @@ {if $GLOBAL.blockexplorer} Next Network Block - {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) + {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) {else} @@ -32,7 +32,7 @@ {/if} Last Block Found - {if $GLOBAL.blockexplorer}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if} + {if $GLOBAL.blockexplorer}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if} Current Difficulty From 6d379e8e58bccc199c78042a1c21aa1ad653c231 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 18 Jul 2013 09:45:20 +0200 Subject: [PATCH 2/3] Removing debug output --- public/include/pages/statistics/pool.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/public/include/pages/statistics/pool.inc.php b/public/include/pages/statistics/pool.inc.php index 9aafadcf..b8872293 100644 --- a/public/include/pages/statistics/pool.inc.php +++ b/public/include/pages/statistics/pool.inc.php @@ -12,7 +12,6 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $dDifficulty = $dDifficulty['proof-of-work']; $iBlock = $bitcoin->getblockcount(); $sBlockHash = $bitcoin->query('getblockhash', $iBlock); - var_dump($sBlockHash); } else { $dDifficulty = 1; $iBlock = 0; From a655abddbf378761cdcbd97b9c4feb21efe85874 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 18 Jul 2013 11:05:09 +0200 Subject: [PATCH 3/3] fixing mobile template --- public/templates/mobile/statistics/pool/authenticated.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/mobile/statistics/pool/authenticated.tpl b/public/templates/mobile/statistics/pool/authenticated.tpl index 0889347c..a7025779 100644 --- a/public/templates/mobile/statistics/pool/authenticated.tpl +++ b/public/templates/mobile/statistics/pool/authenticated.tpl @@ -27,7 +27,7 @@ {if $GLOBAL.blockexplorer} Next Network Block - {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) + {$CURRENTBLOCK + 1}    (Current: {$CURRENTBLOCK}) {else} @@ -37,7 +37,7 @@ {/if} Last Block Found - {if $GLOBAL.blockexplorer}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if} + {if $GLOBAL.blockexplorer}{$LASTBLOCK|default:"0"}{else}{$LASTBLOCK|default:"0"}{/if} {if $GLOBAL.chaininfo}