Fix until local loop, didn't match errors

This commit is contained in:
poka 2020-09-13 04:03:10 +02:00
parent c7a864a18f
commit d70bde5557
1 changed files with 8 additions and 15 deletions

View File

@ -18,8 +18,7 @@ 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=$(cat blocsUp.txt)
TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]')
TXBLOCKS=($(echo "$TXBLOCKS" | sort -hu | awk '{printf $1" "}'))
unset 'TXBLOCKS[${#TXBLOCKS[@]}-1]'
MEMBERS=($(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey'))
@ -44,21 +43,16 @@ loopWalletUp() {
local iter=0
fi
rm -f $SCRIPTPATH/debug.log
for i in ${TXBLOCKS[*]:$startBloc}; do # pour tout n° de bloc listé dans TXBLOCKS
echo "Boucle: $iter
BLoc: $i" >> $SCRIPTPATH/debug.log
sleep 0.1
sleep 0.05
local WALLETS0=$(curl -s ${DUNITER}/blockchain/block/$i)
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
until 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"
sleep 2
WALLETS0=$(curl -s ${DUNITER}/blockchain/block/$i)
done
[[ -z "$WALLETS" ]] && echo "$WALLETS est vide, on zap..." >> $SCRIPTPATH/debug.log && continue
[[ -z "$WALLETS" ]] && echo "$WALLETS est vide, on zap..." && continue
wallets+=$(echo -e "$WALLETS \n" | sed 's/ /\\n/g')
local progress=$(echo "scale=1; $i*100/$lastBloc/1" | bc)
@ -72,7 +66,6 @@ BLoc: $i" >> $SCRIPTPATH/debug.log
((iter++))
## [[ $iter -ge 25 ]] && break #kopa
echo "---" >> $SCRIPTPATH/debug.log
done
# On supprime les doublons et les lignes vides
@ -172,9 +165,9 @@ web() {
### Affichage du nombre de wallets ###
echo -e "\n ---\n"
echo "Noeud: $DUNITER"
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 "Nombre total de wallet: $nbrTotalWallets"
echo "Nombre de membres: $nbrMembers (${pourcentMbrs}%)"
echo "Nombre de simple portefeuille: $nbrSimpleWallets (${pourcentWallets}%)"
echo -e "\n ---\n"
echo "Extraction wallets membres / Simples portefeuille"
echo -e "\n ---\n"