This commit is contained in:
Aleš Katona 2015-08-27 07:33:50 +00:00
commit 5af3de3328
2 changed files with 4 additions and 1 deletions

View file

@ -110,7 +110,7 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error)
return nil, shared.NewDecodeParamError(err.Error()) return nil, shared.NewDecodeParamError(err.Error())
} }
if len(args.Passphrase) == 0 { if !args.HasPW {
fe := self.xeth.Frontend() fe := self.xeth.Frontend()
if fe == nil { if fe == nil {
return false, fmt.Errorf("No password provided") return false, fmt.Errorf("No password provided")

View file

@ -47,6 +47,7 @@ func (args *NewAccountArgs) UnmarshalJSON(b []byte) (err error) {
type UnlockAccountArgs struct { type UnlockAccountArgs struct {
Address string Address string
Passphrase string Passphrase string
HasPW bool
Duration int Duration int
} }
@ -57,6 +58,7 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) {
} }
args.Duration = 0 args.Duration = 0
args.HasPW = false
if len(obj) < 1 { if len(obj) < 1 {
return shared.NewInsufficientParamsError(len(obj), 1) return shared.NewInsufficientParamsError(len(obj), 1)
@ -71,6 +73,7 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) {
if len(obj) >= 2 && obj[1] != nil { if len(obj) >= 2 && obj[1] != nil {
if passphrasestr, ok := obj[1].(string); ok { if passphrasestr, ok := obj[1].(string); ok {
args.Passphrase = passphrasestr args.Passphrase = passphrasestr
args.HasPW = true
} else { } else {
return shared.NewInvalidTypeError("passphrase", "not a string") return shared.NewInvalidTypeError("passphrase", "not a string")
} }