100 blocks
This commit is contained in:
+14
-23
@@ -14,34 +14,25 @@ require_once '../global/inc/config.php';
|
||||
// ---
|
||||
require_once 'inc/block.php';
|
||||
|
||||
// ---
|
||||
// --- Par défaut on cherche le dernier block
|
||||
// ---
|
||||
$block_hash = 'LAST';
|
||||
|
||||
// ---
|
||||
// --- Le cas échéant, on cherche block passé en argument
|
||||
// ---
|
||||
if (isset($argv[1])) $block_hash = $argv[1];
|
||||
|
||||
// ---
|
||||
// --- On interroge la blockchain
|
||||
// --- => Ce qui a pour effet de placer le block dans le cache
|
||||
// ---
|
||||
$the_block = blockchain::getSpecialBlock($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
echo $block_hash.' '.$the_block->hash." ".$the_block->height." ".$the_block->n_tx.PHP_EOL;
|
||||
blockchain::getSpecialBlocklist();
|
||||
|
||||
if ($block_hash == 'LAST')
|
||||
$the_block = blockchain::getBlockWithHash(blockchain::getLastBlockHash());
|
||||
if ($the_block === FALSE) die();
|
||||
echo 'LAST '.$the_block->hash." ".$the_block->height." ".$the_block->n_tx.PHP_EOL;
|
||||
|
||||
exit(0);
|
||||
|
||||
// On a demandé le dernier block
|
||||
// On remonte sur les huits derniers pour accélerer les prochaines navigations
|
||||
for($max=0;($max<8)&&(!file_exists(DATA_PATH.'/json/'.$the_block->prev_block.'.zip'));$max++)
|
||||
{
|
||||
// On a demandé le dernier block
|
||||
// On remonte sur les huits derniers pour accélerer les prochaines navigations
|
||||
for($max=0;($max<8)&&(!file_exists(DATA_PATH.'/json/'.$the_block->prev_block.'.zip'));$max++)
|
||||
{
|
||||
$block_hash = $the_block->prev_block;
|
||||
$the_block = blockchain::getBlockWithHash($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
echo 'CACHE '.$the_block->hash." ".$the_block->height." ".$the_block->n_tx.PHP_EOL;
|
||||
}
|
||||
$block_hash = $the_block->prev_block;
|
||||
$the_block = blockchain::getBlockWithHash($block_hash);
|
||||
if ($the_block === FALSE) die();
|
||||
echo 'CACHE '.$the_block->hash." ".$the_block->height." ".$the_block->n_tx.PHP_EOL;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user