diff options
Diffstat (limited to 'rpc/api/personal_args.go')
-rw-r--r-- | rpc/api/personal_args.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/rpc/api/personal_args.go b/rpc/api/personal_args.go index 73dc6285e..5d215c71d 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -23,7 +23,7 @@ import ( ) type NewAccountArgs struct { - Passphrase string + Passphrase *string } func (args *NewAccountArgs) UnmarshalJSON(b []byte) (err error) { @@ -32,16 +32,15 @@ func (args *NewAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewDecodeParamError(err.Error()) } - if len(obj) < 1 { - return shared.NewInsufficientParamsError(len(obj), 1) - } - - if passhrase, ok := obj[0].(string); ok { - args.Passphrase = passhrase - return nil + if len(obj) >= 1 && obj[0] != nil { + if passphrasestr, ok := obj[0].(string); ok { + args.Passphrase = &passphrasestr + } else { + return shared.NewInvalidTypeError("passphrase", "not a string") + } } - return shared.NewInvalidTypeError("passhrase", "not a string") + return nil } type UnlockAccountArgs struct { |