mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
* allow empty string passwords for unlocking account
This commit is contained in:
parent
abce09954b
commit
3127734208
2 changed files with 4 additions and 1 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue