#!/bin/bash

while IFS='' read -r line || [[ -n "$line" ]]; do

    HASH=`echo $line | awk '{print $1}'`
    HEIGHT=`echo $line | awk '{print $2}'`

    if [ ! -f $DATA_PATH/json/$HASH.zip ]; then
        cd $APPS_PATH/info
        infos=`php robot.php $HASH`
        NBTX=`echo $infos | awk '{print $3}'`

        if [ $NBTX -eq 1 ]; then
            echo draw bloc $HEIGHT
            echo LAST $HASH $HEIGHT $NTX >> $DATA_PATH/emptybot/all_empty_blocks.txt
            source $APPS_PATH/scripts/block2.sh $HASH
            rm $DATA_PATH/json/$HASH.zip
        fi
    fi

done < $1

sort -n $DATA_PATH/emptybot/all_empty_blocks.txt
