diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-14 07:25:33 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-08-14 07:25:33 +0800 |
commit | 28b14d3e6d43cb27019e21d0a93a80e7bee1de8c (patch) | |
tree | 9995026e87221a80cb5171364ffa734459c16b16 /rpc/api/personal.go | |
parent | 73c4e6005c3e47342a4631955ca6fd2782925886 (diff) | |
parent | f9cbd16f27e393d4937354ee31435e0a2f689484 (diff) | |
download | go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.gz go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.bz2 go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.lz go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.xz go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.tar.zst go-tangerine-28b14d3e6d43cb27019e21d0a93a80e7bee1de8c.zip |
Merge pull request #1635 from bas-vk/useragent
support for user agents
Diffstat (limited to 'rpc/api/personal.go')
-rw-r--r-- | rpc/api/personal.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/rpc/api/personal.go b/rpc/api/personal.go index e9942c1e5..6c73ac83d 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -17,6 +17,7 @@ package api import ( + "fmt" "time" "github.com/ethereum/go-ethereum/common" @@ -125,18 +126,17 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) return nil, shared.NewDecodeParamError(err.Error()) } - var err error + if len(args.Passphrase) == 0 { + fe := self.xeth.Frontend() + if fe == nil { + return false, fmt.Errorf("No password provided") + } + return fe.UnlockAccount(common.HexToAddress(args.Address).Bytes()), nil + } + am := self.ethereum.AccountManager() addr := common.HexToAddress(args.Address) - if args.Duration == -1 { - err = am.Unlock(addr, args.Passphrase) - } else { - err = am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) - } - - if err == nil { - return true, nil - } - return false, err + err := am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) + return err == nil, err } |