From c444c3035ebab6d5e1124bd9261dd1074221b90e Mon Sep 17 00:00:00 2001 From: poka Date: Sun, 13 Sep 2020 19:16:32 +0200 Subject: [PATCH] fix bad walletUp loop --- g1-stats.sh | 12 +++++------- tpl/recus.json | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/g1-stats.sh b/g1-stats.sh index 7760ac8..05778ca 100755 --- a/g1-stats.sh +++ b/g1-stats.sh @@ -22,8 +22,6 @@ echo "Initialisation ..." outFile="/tmp/g1-stats-$day-$startTime_$id" TXBLOCKS=$(cat $SCRIPTPATH/db/txblocs) #TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]') -#TXBLOCKS+=$(curl -s ${DUNITER2}/blockchain/with/tx | jq '.result.blocks[]') -#TXBLOCKS+=$(curl -s ${DUNITER3}/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') @@ -36,16 +34,16 @@ isWeb=$1 echo "[" > $SCRIPTPATH/db/recus.json loopWalletUp() { for i in ${TXBLOCKS[*]}; do - [[ -z ${TXBLOCKS[$i]} ]] && break - sleep 0.1 - WALLETS0=$(curl -s ${DUNITER}/blockchain/block/${TXBLOCKS[$i]}) + [[ -z $i ]] && break + sleep 0.05 + WALLETS0=$(curl -s ${DUNITER}/blockchain/block/$i) until WALLETS=$(echo $WALLETS0 | jq -r '.medianTime,(.transactions[] | select(.issuers[0] as $issuers | .outputs[0]|contains($issuers)|not) | .outputs[0])' 2>/dev/null); do [[ $isWeb != "web" ]] && echo -e "iter $iter \n$WALLETS0" sleep 2 - WALLETS0=$(curl -s ${DUNITER}/blockchain/block/${TXBLOCKS[$i]}) + WALLETS0=$(curl -s ${DUNITER}/blockchain/block/$i) done [[ -z "$WALLETS" ]] && continue - bloc=${TXBLOCKS[$i]} + bloc=$i # Récupération de la date du block blockDate=$(echo "$WALLETS" | head -n1) diff --git a/tpl/recus.json b/tpl/recus.json index c80a393..2e2c396 100644 --- a/tpl/recus.json +++ b/tpl/recus.json @@ -1 +1 @@ - {\n \"date\": \"_DATE\",\n \"rWallets\": \"_RWALLETS\",\n \"rMembres\": \"_RMEMBRES\"\n }, + {\n \"date\": \"_DATE\",\n \"rWallets\": _RWALLETS,\n \"rMembres\": _RMEMBRES\n },