@@ -15,19 +15,13 @@ import (
1515
1616 "github.com/ethereum/go-ethereum/common"
1717 "github.com/goccy/go-json"
18- "github.com/mitchellh/go-homedir"
19- "github.com/rocket-pool/node-manager-core/beacon"
2018 "github.com/urfave/cli/v2"
21- "gopkg.in/yaml.v2"
2219
2320 "github.com/rocket-pool/node-manager-core/eth"
24- nmc_utils "github.com/rocket-pool/node-manager-core/utils"
2521 "github.com/rocket-pool/node-manager-core/utils/math"
2622 "github.com/rocket-pool/smartnode/v2/rocketpool-cli/client"
2723 "github.com/rocket-pool/smartnode/v2/rocketpool-cli/utils"
2824 "github.com/rocket-pool/smartnode/v2/rocketpool-cli/utils/tx"
29- "github.com/rocket-pool/smartnode/v2/shared/config"
30- "github.com/rocket-pool/smartnode/v2/shared/types/api"
3125)
3226
3327const (
@@ -326,77 +320,6 @@ func promptMinNodeFee(networkCurrentNodeFee, networkMinNodeFee float64) float64
326320
327321}
328322
329- // Prompt for the password to a solo validator key as part of migration
330- func promptForSoloKeyPassword (cfg * config.SmartNodeConfig , pubkey beacon.ValidatorPubkey ) (string , error ) {
331-
332- // Check for the custom key directory
333- customKeyDir , err := homedir .Expand (cfg .GetCustomKeyPath ())
334- if err != nil {
335- return "" , fmt .Errorf ("error expanding custom keys directory: %w" , err )
336- }
337- info , err := os .Stat (customKeyDir )
338- if os .IsNotExist (err ) || ! info .IsDir () {
339- return "" , nil
340- }
341-
342- // Get the custom keystore files
343- files , err := os .ReadDir (customKeyDir )
344- if err != nil {
345- return "" , fmt .Errorf ("error enumerating custom keystores: %w" , err )
346- }
347- if len (files ) == 0 {
348- return "" , nil
349- }
350-
351- // Get the pubkeys for the custom keystores
352- pubkeyPasswords := map [string ]string {}
353- for _ , file := range files {
354- // Read the file
355- bytes , err := os .ReadFile (filepath .Join (customKeyDir , file .Name ()))
356- if err != nil {
357- return "" , fmt .Errorf ("error reading custom keystore %s: %w" , file .Name (), err )
358- }
359-
360- // Deserialize it
361- keystore := api.ValidatorKeystore {}
362- err = json .Unmarshal (bytes , & keystore )
363- if err != nil {
364- return "" , fmt .Errorf ("error deserializing custom keystore %s: %w" , file .Name (), err )
365- }
366-
367- if keystore .Pubkey == pubkey {
368- // Found it, prompt for the password
369- password := utils .PromptPassword (
370- fmt .Sprintf ("Please enter the password that the keystore for %s was encrypted with:" , pubkey .Hex ()), "^.*$" , "" ,
371- )
372-
373- formattedPubkey := strings .ToUpper (nmc_utils .RemovePrefix (pubkey .Hex ()))
374- pubkeyPasswords [formattedPubkey ] = password
375-
376- fmt .Println ()
377- break
378- }
379- }
380-
381- if len (pubkeyPasswords ) == 0 {
382- return "" , fmt .Errorf ("couldn't find the keystore for validator %s in the custom-keys directory; if you want to import this key into the Smart Node stack, you will need to put its keystore file into custom-keys first" , pubkey .HexWithPrefix ())
383- }
384-
385- // Store it in the file
386- fileBytes , err := yaml .Marshal (pubkeyPasswords )
387- if err != nil {
388- return "" , fmt .Errorf ("error serializing keystore passwords file: %w" , err )
389- }
390- passwordFile := cfg .GetCustomKeyPasswordFilePath ()
391- err = os .WriteFile (passwordFile , fileBytes , 0600 )
392- if err != nil {
393- return "" , fmt .Errorf ("error writing keystore passwords file: %w" , err )
394- }
395-
396- return passwordFile , nil
397-
398- }
399-
400323func SwapRpl (c * cli.Context , rp * client.Client , amountWei * big.Int ) error {
401324 // Get the TX
402325 response , err := rp .Api .Node .SwapRpl (amountWei )
0 commit comments