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
This commit is contained in:
Sebastian Grewe 2013-07-18 09:43:16 +02:00
parent 4a6397823c
commit 73ec707381
3 changed files with 15 additions and 6 deletions

View File

@ -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

View File

@ -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 {

View File

@ -22,7 +22,7 @@
{if $GLOBAL.blockexplorer}
<tr>
<td class="leftheader">Next Network Block</td>
<td><a href="{$GLOBAL.blockexplorer}{$CURRENTBLOCK + 1}" target="_new">{$CURRENTBLOCK + 1}</a> &nbsp;&nbsp;<font size="1"> (Current: <a href="{$GLOBAL.blockexplorer}{$CURRENTBLOCK}" target="_new">{$CURRENTBLOCK})</a></font></td>
<td>{$CURRENTBLOCK + 1} &nbsp;&nbsp;<font size="1"> (Current: <a href="{$GLOBAL.blockexplorer}{$CURRENTBLOCKHASH}" target="_new">{$CURRENTBLOCK})</a></font></td>
</tr>
{else}
<tr>
@ -32,7 +32,7 @@
{/if}
<tr>
<td class="leftheader">Last Block Found</td>
<td>{if $GLOBAL.blockexplorer}<a href="{$GLOBAL.blockexplorer}{$LASTBLOCK}" target="_new">{$LASTBLOCK|default:"0"}</a>{else}{$LASTBLOCK|default:"0"}{/if}</td>
<td>{if $GLOBAL.blockexplorer}<a href="{$GLOBAL.blockexplorer}{$LASTBLOCKHASH}" target="_new">{$LASTBLOCK|default:"0"}</a>{else}{$LASTBLOCK|default:"0"}{/if}</td>
</tr>
<tr>
<td class="leftheader">Current Difficulty</td>