Skip to content

Commit

Permalink
CNTools [5.3.1]
Browse files Browse the repository at this point in the history
##### 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
  • Loading branch information
Scitz0 committed Aug 3, 2020
1 parent 0de771e commit 01a61f7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
10 changes: 9 additions & 1 deletion docs/Scripts/cntools-changelog.md
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
31 changes: 15 additions & 16 deletions scripts/cnode-helper-scripts/cntools.library
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand Down
7 changes: 5 additions & 2 deletions scripts/cnode-helper-scripts/cntools.sh
Expand Up @@ -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)) && \
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 01a61f7

Please sign in to comment.