From d54e3434fa12ce4435e044789e07c4b080d8b939 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Tue, 9 Jul 2024 16:44:22 +0300 Subject: bugfixes --- bin/ak-get-balances | 35 +++++++++++++++++++++++++---------- bin/ak-schain | 2 +- 2 files changed, 26 insertions(+), 11 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 diff --git a/bin/ak-schain b/bin/ak-schain index 1221274..9fa41b0 100755 --- a/bin/ak-schain +++ b/bin/ak-schain @@ -21,7 +21,7 @@ if [ ! -z $1 ] then case $1 in -h | --help) _ak_usage; exit;; - -c | --crawl) _ak_schain_crawl_interface $*; exit;; + -c | --crawl) shift; _ak_schain_crawl_interface $*; exit;; * ) _ak_usage;; esac else _ak_usage -- cgit v1.2.3