diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-05-23 20:17:46 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-05-23 20:17:46 +0800 |
commit | 7f515b0e88d864c8ef272c16ea51a1f17e3472d1 (patch) | |
tree | 45aa901ac6c44596859cf1c5731f5592a607d7cc /accounts/accounts_test.go | |
parent | b4dd3209b29870d58f5ba60831005ccdd9ea0f79 (diff) | |
parent | 64a6c2c1b6c81fddccc7d3d728b7a05c5814124b (diff) | |
download | go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.tar go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.tar.gz go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.tar.bz2 go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.tar.lz go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.tar.xz go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.tar.zst go-tangerine-7f515b0e88d864c8ef272c16ea51a1f17e3472d1.zip |
Merge pull request #2564 from bas-vk/submit-tx
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) |