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 requested wallet does not exist, a JSON error will be returned to
|
||||||
// the client.
|
// the client.
|
||||||
func GetNewAddress(reply chan []byte, msg *btcjson.Message) {
|
func GetNewAddress(reply chan []byte, msg *btcjson.Message) {
|
||||||
|
e := InvalidParams
|
||||||
params, ok := msg.Params.([]interface{})
|
params, ok := msg.Params.([]interface{})
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error("GetNewAddress: Cannot parse parameters.")
|
ReplyError(reply, msg.Id, &e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var wname string
|
var wname string
|
||||||
if len(params) == 0 || params[0].(string) == "" {
|
if len(params) > 0 {
|
||||||
wname = ""
|
var ok bool
|
||||||
} else {
|
if wname, ok = params[0].(string); !ok {
|
||||||
wname = "params[0].(string)"
|
e.Message = "account is not a string"
|
||||||
|
ReplyError(reply, msg.Id, &e)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wallets.RLock()
|
wallets.RLock()
|
||||||
|
|
Loading…
Reference in a new issue