@@ -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 (
@@ -324,77 +318,6 @@ func promptMinNodeFee(networkCurrentNodeFee, networkMinNodeFee float64) float64
324318
325319}
326320
327- // Prompt for the password to a solo validator key as part of migration
328- func promptForSoloKeyPassword (cfg * config.SmartNodeConfig , pubkey beacon.ValidatorPubkey ) (string , error ) {
329-
330- // Check for the custom key directory
331- customKeyDir , err := homedir .Expand (cfg .GetCustomKeyPath ())
332- if err != nil {
333- return "" , fmt .Errorf ("error expanding custom keys directory: %w" , err )
334- }
335- info , err := os .Stat (customKeyDir )
336- if os .IsNotExist (err ) || ! info .IsDir () {
337- return "" , nil
338- }
339-
340- // Get the custom keystore files
341- files , err := os .ReadDir (customKeyDir )
342- if err != nil {
343- return "" , fmt .Errorf ("error enumerating custom keystores: %w" , err )
344- }
345- if len (files ) == 0 {
346- return "" , nil
347- }
348-
349- // Get the pubkeys for the custom keystores
350- pubkeyPasswords := map [string ]string {}
351- for _ , file := range files {
352- // Read the file
353- bytes , err := os .ReadFile (filepath .Join (customKeyDir , file .Name ()))
354- if err != nil {
355- return "" , fmt .Errorf ("error reading custom keystore %s: %w" , file .Name (), err )
356- }
357-
358- // Deserialize it
359- keystore := api.ValidatorKeystore {}
360- err = json .Unmarshal (bytes , & keystore )
361- if err != nil {
362- return "" , fmt .Errorf ("error deserializing custom keystore %s: %w" , file .Name (), err )
363- }
364-
365- if keystore .Pubkey == pubkey {
366- // Found it, prompt for the password
367- password := utils .PromptPassword (
368- fmt .Sprintf ("Please enter the password that the keystore for %s was encrypted with:" , pubkey .Hex ()), "^.*$" , "" ,
369- )
370-
371- formattedPubkey := strings .ToUpper (nmc_utils .RemovePrefix (pubkey .Hex ()))
372- pubkeyPasswords [formattedPubkey ] = password
373-
374- fmt .Println ()
375- break
376- }
377- }
378-
379- if len (pubkeyPasswords ) == 0 {
380- 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 Smartnode stack, you will need to put its keystore file into custom-keys first" , pubkey .HexWithPrefix ())
381- }
382-
383- // Store it in the file
384- fileBytes , err := yaml .Marshal (pubkeyPasswords )
385- if err != nil {
386- return "" , fmt .Errorf ("error serializing keystore passwords file: %w" , err )
387- }
388- passwordFile := cfg .GetCustomKeyPasswordFilePath ()
389- err = os .WriteFile (passwordFile , fileBytes , 0600 )
390- if err != nil {
391- return "" , fmt .Errorf ("error writing keystore passwords file: %w" , err )
392- }
393-
394- return passwordFile , nil
395-
396- }
397-
398321func SwapRpl (c * cli.Context , rp * client.Client , amountWei * big.Int ) error {
399322 // Get the TX
400323 response , err := rp .Api .Node .SwapRpl (amountWei )
0 commit comments