diff options
author | Bas van Kervel <bas@ethdev.com> | 2016-05-13 01:32:04 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2016-05-20 21:54:18 +0800 |
commit | 64a6c2c1b6c81fddccc7d3d728b7a05c5814124b (patch) | |
tree | 05d6c04a1c5eeb5746425b3d7e691ee071f66c0e /accounts/accounts_test.go | |
parent | e798e4fd750745cec99c5a531e42998d9a7be85e (diff) | |
download | dexon-64a6c2c1b6c81fddccc7d3d728b7a05c5814124b.tar.gz dexon-64a6c2c1b6c81fddccc7d3d728b7a05c5814124b.tar.zst dexon-64a6c2c1b6c81fddccc7d3d728b7a05c5814124b.zip |
eth: add new RPC method (personal.) SignAndSendTransaction
Diffstat (limited to 'accounts/accounts_test.go')
-rw-r--r-- | accounts/accounts_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/accounts/accounts_test.go b/accounts/accounts_test.go index 829cf3968..2e5f2b44a 100644 --- a/accounts/accounts_test.go +++ b/accounts/accounts_test.go @@ -81,6 +81,34 @@ func TestSign(t *testing.T) { } } +func TestSignWithPassphrase(t *testing.T) { + dir, am := tmpManager(t, true) + defer os.RemoveAll(dir) + + pass := "passwd" + acc, err := am.NewAccount(pass) + if err != nil { + t.Fatal(err) + } + + if _, unlocked := am.unlocked[acc.Address]; unlocked { + t.Fatal("expected account to be locked") + } + + _, err = am.SignWithPassphrase(acc.Address, pass, testSigData) + if err != nil { + t.Fatal(err) + } + + if _, unlocked := am.unlocked[acc.Address]; unlocked { + t.Fatal("expected account to be locked") + } + + if _, err = am.SignWithPassphrase(acc.Address, "invalid passwd", testSigData); err == nil { + t.Fatal("expected SignHash to fail with invalid password") + } +} + func TestTimedUnlock(t *testing.T) { dir, am := tmpManager(t, true) defer os.RemoveAll(dir) |