Skip to content

Commit b6c26d3

Browse files
committed
Migrate existing account properly
1 parent ffe22eb commit b6c26d3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

install.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ network_identifier=""
1515
staking_url=""
1616
container_id=""
1717
latest_key_end_block=""
18+
previous_network_addresses=""
1819

1920
voi_logo="MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
2021
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
@@ -564,6 +565,7 @@ ensure_accounts_are_offline() {
564565
local local_network_identifier
565566
local_network_identifier=$(get_network_identifier "$1")
566567
account_addresses=$(get_account_addresses "${local_network_identifier}")
568+
previous_network_addresses="${account_addresses}"
567569
568570
if [[ -z ${account_addresses} ]]; then
569571
return
@@ -1493,7 +1495,19 @@ if [[ -n ${VOINETWORK_IMPORT_ACCOUNT} && ${VOINETWORK_IMPORT_ACCOUNT} -eq 1 ]];
14931495
fi
14941496

14951497
else
1496-
if check_if_account_exists; then
1498+
if [[ ${new_network} -eq 1 && -n ${previous_network_addresses} ]]; then
1499+
1500+
for account in ${previous_network_addresses}; do
1501+
echo "Let's proceed to import ${account} into ${VOINETWORK_NETWORK} using your existing account mnemonic."
1502+
echo "This is a two-step process, first we will delete the account from the previous network, followed"
1503+
echo "by importing the account into the new network."
1504+
echo ""
1505+
execute_interactive_docker_command "/node/bin/goal account delete -a ${account}"
1506+
execute_interactive_docker_command "/node/bin/goal account import"
1507+
done
1508+
1509+
get_account_address
1510+
elif check_if_account_exists; then
14971511
execute_interactive_docker_command "/node/bin/goal account new"
14981512
get_account_address
14991513

0 commit comments

Comments
 (0)