[release/1.4.5] eth: add new RPC method (personal.) SignAndSendTransaction

(cherry picked from commit 64a6c2c1b6)

Conflicts:
	cmd/geth/js.go
	internal/web3ext/web3ext.go
This commit is contained in:
Bas van Kervel
2016-05-12 19:32:04 +02:00
committed by Jeffrey Wilcke
parent 4c6953606e
commit b950a2977c
6 changed files with 207 additions and 99 deletions

View File

@ -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)