diff --git a/g1-stats.sh b/g1-stats.sh index 4cb47ab..309e631 100755 --- a/g1-stats.sh +++ b/g1-stats.sh @@ -18,7 +18,8 @@ indexhtml="$WEBPATH/index.html" echo -e "\n############# $day à $startTime #############\n" [[ -z $(which jq) || -z $(which bc) ]] && apt update && apt install jq bc echo "Initialisation ..." -TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]') +#TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]') +TXBLOCKS=$(cat blocsUp.txt) TXBLOCKS=($(echo "$TXBLOCKS" | sort -hu | awk '{printf $1" "}')) unset 'TXBLOCKS[${#TXBLOCKS[@]}-1]' MEMBERS=($(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey')) @@ -43,16 +44,21 @@ loopWalletUp() { local iter=0 fi + rm -f $SCRIPTPATH/debug.log for i in ${TXBLOCKS[*]:$startBloc}; do # pour tout n° de bloc listé dans TXBLOCKS - sleep 0.02 + echo "Boucle: $iter +BLoc: $i" >> $SCRIPTPATH/debug.log + + sleep 0.1 local WALLETS0=$(curl -s ${DUNITER}/blockchain/block/$i) - until local WALLETS=$(echo $WALLETS0 | jq -r '.transactions[].outputs[]' 2>/dev/null | grep "SIG" | grep -Eo $REGEX_PUBKEYS); do - [[ $isWeb != "web" ]] && echo -e "iter $iter \n$WALLETS0" + until local WALLETS=$(echo $WALLETS0 | jq -r '.transactions[].outputs[]' 2>>$SCRIPTPATH/debug.log | grep "SIG" | grep -Eo $REGEX_PUBKEYS); do + #[[ $isWeb != "web" ]] && + echo -e "iter $iter \n$WALLETS0" >> $SCRIPTPATH/debug.log sleep 2 WALLETS0=$(curl -s ${DUNITER}/blockchain/block/$i) done - [[ -z "$WALLETS" ]] && continue + [[ -z "$WALLETS" ]] && echo "$WALLETS est vide, on zap..." >> $SCRIPTPATH/debug.log && continue wallets+=$(echo -e "$WALLETS \n" | sed 's/ /\\n/g') local progress=$(echo "scale=1; $i*100/$lastBloc/1" | bc) @@ -64,7 +70,9 @@ loopWalletUp() { fi ((iter++)) - ## echo $iter; [[ $iter -ge 25 ]] && break #kopa + + ## [[ $iter -ge 25 ]] && break #kopa + echo "---" >> $SCRIPTPATH/debug.log done # On supprime les doublons et les lignes vides @@ -164,9 +172,9 @@ web() { ### Affichage du nombre de wallets ### echo -e "\n ---\n" echo "Noeud: $DUNITER" -echo "Nombre total de wallet: $nbrTotalWallets" -echo "Nombre de membres: $nbrMembers (${pourcentMbrs}%)" -echo "Nombre de simple portefeuille: $nbrSimpleWallets (${pourcentWallets}%)" +echo "Nombre total de wallet: $nbrTotalWallets" >> $SCRIPTPATH/debug.log #kopa +echo "Nombre de membres: $nbrMembers (${pourcentMbrs}%)" >> $SCRIPTPATH/debug.log #kopa +echo "Nombre de simple portefeuille: $nbrSimpleWallets (${pourcentWallets}%)" >> $SCRIPTPATH/debug.log #kopa echo -e "\n ---\n" echo "Extraction wallets membres / Simples portefeuille" echo -e "\n ---\n"