Skip to content

Commit

Permalink
Migrate existing account properly
Browse files Browse the repository at this point in the history
  • Loading branch information
hsoerensen committed Sep 17, 2024
1 parent ffe22eb commit b6c26d3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ network_identifier=""
staking_url=""
container_id=""
latest_key_end_block=""
previous_network_addresses=""

voi_logo="MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
Expand Down Expand Up @@ -564,6 +565,7 @@ ensure_accounts_are_offline() {
local local_network_identifier
local_network_identifier=$(get_network_identifier "$1")
account_addresses=$(get_account_addresses "${local_network_identifier}")
previous_network_addresses="${account_addresses}"
if [[ -z ${account_addresses} ]]; then
return
Expand Down Expand Up @@ -1493,7 +1495,19 @@ if [[ -n ${VOINETWORK_IMPORT_ACCOUNT} && ${VOINETWORK_IMPORT_ACCOUNT} -eq 1 ]];
fi

else
if check_if_account_exists; then
if [[ ${new_network} -eq 1 && -n ${previous_network_addresses} ]]; then

for account in ${previous_network_addresses}; do
echo "Let's proceed to import ${account} into ${VOINETWORK_NETWORK} using your existing account mnemonic."
echo "This is a two-step process, first we will delete the account from the previous network, followed"
echo "by importing the account into the new network."
echo ""
execute_interactive_docker_command "/node/bin/goal account delete -a ${account}"
execute_interactive_docker_command "/node/bin/goal account import"
done

get_account_address
elif check_if_account_exists; then
execute_interactive_docker_command "/node/bin/goal account new"
get_account_address

Expand Down

0 comments on commit b6c26d3

Please sign in to comment.