Lock transaction hash ever applied
This commit is contained in:
parent
1987ca71b3
commit
022cf49eea
|
@ -1,4 +1,5 @@
|
|||
config/config.php
|
||||
scripts/.loc_hash
|
||||
.idea
|
||||
/public/uploads
|
||||
/tmp
|
||||
|
|
|
@ -6,17 +6,23 @@ start=`date +%s`
|
|||
date=$(date +'%d-%m-%y à %H:%M')
|
||||
echo "### $date ###"
|
||||
|
||||
## Inistialisation
|
||||
## Initialisation
|
||||
DUNITER=$(grep g1_node ../config/config.php | awk '{ print $3}' | tr -d ';' | tr -d "'")
|
||||
TXBLOCKS=$(curl -s $DUNITER/blockchain/with/tx | jq '.result.blocks[]')
|
||||
TXBLOCKS=$(echo "$TXBLOCKS" | tail -n 2 | tr '\n' ' ')
|
||||
keyword="\[Achat GMarche] : "
|
||||
[ ! -e .loc_hash ] && touch .loc_hash
|
||||
|
||||
## Récupération des transactions avec commentaire GMarche
|
||||
|
||||
for i in $TXBLOCKS; do
|
||||
result=$(curl -s $DUNITER/blockchain/block/$i | jq '.transactions[].comment' | grep -v '""' | tr -d '"')
|
||||
result=$(echo "$result" | grep "$keyword")
|
||||
[[ ! -z $result ]] && isSell+=$(echo -e "$result;")
|
||||
result=$(curl -s $DUNITER/blockchain/block/$i | jq '.transactions[].hash, .transactions[].comment' | grep -v '""' | tr -d '"' | grep -B1 "$keyword")
|
||||
rhash=$(echo "$result" | head -n1)
|
||||
rcom=$(echo "$result" | tail -n1)
|
||||
if [[ ! -z $result && -z $(grep $rhash .loc_hash) ]]; then
|
||||
isSell+=$(echo -e "$rcom;")
|
||||
echo "$rhash" >> .loc_hash
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
@ -26,8 +32,13 @@ req="SELECT pubkey FROM users;"
|
|||
usersPubkeys=$(sudo mysql --database gmarche -e "$req" | grep .)
|
||||
|
||||
for i in $usersPubkeys; do
|
||||
isSell+=$(curl -s $DUNITER/tx/history/$i/pending | jq '. | select(.history.sending == [])' | jq '.history.pending[].comment' | tr -d '"')
|
||||
#[ ! -z "$pendingTX" ] && echo "$pendingTX"
|
||||
result=$(curl -s $DUNITER/tx/history/$i/pending | jq '. | select(.history.sending == [])' | jq '.history.pending[].hash,.history.pending[].comment' | tr -d '"')
|
||||
rhash=$(echo "$result" | head -n1)
|
||||
rcom=$(echo "$result" | tail -n1)
|
||||
if [[ ! -z $result && -z $(grep $rhash .loc_hash) ]]; then
|
||||
isSell+=$(echo -e "$rcom;")
|
||||
echo "$rhash" >> .loc_hash
|
||||
fi
|
||||
done
|
||||
|
||||
## Retrait de l'identifiant gmarche des commentaires
|
||||
|
|
Loading…
Reference in New Issue