Add support for recent commands:

getrawchangeaddress and getbestblockhash.
This commit is contained in:
John C. Vernaleo 2013-10-11 13:18:55 -04:00
parent 5444d262b8
commit 7ad6d73416
2 changed files with 9 additions and 3 deletions

View file

@ -201,7 +201,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([
"getdifficulty", "getgenerate", "gethashespersec", "getinfo",
"getmininginfo", "getpeerinfo", "getrawmempool",
"keypoolrefill", "listaddressgroupings", "listlockunspent",
"stop", "walletlock":
"stop", "walletlock", "getbestblockhash":
if len(args) > 0 {
err = fmt.Errorf("Too many arguments for %s", message)
return finalMessage, err
@ -246,7 +246,8 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([
}
finalMessage, err = jsonWithArgs(message, id, args)
// One optional string
case "getmemorypool", "getnewaddress", "getwork", "help":
case "getmemorypool", "getnewaddress", "getwork", "help",
"getrawchangeaddress":
if len(args) > 1 {
err = fmt.Errorf("Too many arguments for %s", message)
return finalMessage, err
@ -798,7 +799,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
"getconnetioncount", "getdifficulty", "gethashespersec",
"setgenerate", "stop", "settxfee", "getaccount",
"getnewaddress", "sendtoaddress", "createrawtransaction",
"sendrawtransaction":
"sendrawtransaction", "getbestblockhash", "getrawchangeaddress":
err = json.Unmarshal(message, &result)
// For anything else put it in an interface. All the data is still
// there, just a little less convenient to deal with.

View file

@ -170,6 +170,11 @@ var cmdtests = []struct {
{"walletpassphrase", []interface{}{"test", 1}, true},
{"walletpassphrase", []interface{}{"test"}, false},
{"walletpassphrase", []interface{}{"test", "test"}, false},
{"getrawchangeaddress", []interface{}{}, true},
{"getrawchangeaddress", []interface{}{"something"}, true},
{"getrawchangeaddress", []interface{}{"something", "test"}, false},
{"getbestblockhash", []interface{}{}, true},
{"getbestblockhash", []interface{}{"something"}, false},
{"fakecommand", nil, false},
}