aboutsummaryrefslogtreecommitdiff
path: root/bin/ak-get-balances
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2024-07-09 16:44:22 +0300
committerkaotisk <kaotisk@arching-kaos.org>2024-07-09 16:44:22 +0300
commitd54e3434fa12ce4435e044789e07c4b080d8b939 (patch)
tree7726e6b08fca90ead18c0f91ad9d1a493ab40044 /bin/ak-get-balances
parent156e25160c3062a6baeed0ecfc1250a69b61a85f (diff)
downloadarching-kaos-tools-d54e3434fa12ce4435e044789e07c4b080d8b939.tar.gz
arching-kaos-tools-d54e3434fa12ce4435e044789e07c4b080d8b939.tar.bz2
arching-kaos-tools-d54e3434fa12ce4435e044789e07c4b080d8b939.zip
bugfixes
Diffstat (limited to 'bin/ak-get-balances')
-rwxr-xr-xbin/ak-get-balances35
1 files changed, 25 insertions, 10 deletions
diff --git a/bin/ak-get-balances b/bin/ak-get-balances
index f02ed54..0386a04 100755
--- a/bin/ak-get-balances
+++ b/bin/ak-get-balances
@@ -84,7 +84,9 @@ _ak_verify_zblocks_found(){
filename="$(basename $found_filename)"
zblock="$(echo -n $filename | cut -d '.' -f 1)"
zblock_status="$(echo -n $filename | cut -d '.' -f 2)"
- if [ "$zblock_status" == "untested" ] && [ ! -f $AK_DB/zblocks-tested/$zblock.success ] && [ ! -f $AK_DB/zblocks-tested/$zblock.failed ]
+ if [ "$zblock_status" == "untested" ] && \
+ [ ! -f $AK_DB/zblocks-tested/$zblock.success ] && \
+ [ ! -f $AK_DB/zblocks-tested/$zblock.failed ]
then
_ak_zchain_crawl $zblock > /dev/null 2>&1
if [ $? -ne 0 ]
@@ -124,27 +126,40 @@ _ak_balances_from_sblock(){
_ak_log_info "Verifying zblocks in sblock $CUR_TARGET"
_ak_verify_zblocks_found $CUR_TARGET
_ak_log_debug "Looking for failed ones"
- if [ -d $CUR_TARGET ]
+ _ak_log_debug "Looking for failed ones @ `pwd` and $CUR_TARGET"
+ #sleep 3
+ if [ "$(_ak_sblock_show $CUR_TARGET | jq 'has("zblocks")')" == "true" ]
then
- find $CUR_TARGET -type f | grep failed
- if [ $? -ne 0 ]
+ if [ -d $CUR_TARGET ]
then
- _ak_rewards_from_sblock $CUR_TARGET
- else
- _ak_log_warning "$CUR_TARGET is invalid"
+ find $CUR_TARGET -type f | grep failed
+ if [ $? -ne 0 ]
+ then
+ _ak_rewards_from_sblock $CUR_TARGET
+ else
+ _ak_log_warning "$CUR_TARGET is invalid"
+ fi
fi
+ else
+ _ak_rewards_from_sblock $CUR_TARGET
fi
- #sleep 3
- _ak_sblock_show $CUR_TARGET | jq
}
_ak_rewards_from_sblock(){
- CUR_TARGET="$1"
+ if [ ! -z $1 ] && [ -n "$1" ]
+ then
+ CUR_TARGET="$1"
+ else
+ _ak_log_error "No SBLOCK provided"
+ exit 1
+ fi
GPG="$(_ak_sblock_show $CUR_TARGET | jq -r '.output')"
+ _ak_log_debug "Got GPG : $GPG"
if [ "$GPG" == "null" ]
then
GPG="$(_ak_sblock_show $CUR_TARGET | jq -r '.miner')"
fi
+ _ak_log_debug "Now got GPG : $GPG"
AMOUNT="$(_ak_sblock_show $CUR_TARGET | jq -r '.amount')"
if [ "$AMOUNT" == "null" ]
then