Sfoglia il codice sorgente

hashes tient compte du cache

master
MEUNIER Thibaud 7 anni fa
parent
commit
3c7acc8443
12 ha cambiato i file con 53 aggiunte e 42 eliminazioni
  1. +3
    -5
      blockchain/cache.php
  2. +3
    -2
      blockchain/inc/block.php
  3. +9
    -1
      blockchain/robot.sh
  4. +1
    -1
      global/inc/config.php
  5. +9
    -15
      methode/hashes/robot.sh
  6. +1
    -0
      methode2/circle/draw.php
  7. +1
    -0
      methode2/circle_line/draw.php
  8. +6
    -5
      methode2/circles/draw.php
  9. +15
    -9
      scripts/blocks2.sh
  10. +1
    -1
      scripts/tweet.sh
  11. +1
    -1
      twitter/twitterbot/robot.php
  12. +3
    -2
      twitter/twitterbot/robot.sh

+ 3
- 5
blockchain/cache.php Vedi File

@ -27,23 +27,21 @@ $the_block = blockchain::getSpecialBlock($block_hash);
if ($the_block === FALSE) die();
// ---
// --- On en recherche 3 sur approximativement 6 heures (36 blocks)
// --- On en recherche 6 sur approximativement 6 heures (36 blocks)
// ---
$max = 3;
$max = 6;
$max2 = 36;
while(($max > 0)&&($max2 > 0))
{
$block_hash = $the_block->prev_block;
if (!file_exists(DATA_PATH.'/json/'.$block_hash.'.zip'))
{
$max--;
echo 'CACHE '.$block_hash.' '.($the_block->height-1)." ".$the_block->n_tx.PHP_EOL;
}
$the_block = blockchain::getBlockWithHash($block_hash);
if ($the_block === FALSE) die();
$max--;
$max2--;
}

+ 3
- 2
blockchain/inc/block.php Vedi File

@ -27,14 +27,15 @@ class blockchain
'TOPISTO' => '000000000a73e64735a2b75c97ea674950a9018da1420d01328a918c9ff9852c',
'PIZZA' => '00000000006de085dadb3ec413ef074022fe781121b467e98960280dd246bb00',
'HALVING_1' => '000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e',
'WHALE201311' => '0000000000000001bc7156dd1183c87859b326affa3a5cdd157e809537f0b284',
'HALVING_2' => '000000000000000002cce816c0ab2c5c269cb081896b7dcb34b8422d6b74ffa1',
'BIP_91_LOCK' => '0000000000000000015411ca4b35f7b48ecab015b14de5627b647e262ba0ec40',
'BCC' => '00000000000000000019f112ec0a9982926f1258cdcc558dd7c3b7e5dc7fa148',
'SEGWIT_LOCK' => '0000000000000000012e6060980c6475a9a8e62a1bf44b76c5d51f707d54522c',
'SEGWIT' => '000000000000000000cbeff0b533f8e1189cf09dfbebf57a8ebe349362811b80',
'HURRICANE_1' => '0000000000000000000fe6d521a187a5523d5cef6f6c178923ff82ffe5a0f372',
'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d',
'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a'
'BLOCK21E800' => '00000000000000000021e800c1e8df51b22c1588e5a624bea17e9faa34b2dc4a',
'WHALE201810' => '0000000000000000000f9f2dadfb8f312572183272802cbfcc4ff95b4ee6777d'
);
// ---

+ 9
- 1
blockchain/robot.sh Vedi File

@ -15,9 +15,17 @@ rm -f $DATA_PATH/block_list.txt
php cache.php >> $DATA_PATH/block_list.txt
for BLOCK in GENESIS THE_ANSWER LUCIFER LEET TOPISTO PIZZA HALVING_1 HALVING_2 BIP_91_LOCK BCC SEGWIT_LOCK SEGWIT HURRICANE_1 WHALE201810 BLOCK21E800 LAST
LISTBLOCKS="GENESIS THE_ANSWER LUCIFER LEET \
TOPISTO PIZZA HALVING_1 WHALE201311 HALVING_2 \
BIP_91_LOCK BCC SEGWIT_LOCK SEGWIT \
HURRICANE_1 WHALE201810 BLOCK21E800 \
LAST"
for BLOCK in $LISTBLOCKS
do
php robot.php $BLOCK >> $DATA_PATH/block_list.txt
done
cat $DATA_PATH/block_list.txt
rm -f $flag

+ 1
- 1
global/inc/config.php Vedi File

@ -15,7 +15,7 @@ define('RESS_PATH', TOPISTO_PATH.'/ressources');
define('TMP_PATH', TOPISTO_PATH.'/tmp');
define('DATA_PATH', TOPISTO_PATH.'/data');
define('BIG_PATH', TOPISTO_PATH.'/big');
define('BIG_PATH', TOPISTO_PATH.'/big');
define('SOLD_PATH', TOPISTO_PATH.'/sold');
define('OFFLINE_PATH', RESS_PATH.'/offline');

+ 9
- 15
methode/hashes/robot.sh Vedi File

@ -11,24 +11,18 @@ fi
touch $flag
cd $APPS_PATH/methode/$METHODE
for BLOCK in `grep LAST $DATA_PATH/block_list.txt | awk '{print $2}'`
for TYPE in CACHE LAST
do
if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ]
then
for BLOCK in `grep $TYPE $DATA_PATH/block_list.txt | awk '{print $2}'`
do
BLOCK_HEIGHT=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $3}'`
php robot.php $BLOCK $((RANDOM % 6))
echo $BLOCK_HEIGHT $BLOCK >> $DATA_PATH/hashes2hashes/liste.txt
fi
BNAME=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $1}'`
if [ "$BNAME" == "LAST" ]
then
touch $DATA_PATH/$METHODE/$BLOCK.png
else
touch -t $date $DATA_PATH/$METHODE/$BLOCK.png
fi
BNAME=`grep $BLOCK $DATA_PATH/block_list.txt | awk '{print $1}'`
if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ]
then
php robot.php $BLOCK $((RANDOM % 6))
fi
done
done
rm -f $flag

+ 1
- 0
methode2/circle/draw.php Vedi File

@ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres)
$marge_x = 10;
$marge_y = 10;
$facteur_max = 2.5;
$alpha = 0;
// Détermine si on dessine les tx, les fees ou la récompense
if (isset($parametres['type'])) $type = $parametres['type'];

+ 1
- 0
methode2/circle_line/draw.php Vedi File

@ -14,6 +14,7 @@ function DrawBlock($the_block, $vImage, $parametres)
$marge_x = 10;
$marge_y = 10;
$facteur_max = 2.5;
$alpha = 0;
// Détermine si on dessine les tx, les fees ou la récompense
if (isset($parametres['type'])) $type = $parametres['type'];

+ 6
- 5
methode2/circles/draw.php Vedi File

@ -8,12 +8,13 @@ function DrawBlock($the_block, $vImage, $parametres)
// Ces variables vont permettre de caler les lignes
// dans la zone de dessin en se laissant des marges
// en haut et en bas
$somme = 0;
$min =-1;
$max = 0;
$marge_x = 10;
$marge_y = 10;
$somme = 0;
$min =-1;
$max = 0;
$marge_x = 10;
$marge_y = 10;
$facteur_max = 2.5;
$alpha = 0;
// Détermine si on dessine les tx, les fees ou la récompense
if (isset($parametres['type'])) $type = $parametres['type'];

+ 15
- 9
scripts/blocks2.sh Vedi File

@ -1,5 +1,5 @@
#!/bin/bash
lescript=`basename $0 .sh`
lescript=blocks2
#
# TOOLS
@ -39,6 +39,8 @@ then
fi
while IFS='' read -r line || [[ -n "$line" ]]; do
NAME=`echo $line | awk '{print $1}'`
BLOCK=`echo $line | awk '{print $2}'`
HEIGHT=`echo $line | awk '{print $3}'`
NBTX=`echo $line | awk '{print $4}'`
@ -57,9 +59,8 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
#
# CHOISIR UNE METHODE2 AU HASARD
#
for METHODE in `ls $APPS_PATH/methode2 | grep -v robot | shuf`
for METHODE in `ls $APPS_PATH/methode2 | grep -v robot | shuf | head -n 1`
do
echo $METHODE
if [ ! -d $DATA_PATH/$METHODE ]
then
mkdir -p $DATA_PATH/$METHODE
@ -69,14 +70,19 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
then
cd $APPS_PATH/methode2
php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2
if [ "$2" == "" ];
then
rm -f $DATA_PATH/hasard/$BLOCK.png
ln $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png
ln $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png
fi
cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png
fi
done
if [ ! -f $DATA_PATH/hasard/$BLOCK.png ]
then
cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png
fi
touch $DATA_PATH/hasard/$BLOCK.png
rm -f $flag
done < $DATA_PATH/block_list.txt
#

+ 1
- 1
scripts/tweet.sh Vedi File

@ -56,7 +56,7 @@ fi
#
# TWEET
#
TWEET=30
TWEET=8
if [ $((MINUTE % $TWEET)) -eq 0 ]
then
debug "send a TWEET"

+ 1
- 1
twitter/twitterbot/robot.php Vedi File

@ -69,7 +69,7 @@ if (file_exists($image_file))
// ---
// --- Tweet
// ---
$tweet = "#bitcoin #blockchain 's".PHP_EOL;
$tweet = "#computerart : #bitcoin #blockchain 's".PHP_EOL;
$tweet .= $argv[2]." Block, Height : ".$the_block->height.PHP_EOL;
$tweet .= "[ See more on www.topisto.net ]";
$success = twitter::tweet($tweet, $image_file);

+ 3
- 2
twitter/twitterbot/robot.sh Vedi File

@ -21,8 +21,9 @@ do
then
php robot.php $BLOCK CONFIRMED hashes2hashes
touch $DATA_PATH/twitterbot/assemblage_$BLOCK
rm -f $flag
exit 0
#rm -f $flag
#exit 0
sleep 30
fi
done

Caricamento…
Annulla
Salva