Correctly parse account name for getnewaddress
This commit is contained in:
parent
9cc6600db2
commit
8163227225
1 changed files with 9 additions and 5 deletions
14
cmdmgr.go
14
cmdmgr.go
|
@ -310,16 +310,20 @@ func GetBalance(reply chan []byte, msg *btcjson.Message) {
|
|||
// the requested wallet does not exist, a JSON error will be returned to
|
||||
// the client.
|
||||
func GetNewAddress(reply chan []byte, msg *btcjson.Message) {
|
||||
e := InvalidParams
|
||||
params, ok := msg.Params.([]interface{})
|
||||
if !ok {
|
||||
log.Error("GetNewAddress: Cannot parse parameters.")
|
||||
ReplyError(reply, msg.Id, &e)
|
||||
return
|
||||
}
|
||||
var wname string
|
||||
if len(params) == 0 || params[0].(string) == "" {
|
||||
wname = ""
|
||||
} else {
|
||||
wname = "params[0].(string)"
|
||||
if len(params) > 0 {
|
||||
var ok bool
|
||||
if wname, ok = params[0].(string); !ok {
|
||||
e.Message = "account is not a string"
|
||||
ReplyError(reply, msg.Id, &e)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
wallets.RLock()
|
||||
|
|
Loading…
Reference in a new issue