From 31277342083fcf6c0670b0b2595d609c0ad974d3 Mon Sep 17 00:00:00 2001 From: Ales Katona Date: Tue, 25 Aug 2015 18:24:42 -0600 Subject: [PATCH] * allow empty string passwords for unlocking account --- rpc/api/personal.go | 2 +- rpc/api/personal_args.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rpc/api/personal.go b/rpc/api/personal.go index 6c73ac83df..3dfe2730b0 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -126,7 +126,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 5a584fb0ce..f434953ccf 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -77,6 +77,7 @@ func (args *DeleteAccountArgs) UnmarshalJSON(b []byte) (err error) { type UnlockAccountArgs struct { Address string Passphrase string + HasPW bool Duration int } @@ -87,6 +88,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) @@ -101,6 +103,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") }