Skip to content

Commit

Permalink
fix: use correct variable name to check platform version (#503)
Browse files Browse the repository at this point in the history
Signed-off-by: Lenin Mehedy <[email protected]>
  • Loading branch information
leninmehedy authored Nov 13, 2023
1 parent 85ac118 commit 460a68e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions dev/scripts/helper.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
CUR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source "${CUR_DIR}/env.sh"

start_time=$(date +%s)
TMP_DIR="${SCRIPT_DIR}/../temp"

Expand Down Expand Up @@ -282,10 +285,16 @@ function copy_node_keys() {

# prepare address book using all nodes pod IP and store as config.txt
function prep_address_book() {
IFS=. read -a VERSION_PARTS <<< "$PLATFORM_VERSION"
local MINOR_VERSION=${VERSION_PARTS[1]}

echo ""
echo "Preparing address book"
echo "PLATFORM_VERSION [ MAJOR: ${VERSION_PARTS[0]}, MINOR=${VERSION_PARTS[1]}, PATCH=${VERSION_PARTS[2]} ]"
echo "-----------------------------------------------------------------------------------------------------"



local config_file="${TMP_DIR}/config.txt"
local node_IP=""
local node_seq="${NODE_SEQ:-0}" # this also used as the account ID suffix
Expand Down Expand Up @@ -342,7 +351,7 @@ function prep_address_book() {
local external_ip="${SVC_IP}"

# for v.40.* onward
if [[ "${PLATFORM_PROFILE}" == v0.4* ]]; then
if [[ "${MINOR_VERSION}" -ge "40" ]]; then
local node_nick_name="${node_name}"
config_lines+=("address, ${node_seq}, ${node_nick_name}, ${node_name}, ${node_stake}, ${internal_ip}, ${internal_port}, ${external_ip}, ${external_port}, ${account}")
else
Expand All @@ -355,7 +364,9 @@ function prep_address_book() {
done

# for v.41.* onward
# config_lines+=("nextNodeId, ${node_seq}")
if [[ "${MINOR_VERSION}" -ge "41" ]]; then
config_lines+=("nextNodeId, ${node_seq}")
fi

# write contents to config file
cp "${SCRIPT_DIR}/../local-node/config.template" "${config_file}" || return "${EX_ERR}"
Expand Down

0 comments on commit 460a68e

Please sign in to comment.