mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
Merge 790fe879c2 into 6dd27e7cff
This commit is contained in:
commit
94be935956
2 changed files with 17 additions and 10 deletions
|
|
@ -98,7 +98,9 @@ And finally. DO NOT FORGET YOUR PASSWORD.
|
|||
Usage: "Print account addresses",
|
||||
ArgsUsage: " ",
|
||||
Description: `
|
||||
TODO: Please write this
|
||||
geth account list
|
||||
|
||||
Lists every account with its index, address and path to the file.
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
|
@ -181,7 +183,7 @@ nodes.
|
|||
func accountList(ctx *cli.Context) error {
|
||||
stack := utils.MakeNode(ctx, clientIdentifier, gitCommit)
|
||||
for i, acct := range stack.AccountManager().Accounts() {
|
||||
fmt.Printf("Account #%d: {%x} %s\n", i, acct.Address, acct.File)
|
||||
fmt.Printf("Index: %d, Address: {%x}, File: %s\n", i, acct.Address, acct.File)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -279,7 +281,8 @@ func accountCreate(ctx *cli.Context) error {
|
|||
if err != nil {
|
||||
utils.Fatalf("Failed to create account: %v", err)
|
||||
}
|
||||
fmt.Printf("Address: {%x}\n", account.Address)
|
||||
index := len(stack.AccountManager().Accounts()) - 1
|
||||
fmt.Printf("Index: %d, Address: {%x}, File: %s\n", index, account.Address, account.File)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,15 +53,15 @@ func TestAccountList(t *testing.T) {
|
|||
defer geth.expectExit()
|
||||
if runtime.GOOS == "windows" {
|
||||
geth.expect(`
|
||||
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} {{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
|
||||
Account #1: {f466859ead1932d743d622cb74fc058882e8648a} {{.Datadir}}\keystore\aaa
|
||||
Account #2: {289d485d9771714cce91d3393d764e1311907acc} {{.Datadir}}\keystore\zzz
|
||||
Index: 0, Address: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8}, File: {{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
|
||||
Index: 1, Address: {f466859ead1932d743d622cb74fc058882e8648a}, File: {{.Datadir}}\keystore\aaa
|
||||
Index: 2, Address: {289d485d9771714cce91d3393d764e1311907acc}, File: {{.Datadir}}\keystore\zzz
|
||||
`)
|
||||
} else {
|
||||
geth.expect(`
|
||||
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} {{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
|
||||
Account #1: {f466859ead1932d743d622cb74fc058882e8648a} {{.Datadir}}/keystore/aaa
|
||||
Account #2: {289d485d9771714cce91d3393d764e1311907acc} {{.Datadir}}/keystore/zzz
|
||||
Index: 0, Address: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8}, File: {{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
|
||||
Index: 1, Address: {f466859ead1932d743d622cb74fc058882e8648a}, File: {{.Datadir}}/keystore/aaa
|
||||
Index: 2, Address: {289d485d9771714cce91d3393d764e1311907acc}, File: {{.Datadir}}/keystore/zzz
|
||||
`)
|
||||
}
|
||||
}
|
||||
|
|
@ -75,7 +75,11 @@ Your new account is locked with a password. Please give a password. Do not forge
|
|||
Passphrase: {{.InputLine "foobar"}}
|
||||
Repeat passphrase: {{.InputLine "foobar"}}
|
||||
`)
|
||||
geth.expectRegexp(`Address: \{[0-9a-f]{40}\}\n`)
|
||||
if runtime.GOOS == "windows" {
|
||||
geth.expectRegexp(`Index: [0-9], Address: \{[0-9a-f]{40}\}, File: (.*)\\keystore\\[0-9a-zA-z-.]{77}\n`)
|
||||
} else {
|
||||
geth.expectRegexp(`Index: [0-9], Address: \{[0-9a-f]{40}\}, File: (.*)/keystore/[0-9a-zA-z-.]{77}\n`)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccountNewBadRepeat(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue