chore: check registration process success or not before starting node

This commit is contained in:
DarshanBPatel 2024-11-24 17:30:09 +05:30
parent 828a9838ac
commit 2c942615ca
No known key found for this signature in database
GPG Key ID: 9A92CCD9899F0D22
1 changed files with 28 additions and 12 deletions

View File

@ -146,31 +146,47 @@ setup() {
echo -e "${YELLOW}Keeping existing configuration${NC}" echo -e "${YELLOW}Keeping existing configuration${NC}"
fi fi
# Confirm before proceeding echo -e "${YELLOW}Setup completed. Run './interactive-cli.sh start' or use the 'Start Node' option from the main menu when you're ready to start the node.${NC}"
read -p $'\n'"Ready to start the node? (Y/n): " start_confirmation
if [[ $start_confirmation == [nN] ]]; then press_enter
echo -e "${YELLOW}Setup completed. Run './interactive-cli.sh start' or use the 'Start Node' option from the main menu when you're ready to start the node.${NC}"
return
fi
# Register RLN membership # Register RLN membership
echo -e "\n📝 RLN Membership Registration Status:" echo -e "\n📝 RLN Membership Registration Status:"
registration_success=false
if [ ! -d "keystore" ]; then if [ ! -d "keystore" ]; then
echo -e "${YELLOW}➤ Initiating registration: No existing keystore found${NC}" echo -e "${YELLOW}➤ Initiating registration: No existing keystore found${NC}"
./register_rln.sh if ./register_rln.sh; then
registration_success=true
else
echo -e "$Registration failed. Please check the errors above${NC}"
return 1
fi
elif [ "$reconfigure_confirmation" == [yY] ]; then elif [ "$reconfigure_confirmation" == [yY] ]; then
echo -e "${YELLOW}➤ Initiating registration: Reconfiguration requested by user${NC}" echo -e "${YELLOW}➤ Initiating registration: Reconfiguration requested by user${NC}"
./register_rln.sh if ./register_rln.sh; then
registration_success=true
else
echo -e "Registration failed. Please check the errors above${NC}"
return 1
fi
else else
if [ $reconfigure_confirmation == [nN] ]; then if [ $reconfigure_confirmation == [nN] ]; then
echo -e "${YELLOW}➤ Registration skipped: User chose to keep existing configuration${NC}" echo -e "$Registration skipped: User chose to keep existing configuration${NC}"
registration_success=true
else else
echo -e "${YELLOW}➤ Registration skipped: Valid keystore directory already exists${NC}" echo -e "$Registration skipped: Valid keystore directory already exists${NC}"
registration_success=true
fi fi
fi fi
# Start the node # Only proceed to start the node if registration was successful or skipped
start_node if [ "$registration_success" = true ]; then
read -p $'\n'"Ready to start the node? (Y/n): " start_confirm
if [[ $start_confirm != [nN] ]]; then
start_node
fi
fi
} }
# Interactive menu function # Interactive menu function