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_args.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_args.go')
-rw-r--r-- | rpc/api/personal_args.go | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/rpc/api/personal_args.go b/rpc/api/personal_args.go index 7f00701e3..5a584fb0c 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -86,10 +86,10 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewDecodeParamError(err.Error()) } - args.Duration = -1 + args.Duration = 0 - if len(obj) < 2 { - return shared.NewInsufficientParamsError(len(obj), 2) + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) } if addrstr, ok := obj[0].(string); ok { @@ -98,10 +98,18 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewInvalidTypeError("address", "not a string") } - if passphrasestr, ok := obj[1].(string); ok { - args.Passphrase = passphrasestr - } else { - return shared.NewInvalidTypeError("passphrase", "not a string") + if len(obj) >= 2 && obj[1] != nil { + if passphrasestr, ok := obj[1].(string); ok { + args.Passphrase = passphrasestr + } else { + return shared.NewInvalidTypeError("passphrase", "not a string") + } + } + + if len(obj) >= 3 && obj[2] != nil { + if duration, ok := obj[2].(float64); ok { + args.Duration = int(duration) + } } return nil |