100 blocks
This commit is contained in:
@@ -335,13 +335,15 @@ class blockchain
|
||||
{
|
||||
$path = APP_PATH.'/blockchain/data/blocks.json';
|
||||
$jsonString = file_get_contents($path);
|
||||
self::$special_blocks = json_decode($jsonString, true);
|
||||
if ($jsonString === FALSE) die('blocks spéciaux non trouvés');
|
||||
$blocks = json_decode($jsonString, true);
|
||||
foreach($blocks as $block)
|
||||
self::$special_blocks[] = new block($block["hash"],$block["height"],$block["name"],$block["desc"]);
|
||||
}
|
||||
public static function init(){
|
||||
self::init_v2();
|
||||
}
|
||||
|
||||
|
||||
// ---
|
||||
// --- Retourne le JSON du tableau des blocs speciaux
|
||||
// ---
|
||||
@@ -387,18 +389,31 @@ class blockchain
|
||||
return self::getBlockWithHash($block_hash);
|
||||
}
|
||||
|
||||
// ----
|
||||
// ----
|
||||
public static function getSpecialBlockList()
|
||||
{
|
||||
foreach(self::$special_blocks as $block)
|
||||
{
|
||||
$the_block=self::getBlockWithHash($block->hash);
|
||||
echo $block->name.' '.$the_block->hash." ".$the_block->height." ".$the_block->n_tx.PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
// ---
|
||||
// --- Accès au dernier block en cache ...
|
||||
// ---
|
||||
public static function getLastCacheBlockHash()
|
||||
{
|
||||
// on commence par le cache d'images
|
||||
/*
|
||||
$myarray = glob(DATA_PATH.'/hasard/*.png');
|
||||
if (isset($myarray[0]))
|
||||
{
|
||||
usort( $myarray, function( $a, $b ) { return filemtime($b) - filemtime($a); } );
|
||||
return substr(basename($myarray[0],'.png'),0,strlen(self::$special_blocks[0]->hash));
|
||||
}
|
||||
*/
|
||||
|
||||
// S'il n'y a rien dans le cache d'images
|
||||
$filename=DATA_PATH.'/finished_block_list.txt';
|
||||
|
||||
Reference in New Issue
Block a user