merge
This commit is contained in:
		| @@ -129,6 +129,7 @@ runtime will execute the file and exit. | |||||||
| 		utils.RPCEnabledFlag, | 		utils.RPCEnabledFlag, | ||||||
| 		utils.RPCListenAddrFlag, | 		utils.RPCListenAddrFlag, | ||||||
| 		utils.RPCPortFlag, | 		utils.RPCPortFlag, | ||||||
|  | 		utils.UnencryptedKeysFlag, | ||||||
| 		utils.VMDebugFlag, | 		utils.VMDebugFlag, | ||||||
| 		//utils.VMTypeFlag, | 		//utils.VMTypeFlag, | ||||||
| 	} | 	} | ||||||
| @@ -230,6 +231,8 @@ func accountList(ctx *cli.Context) { | |||||||
|  |  | ||||||
| func accountCreate(ctx *cli.Context) { | func accountCreate(ctx *cli.Context) { | ||||||
| 	am := utils.GetAccountManager(ctx) | 	am := utils.GetAccountManager(ctx) | ||||||
|  | 	passphrase := "" | ||||||
|  | 	if !ctx.GlobalBool(utils.UnencryptedKeysFlag.Name) { | ||||||
| 		fmt.Println("The new account will be encrypted with a passphrase.") | 		fmt.Println("The new account will be encrypted with a passphrase.") | ||||||
| 		fmt.Println("Please enter a passphrase now.") | 		fmt.Println("Please enter a passphrase now.") | ||||||
| 		auth, err := readPassword("Passphrase: ", true) | 		auth, err := readPassword("Passphrase: ", true) | ||||||
| @@ -243,7 +246,9 @@ func accountCreate(ctx *cli.Context) { | |||||||
| 		if auth != confirm { | 		if auth != confirm { | ||||||
| 			utils.Fatalf("Passphrases did not match.") | 			utils.Fatalf("Passphrases did not match.") | ||||||
| 		} | 		} | ||||||
| 	acct, err := am.NewAccount(auth) | 		passphrase = auth | ||||||
|  | 	} | ||||||
|  | 	acct, err := am.NewAccount(passphrase) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		utils.Fatalf("Could not create the account: %v", err) | 		utils.Fatalf("Could not create the account: %v", err) | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -99,6 +99,10 @@ var ( | |||||||
| 		Name:  "mine", | 		Name:  "mine", | ||||||
| 		Usage: "Enable mining", | 		Usage: "Enable mining", | ||||||
| 	} | 	} | ||||||
|  | 	UnencryptedKeysFlag = cli.BoolFlag{ | ||||||
|  | 		Name:  "unencrypted-keys", | ||||||
|  | 		Usage: "disable private key disk encryption (for testing)", | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	LogFileFlag = cli.StringFlag{ | 	LogFileFlag = cli.StringFlag{ | ||||||
| 		Name:  "logfile", | 		Name:  "logfile", | ||||||
| @@ -224,9 +228,13 @@ func GetChain(ctx *cli.Context) (*core.ChainManager, ethutil.Database, ethutil.D | |||||||
|  |  | ||||||
| func GetAccountManager(ctx *cli.Context) *accounts.Manager { | func GetAccountManager(ctx *cli.Context) *accounts.Manager { | ||||||
| 	dataDir := ctx.GlobalString(DataDirFlag.Name) | 	dataDir := ctx.GlobalString(DataDirFlag.Name) | ||||||
| 	ks := crypto.NewKeyStorePassphrase(path.Join(dataDir, "keys")) | 	var ks crypto.KeyStore2 | ||||||
| 	km := accounts.NewManager(ks) | 	if ctx.GlobalBool(UnencryptedKeysFlag.Name) { | ||||||
| 	return km | 		ks = crypto.NewKeyStorePlain(path.Join(dataDir, "plainkeys")) | ||||||
|  | 	} else { | ||||||
|  | 		ks = crypto.NewKeyStorePassphrase(path.Join(dataDir, "keys")) | ||||||
|  | 	} | ||||||
|  | 	return accounts.NewManager(ks) | ||||||
| } | } | ||||||
|  |  | ||||||
| func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { | func StartRPC(eth *eth.Ethereum, ctx *cli.Context) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user