block list en JSON

This commit is contained in:
2023-12-30 18:15:28 +01:00
parent 0bef7e1532
commit 06e604f268
3 changed files with 277 additions and 3 deletions
+13 -3
View File
@@ -74,7 +74,7 @@ class blockchain
//
// Init special blocks array ...
//
public static function init()
public static function init_v1()
{
self::$special_blocks = array ();
@@ -272,8 +272,8 @@ class blockchain
);
self::$special_blocks[] = new block(
'00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
57035,
'00000000152340ca42227603908689183edc47355204e7aca59383b0aaac1fd8',
57043,
'PIZZA'
);
@@ -331,6 +331,16 @@ class blockchain
'GENESIS'
);
}
public static function init_v2()
{
$path = APP_PATH.'/blockchain/data/blocks.json';
$jsonString = file_get_contents($path);
self::$special_blocks = json_decode($jsonString, true);
}
public static function init(){
self::init_v2();
}
// ---
// --- Retourne le JSON du tableau des blocs speciaux