|
|
@ -180,11 +180,12 @@ Fatal: could not decrypt key with given password |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlag(t *testing.T) { |
|
|
|
func TestUnlockFlag(t *testing.T) { |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "js", "testdata/empty.js") |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "console", "--exec", "loadScript('testdata/empty.js')") |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 |
|
|
|
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
|
Password: {{.InputLine "foobar"}} |
|
|
|
Password: {{.InputLine "foobar"}} |
|
|
|
|
|
|
|
undefined |
|
|
|
`) |
|
|
|
`) |
|
|
|
geth.ExpectExit() |
|
|
|
geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
@ -201,7 +202,7 @@ Password: {{.InputLine "foobar"}} |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagWrongPassword(t *testing.T) { |
|
|
|
func TestUnlockFlagWrongPassword(t *testing.T) { |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "js", "testdata/empty.js") |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "console", "--exec", "loadScript('testdata/empty.js')") |
|
|
|
|
|
|
|
|
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
@ -219,7 +220,7 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could |
|
|
|
// https://github.com/ethereum/go-ethereum/issues/1785
|
|
|
|
// https://github.com/ethereum/go-ethereum/issues/1785
|
|
|
|
func TestUnlockFlagMultiIndex(t *testing.T) { |
|
|
|
func TestUnlockFlagMultiIndex(t *testing.T) { |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "0,2", "js", "testdata/empty.js") |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')") |
|
|
|
|
|
|
|
|
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
Unlocking account 0 | Attempt 1/3 |
|
|
|
Unlocking account 0 | Attempt 1/3 |
|
|
@ -227,6 +228,7 @@ Unlocking account 0 | Attempt 1/3 |
|
|
|
Password: {{.InputLine "foobar"}} |
|
|
|
Password: {{.InputLine "foobar"}} |
|
|
|
Unlocking account 2 | Attempt 1/3 |
|
|
|
Unlocking account 2 | Attempt 1/3 |
|
|
|
Password: {{.InputLine "foobar"}} |
|
|
|
Password: {{.InputLine "foobar"}} |
|
|
|
|
|
|
|
undefined |
|
|
|
`) |
|
|
|
`) |
|
|
|
geth.ExpectExit() |
|
|
|
geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
@ -244,8 +246,11 @@ Password: {{.InputLine "foobar"}} |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagPasswordFile(t *testing.T) { |
|
|
|
func TestUnlockFlagPasswordFile(t *testing.T) { |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", "testdata/passwords.txt", "--unlock", "0,2", "js", "testdata/empty.js") |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", "testdata/passwords.txt", "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
geth.Expect(` |
|
|
|
|
|
|
|
undefined |
|
|
|
|
|
|
|
`) |
|
|
|
geth.ExpectExit() |
|
|
|
geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
|
wantMessages := []string{ |
|
|
|
wantMessages := []string{ |
|
|
@ -275,7 +280,7 @@ func TestUnlockFlagAmbiguous(t *testing.T) { |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore", |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore", |
|
|
|
store, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", |
|
|
|
store, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", |
|
|
|
"js", "testdata/empty.js") |
|
|
|
"console", "--exec", "loadScript('testdata/empty.js')") |
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
|
// Helper for the expect template, returns absolute keystore path.
|
|
|
|
// Helper for the expect template, returns absolute keystore path.
|
|
|
@ -294,6 +299,7 @@ Testing your password against all of them... |
|
|
|
Your password unlocked keystore://{{keypath "1"}}
|
|
|
|
Your password unlocked keystore://{{keypath "1"}}
|
|
|
|
In order to avoid this warning, you need to remove the following duplicate key files: |
|
|
|
In order to avoid this warning, you need to remove the following duplicate key files: |
|
|
|
keystore://{{keypath "2"}}
|
|
|
|
keystore://{{keypath "2"}}
|
|
|
|
|
|
|
|
undefined |
|
|
|
`) |
|
|
|
`) |
|
|
|
geth.ExpectExit() |
|
|
|
geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
|