Skip to content

Commit

Permalink
Set network identifier used for local persistence lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
hsoerensen committed Aug 28, 2024
1 parent ae14ca9 commit e1e1172
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ wallet_password=""
new_user_setup=0
new_network=0
network_status_url=""
network_identifier=""
container_id=""

voi_logo="MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
Expand Down Expand Up @@ -313,6 +314,23 @@ set_network_url() {
esac
}
set_network_identifier() {
case ${VOINETWORK_NETWORK} in
"mainnet")
network_identifier="voimain-v1.0"
;;
"betanet")
network_identifier="voibeta-v1.0"
;;
"testnet")
network_identifier="voitest-v1"
;;
*)
network_identifier="voitest-v1"
;;
esac
}
catchup_node() {
display_banner "Catching up with the network... This might take some time, and numbers might briefly increase"
set_network_url
Expand Down Expand Up @@ -398,11 +416,11 @@ busy_wait_until_balance_is_sufficient() {
get_account_info() {
allow_one_account=$1
if execute_sudo 'test ! -f "/var/lib/voi/algod/data/voitest-v1/accountList.json"'; then
if execute_sudo "test ! -f \"/var/lib/voi/algod/data/${network_identifier}/accountList.json\""; then
return 0
fi
accounts_json=$(execute_sudo 'cat /var/lib/voi/algod/data/voitest-v1/accountList.json')
accounts_json=$(execute_sudo "cat /var/lib/voi/algod/data/${network_identifier}/accountList.json")
number_of_accounts=$(echo "${accounts_json}" | jq '.Accounts | length')
if [[ $number_of_accounts -gt 1 ]]; then
Expand Down Expand Up @@ -466,11 +484,11 @@ get_last_committed_block() {
}
get_account_addresses() {
if execute_sudo 'test ! -f "/var/lib/voi/algod/data/voitest-v1/accountList.json"'; then
if execute_sudo "test ! -f \"/var/lib/voi/algod/data/${network_identifier}/accountList.json\""; then
abort "Account list not found. Exiting the program."
fi
accounts_json=$(execute_sudo 'cat /var/lib/voi/algod/data/voitest-v1/accountList.json')
accounts_json=$(execute_sudo "cat /var/lib/voi/algod/data/${network_identifier}/accountList.json")
number_of_accounts=$(echo "${accounts_json}" | jq '.Accounts | length')
if [[ $number_of_accounts -eq 0 ]]; then
Expand Down Expand Up @@ -1131,6 +1149,7 @@ fi
display_banner "${bold}Welcome to Voi Swarm${normal}. Let's get started!"

mkdir -p "${voi_home}"
set_network_identifier

existing_network=$(get_existing_network)

Expand Down

0 comments on commit e1e1172

Please sign in to comment.