From 69719514598f3fdae107f07ff919dcf79ab6c36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 7 May 2019 15:02:32 +0300 Subject: [PATCH] cmd/geth: make account new output a bit more verbose --- cmd/geth/accountcmd.go | 12 +++++++----- cmd/geth/accountcmd_test.go | 12 +++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go index 8a23541fec..8fd149cacc 100644 --- a/cmd/geth/accountcmd.go +++ b/cmd/geth/accountcmd.go @@ -312,11 +312,13 @@ func accountCreate(ctx *cli.Context) error { if err != nil { utils.Fatalf("Failed to create account: %v", err) } - fmt.Printf("Your new key was generated\n") - fmt.Printf("Address: {%x}\n", account.Address) - fmt.Printf("Please backup your key file!\n") - fmt.Printf("Path: {%s}\n", account.URL.Path) - fmt.Printf("Please remember your password!\n") + fmt.Printf("\nYour new key was generated\n\n") + fmt.Printf("Public address of the key: %s\n", account.Address.Hex()) + fmt.Printf("Path of the secret key file: %s\n\n", account.URL.Path) + fmt.Printf("- You can share your public address with anyone. Others need it to interact with you.\n") + fmt.Printf("- You must NEVER share the secret key with anyone! The key controls access to your funds!\n") + fmt.Printf("- You must BACKUP your key file! Without the key, it's impossible to access account funds!\n") + fmt.Printf("- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!\n\n") return nil } diff --git a/cmd/geth/accountcmd_test.go b/cmd/geth/accountcmd_test.go index 3ea22ccfab..6c97f0ddc3 100644 --- a/cmd/geth/accountcmd_test.go +++ b/cmd/geth/accountcmd_test.go @@ -74,8 +74,18 @@ Your new account is locked with a password. Please give a password. Do not forge !! Unsupported terminal, password will be echoed. Passphrase: {{.InputLine "foobar"}} Repeat passphrase: {{.InputLine "foobar"}} + +Your new key was generated +`) + geth.ExpectRegexp(` +Public address of the key: 0x[0-9a-fA-F]{40} +Path of the secret key file: .*UTC--.+--[0-9a-f]{40} + +- You can share your public address with anyone. Others need it to interact with you. +- You must NEVER share the secret key with anyone! The key controls access to your funds! +- You must BACKUP your key file! Without the key, it's impossible to access account funds! +- You must REMEMBER your password! Without the password, it's impossible to decrypt the key! `) - geth.ExpectRegexp(`Address: \{[0-9a-f]{40}\}\n`) } func TestAccountNewBadRepeat(t *testing.T) {