diff --git a/scripts/cnode-helper-scripts/cntools.library b/scripts/cnode-helper-scripts/cntools.library index c1a7b54fb..45f03514d 100644 --- a/scripts/cnode-helper-scripts/cntools.library +++ b/scripts/cnode-helper-scripts/cntools.library @@ -485,9 +485,9 @@ selectWallet() { if [[ ${mode} = "reg" || ${mode} = "non-reg" ]]; then if [[ ${CNTOOLS_MODE} = "LOCAL" ]]; then if [[ ${mode} = "reg" ]]; then - isWalletRegistered ${dir} && continue - else ! isWalletRegistered ${dir} && continue + else + isWalletRegistered ${dir} && continue fi else getRewardAddress ${dir} @@ -564,10 +564,12 @@ selectWallet() { if [[ ${mode} = "reg" || ${mode} = "non-reg" ]]; then getRewardAddress ${wallet_dir} if [[ -n ${reward_addr} ]]; then - if [[ ${mode} = "reg" ]]; then - if [[ ! -v reward_status[${reward_addr}] || ${reward_status[${reward_addr}]} != "registered" ]]; then continue; fi - else - [[ -v reward_status[${reward_addr}] && ${reward_status[${reward_addr}]} = "registered" ]] && continue + if [[ ${CNTOOLS_MODE} = "LIGHT" ]]; then + if [[ ${mode} = "reg" ]]; then + if [[ ! -v reward_status[${reward_addr}] || ${reward_status[${reward_addr}]} != "registered" ]]; then continue; fi + else + [[ -v reward_status[${reward_addr}] && ${reward_status[${reward_addr}]} = "registered" ]] && continue + fi fi fi elif [[ ${mode} = "delegate" ]]; then @@ -626,9 +628,9 @@ selectWallet() { elif [[ ${mode} = "reward" ]]; then println ERROR "\n${FG_YELLOW}WARN${NC}: No wallets available that have rewards to withdraw or signing keys to do so!" elif [[ ${mode} = "reg" ]]; then - println ERROR "\n${FG_YELLOW}WARN${NC}: No wallets available that are unregistered!" - elif [[ ${mode} = "non-reg" ]]; then println ERROR "\n${FG_YELLOW}WARN${NC}: No wallets available that are registered on chain!" + elif [[ ${mode} = "non-reg" ]]; then + println ERROR "\n${FG_YELLOW}WARN${NC}: No wallets available that are unregistered!" else println ERROR "\n${FG_YELLOW}WARN${NC}: No wallets available for selection! Required files:\n$(printf '%b\n' "$@")" fi diff --git a/scripts/cnode-helper-scripts/cntools.sh b/scripts/cnode-helper-scripts/cntools.sh index 942182d17..0049f9d08 100755 --- a/scripts/cnode-helper-scripts/cntools.sh +++ b/scripts/cnode-helper-scripts/cntools.sh @@ -119,11 +119,15 @@ if [[ ! -f "${PARENT}"/env ]]; then myExit 1 fi -# Source env file in offline mode -! . "${PARENT}"/env offline && myExit 1 +# Source env file in normal mode with node connection, else offline mode +if [[ ${CNTOOLS_MODE} = "LOCAL" ]]; then + . "${PARENT}"/env || myExit 1 +else + . "${PARENT}"/env offline || myExit 1 +fi # Source cntools.library to populate defaults for CNTools -! . "${PARENT}"/cntools.library && myExit 1 +. "${PARENT}"/cntools.library || myExit 1 # If light mode, test if koios is reachable, otherwise - unset KOIOS_API if [[ ${CNTOOLS_MODE} = "LIGHT" ]]; then @@ -131,11 +135,6 @@ if [[ ${CNTOOLS_MODE} = "LIGHT" ]]; then [[ -z ${KOIOS_API} ]] && myExit 1 "ERROR: Koios query test failed, unable to launch CNTools in light mode utilizing Koios query layer\n\n${launch_modes_info}" fi -# Source env file in normal mode with node connection -if [[ ${CNTOOLS_MODE} = "LOCAL" ]]; then - . "${PARENT}"/env &>/dev/null -fi - [[ ${CNTOOLS_MODE} != "LIGHT" ]] && unset KOIOS_API [[ ${PRINT_VERSION} = "true" ]] && myExit 0 "CNTools v${CNTOOLS_VERSION} (branch: $([[ -f "${PARENT}"/.env_branch ]] && cat "${PARENT}"/.env_branch || echo "master"))"