diff --git a/rpc/api/personal.go b/rpc/api/personal.go index 1b0dea330a..dd2aac2365 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -110,7 +110,7 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) return nil, shared.NewDecodeParamError(err.Error()) } - if len(args.Passphrase) == 0 { + if !args.HasPW { fe := self.xeth.Frontend() if fe == nil { return false, fmt.Errorf("No password provided") diff --git a/rpc/api/personal_args.go b/rpc/api/personal_args.go index 89419029bd..fac9deebf6 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -47,6 +47,7 @@ func (args *NewAccountArgs) UnmarshalJSON(b []byte) (err error) { type UnlockAccountArgs struct { Address string Passphrase string + HasPW bool Duration int } @@ -57,6 +58,7 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { } args.Duration = 0 + args.HasPW = false if 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 passphrasestr, ok := obj[1].(string); ok { args.Passphrase = passphrasestr + args.HasPW = true } else { return shared.NewInvalidTypeError("passphrase", "not a string") }