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