addmultisigaddress support for btcctl

This commit is contained in:
David Hill 2014-04-07 14:45:42 -04:00
parent 1b56cb291f
commit 384a535f49

View file

@ -46,6 +46,7 @@ var (
// commandHandlers is a map of commands and associated handler data that is used
// to validate correctness and perform the command.
var commandHandlers = map[string]*handlerData{
"addmultisigaddress": {2, 1, displayGeneric, []conversionHandler{toInt, nil, nil}, makeAddMultiSigAddress, "<numrequired> <[\"pubkey\",...]> [account]"},
"addnode": {2, 0, displayJSONDump, nil, makeAddNode, "<ip> <add/remove/onetry>"},
"createencryptedwallet": {1, 0, displayGeneric, nil, makeCreateEncryptedWallet, "<passphrase>"},
"createrawtransaction": {2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""},
@ -199,6 +200,20 @@ func displayJSONDump(reply interface{}) error {
return nil
}
// makeAddMultiSigAddress generates the cmd structure for addmultisigaddress commands.
func makeAddMultiSigAddress(args []interface{}) (btcjson.Cmd, error) {
var pubkeys []string
err := json.Unmarshal([]byte(args[1].(string)), &pubkeys)
if err != nil {
return nil, err
}
var opt string
if len(args) > 2 {
opt = args[2].(string)
}
return btcjson.NewAddMultisigAddressCmd("btcctl", args[0].(int), pubkeys, opt)
}
// makeAddNode generates the cmd structure for addnode commands.
func makeAddNode(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewAddNodeCmd("btcctl", args[0].(string),