diff --git a/cmd/blockchaincmd/add_validator.go b/cmd/blockchaincmd/add_validator.go index 37269bf02..11d12c2e7 100644 --- a/cmd/blockchaincmd/add_validator.go +++ b/cmd/blockchaincmd/add_validator.go @@ -203,11 +203,18 @@ func addValidator(_ *cobra.Command, args []string) error { // if we don't have a nodeID or ProofOfPossession by this point, prompt user if we want to add a aditional local node if (!sovereign && nodeIDStr == "") || (sovereign && !createLocalValidator && nodeIDStr == "" && publicKey == "" && pop == "") { - createLocalValidator, err = prompts.NewPrompter().CaptureNoYes( - "Would you like to add a local validator to this Blockchain?", - ) - if err != nil { - return err + for { + local := "Use my local machine to spin up an additional validator" + existing := "I have an existing Avalanche node (we will require its NodeID and BLS info)" + option, err := app.Prompt.CaptureList( + "How would you like to set up the new validator", + []string{local, existing}, + ) + if err != nil { + return err + } + createLocalValidator = option == local + break } } @@ -215,7 +222,7 @@ func addValidator(_ *cobra.Command, args []string) error { if createLocalValidator { anrSettings := node.ANRSettings{} nodeConfig := map[string]interface{}{} - ux.Logger.PrintToUser("Adding a local validator to blockchain %s", blockchainName) + ux.Logger.PrintToUser("Creating a new Avalanche node on local machine to add as a new validator to blockchain %s", blockchainName) if app.AvagoNodeConfigExists(blockchainName) { nodeConfig, err = utils.ReadJSON(app.GetAvagoNodeConfigPath(blockchainName)) if err != nil { @@ -294,7 +301,6 @@ func addValidator(_ *cobra.Command, args []string) error { if !sovereign { return CallAddValidatorNonSOV(deployer, network, kc, useLedger, blockchainName, nodeIDStr, defaultValidatorParams, waitForTxAcceptance) } - ux.Logger.PrintToUser("Using extra aggregator endpoints: %s", aggregatorExtraEndpoints) return CallAddValidator(deployer, network, kc, blockchainName, nodeIDStr, publicKey, pop) } diff --git a/pkg/node/local.go b/pkg/node/local.go index 4c80edf85..232471230 100644 --- a/pkg/node/local.go +++ b/pkg/node/local.go @@ -552,19 +552,19 @@ func UpsizeLocalNode( } spinSession := ux.NewUserSpinner() - spinner := spinSession.SpinToUser("Adding validator with name: %s to the existing local node", newNodeName) + spinner := spinSession.SpinToUser("Creating new node with name %s on local machine", newNodeName) // add new local node if _, err := cli.AddNode(ctx, newNodeName, avalancheGoBinPath, anrOpts...); err != nil { ux.SpinFailWithError(spinner, "", err) - return newNodeName, fmt.Errorf("failed to add local valildator: %w", err) + return newNodeName, fmt.Errorf("failed to add local validator: %w", err) } ux.Logger.Info("Waiting for node: %s to be healthy", newNodeName) _, err = subnet.WaitForHealthy(ctx, cli) if err != nil { - return newNodeName, fmt.Errorf("failed waiting for network to become healthy: %w", err) + return newNodeName, fmt.Errorf("failed waiting for node %s to be healthy: %w", newNodeName, err) } ux.SpinComplete(spinner) - spinner = spinSession.SpinToUser("Tracking a subnet for new local validator") + spinner = spinSession.SpinToUser("Tracking blockchain %s", blockchainName) time.Sleep(10 * time.Second) // delay before restarting new node if err := LocalNodeTrackSubnet(ctx, cli, @@ -576,13 +576,13 @@ func UpsizeLocalNode( subnetID, newNodeName); err != nil { ux.SpinFailWithError(spinner, "", err) - return newNodeName, fmt.Errorf("failed to track subnet: %w", err) + return newNodeName, fmt.Errorf("failed to track blockchain: %w", err) } // wait until cluster is healthy - spinner = spinSession.SpinToUser("Waiting for healthy local node") + spinner = spinSession.SpinToUser("Waiting for blockchain to be healthy") clusterInfo, err := subnet.WaitForHealthy(ctx, cli) if err != nil { - return newNodeName, fmt.Errorf("failed waiting for network to become healthy: %w", err) + return newNodeName, fmt.Errorf("failed waiting for blockchain to become healthy: %w", err) } ux.SpinComplete(spinner) spinSession.Stop() @@ -592,8 +592,9 @@ func UpsizeLocalNode( ux.Logger.PrintToUser("") nodeInfo := clusterInfo.NodeInfos[newNodeName] + ux.Logger.PrintToUser("Node name: %s ", newNodeName) ux.Logger.PrintToUser("URI: %s", nodeInfo.Uri) - ux.Logger.PrintToUser("NodeID: %s", nodeInfo.Id) + ux.Logger.PrintToUser("Node-ID: %s", nodeInfo.Id) ux.Logger.PrintToUser("") return newNodeName, nil }