From 01a61f73aa993c9968495abbfbeda0f9ab6447a5 Mon Sep 17 00:00:00 2001 From: Ola Date: Tue, 4 Aug 2020 01:02:44 +0200 Subject: [PATCH] CNTools [5.3.1] ##### Fixed - Removed +i file locking on .addr files when using `Wallet >> Encrypt` as these are re-generated from keys and need to be writable - Balance check added to `Funds >> Withdraw` for base address as this is used to pay the withdraw transaction fee --- docs/Scripts/cntools-changelog.md | 10 ++++++- scripts/cnode-helper-scripts/cntools.library | 31 ++++++++++---------- scripts/cnode-helper-scripts/cntools.sh | 7 +++-- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/docs/Scripts/cntools-changelog.md b/docs/Scripts/cntools-changelog.md index 81177fba9..2ec38b0a6 100644 --- a/docs/Scripts/cntools-changelog.md +++ b/docs/Scripts/cntools-changelog.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [5.3.0] - 2020-08-03 +## [5.3.1] - 2020-08-04 > We have made quite a few changes to not use ptn0 in our scripts and source github structures (except template files), alongwith other changes listed beneath. Please follow steps below for upgrade (from 5.1.0 or earlier): > - Execute the below (by default it will set you up against mainnet network), do not overwrite config please: @@ -18,6 +18,12 @@ and this adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ======= +##### Fixed +- Removed +i file locking on .addr files when using `Wallet >> Encrypt` as these are re-generated from keys and need to be writable +- Balance check added to `Funds >> Withdraw` for base address as this is used to pay the withdraw transaction fee + + +## [5.3.0] - 2020-08-03 ##### Added - Ability to select a different pool owner and reward wallet - Multi-owner support using stake vkey/skey files @@ -48,6 +54,7 @@ and this adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - KES Calculation for current KES period and KES expiration date **Please re-check expiration date using Pool >> Show** + ## [5.2.1] - 2020-07-29 ##### Added - Basic sanity checks for socket file @@ -56,6 +63,7 @@ and this adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - calc_slots to be network independent - prom_host should be calculated from config file, instead of having to update a config + ## [5.2.0] - 2020-07-28 ##### Changed diff --git a/scripts/cnode-helper-scripts/cntools.library b/scripts/cnode-helper-scripts/cntools.library index 628ae7763..adcb10210 100644 --- a/scripts/cnode-helper-scripts/cntools.library +++ b/scripts/cnode-helper-scripts/cntools.library @@ -614,14 +614,11 @@ getPayAddress() { if [[ -f "${payment_vk_file}" ]]; then if ${CCLI} shelley address build --payment-verification-key-file "${payment_vk_file}" --out-file "${payment_addr_file}" ${HASH_IDENTIFIER} 2>/dev/null; then pay_addr=$(cat "${payment_addr_file}") - else - pay_addr="" - return 1 + return 0 fi - else - pay_addr="" - return 1 fi + pay_addr="" + return 1 } # Command : getBaseAddress [wallet name] @@ -632,12 +629,13 @@ getBaseAddress() { stake_vk_file="${WALLET_FOLDER}/${1}/${WALLET_STAKE_VK_FILENAME}" base_addr_file="${WALLET_FOLDER}/${1}/${WALLET_BASE_ADDR_FILENAME}" if [[ -f "${payment_vk_file}" && -f "${stake_vk_file}" ]]; then - ${CCLI} shelley address build --payment-verification-key-file "${payment_vk_file}" --stake-verification-key-file "${stake_vk_file}" --out-file "${base_addr_file}" ${HASH_IDENTIFIER} - base_addr=$(cat "${base_addr_file}") - else - base_addr="" - return 1 + if ${CCLI} shelley address build --payment-verification-key-file "${payment_vk_file}" --stake-verification-key-file "${stake_vk_file}" --out-file "${base_addr_file}" ${HASH_IDENTIFIER} 2>/dev/null; then + base_addr=$(cat "${base_addr_file}") + return 0 + fi fi + base_addr="" + return 1 } # Command : getRewardAddress [wallet name] @@ -647,12 +645,13 @@ getRewardAddress() { stake_vk_file="${WALLET_FOLDER}/${1}/${WALLET_STAKE_VK_FILENAME}" stake_addr_file="${WALLET_FOLDER}/${1}/${WALLET_STAKE_ADDR_FILENAME}" if [[ -f "${stake_vk_file}" ]]; then - ${CCLI} shelley stake-address build --stake-verification-key-file "${stake_vk_file}" --out-file "${stake_addr_file}" ${HASH_IDENTIFIER} - reward_addr=$(cat "${stake_addr_file}") - else - reward_addr="" - return 1 + if ${CCLI} shelley stake-address build --stake-verification-key-file "${stake_vk_file}" --out-file "${stake_addr_file}" ${HASH_IDENTIFIER} 2>/dev/null; then + reward_addr=$(cat "${stake_addr_file}") + return 0 + fi fi + reward_addr="" + return 1 } # Command : getAddressInfo [address] diff --git a/scripts/cnode-helper-scripts/cntools.sh b/scripts/cnode-helper-scripts/cntools.sh index 3fbd13cf5..4f30a5af6 100755 --- a/scripts/cnode-helper-scripts/cntools.sh +++ b/scripts/cnode-helper-scripts/cntools.sh @@ -639,9 +639,9 @@ case $OPERATION in unset password say "" - say "# Write protecting all wallet files using 'chattr +i'" "log" + say "# Write protecting all wallet keys using 'chattr +i'" "log" while IFS= read -r -d '' file; do - if [[ ! $(lsattr -R "$file") =~ -i- ]]; then + if [[ ${file} != *.addr && ! $(lsattr -R "$file") =~ -i- ]]; then chmod 400 "${file}" && \ sudo chattr +i "${file}" && \ filesLocked=$((++filesLocked)) && \ @@ -737,6 +737,9 @@ case $OPERATION in if [[ ${reward_lovelace} -le 0 ]]; then say "Failed to locate any rewards associated with the chosen wallet, please try another one" waitForInput && continue + elif [[ ${lovelace} -eq 0 ]]; then + say "${ORANGE}WARN${NC}: No funds in base address, please send funds to base address of wallet to cover withdraw transaction fee" + waitForInput && continue fi say "$(printf "%s\t${CYAN}%s${NC} ADA" "Funds" "$(formatLovelace ${lovelace})")" "log"