diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-11-03 18:47:07 +0800 |
---|---|---|
committer | Jeffrey Wilcke <geffobscura@gmail.com> | 2015-11-03 18:47:07 +0800 |
commit | e5532154a50114d5ffb1ffd850b746cab00cb899 (patch) | |
tree | 0042cc997ccf4166b9b52464339d52d37d7a8ad6 /rpc/useragent | |
parent | 9666db2a442887ccf8ec2d81f5e2fedc1a3a3d3e (diff) | |
parent | f75becc264f8bde0f58391fc226243d03e78aa7b (diff) | |
download | go-tangerine-e5532154a50114d5ffb1ffd850b746cab00cb899.tar.gz go-tangerine-e5532154a50114d5ffb1ffd850b746cab00cb899.tar.zst go-tangerine-e5532154a50114d5ffb1ffd850b746cab00cb899.zip |
Merge branch 'release/1.3.0'
Conflicts:
VERSION
cmd/geth/main.go
Diffstat (limited to 'rpc/useragent')
-rw-r--r-- | rpc/useragent/remote_frontend.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/rpc/useragent/remote_frontend.go b/rpc/useragent/remote_frontend.go index 0dd4a6049..944ab287a 100644 --- a/rpc/useragent/remote_frontend.go +++ b/rpc/useragent/remote_frontend.go @@ -49,6 +49,31 @@ func (fe *RemoteFrontend) Enable() { fe.enabled = true } +func (fe *RemoteFrontend) AskPassword() (string, bool) { + if !fe.enabled { + return "", false + } + + err := fe.send(AskPasswordMethod) + if err != nil { + glog.V(logger.Error).Infof("Unable to send password request to agent - %v\n", err) + return "", false + } + + passwdRes, err := fe.recv() + if err != nil { + glog.V(logger.Error).Infof("Unable to recv password response from agent - %v\n", err) + return "", false + } + + if passwd, ok := passwdRes.Result.(string); ok { + return passwd, true + } + + return "", false + +} + // UnlockAccount asks the user agent for the user password and tries to unlock the account. // It will try 3 attempts before giving up. func (fe *RemoteFrontend) UnlockAccount(address []byte) bool { |