Add getaddednodeinfo support to btcctl.

This commit is contained in:
Dave Collins 2014-01-24 14:10:13 -06:00
parent dcef4128b8
commit fea4109eb2

View file

@ -52,6 +52,7 @@ var commandHandlers = map[string]*handlerData{
"dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, "<bitcoinaddress>"}, "dumpprivkey": &handlerData{1, 0, displayGeneric, nil, makeDumpPrivKey, "<bitcoinaddress>"},
"getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "<address>"}, "getaccount": &handlerData{1, 0, displayGeneric, nil, makeGetAccount, "<address>"},
"getaccountaddress": &handlerData{1, 0, displayGeneric, nil, makeGetAccountAddress, "<account>"}, "getaccountaddress": &handlerData{1, 0, displayGeneric, nil, makeGetAccountAddress, "<account>"},
"getaddednodeinfo": &handlerData{1, 1, displayJSONDump, []conversionHandler{toBool, nil}, makeGetAddedNodeInfo, "<dns> [node]"},
"getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"}, "getbalance": &handlerData{0, 2, displayGeneric, []conversionHandler{nil, toInt}, makeGetBalance, "[account] [minconf=1]"},
"getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""}, "getbestblockhash": &handlerData{0, 0, displayGeneric, nil, makeGetBestBlockHash, ""},
"getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, "<blockhash>"}, "getblock": &handlerData{1, 2, displayJSONDump, []conversionHandler{nil, toBool, toBool}, makeGetBlock, "<blockhash>"},
@ -217,6 +218,24 @@ func makeGetAccountAddress(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewGetAccountAddressCmd("btcctl", args[0].(string)) return btcjson.NewGetAccountAddressCmd("btcctl", args[0].(string))
} }
// makeGetAddedNodeInfo generates the cmd structure for
// getaccountaddress commands.
func makeGetAddedNodeInfo(args []interface{}) (btcjson.Cmd, error) {
// Create the getaddednodeinfo command with defaults for the optional
// parameters.
cmd, err := btcjson.NewGetAddedNodeInfoCmd("btcctl", args[0].(bool))
if err != nil {
return nil, err
}
// Override the optional parameter if it was specified.
if len(args) > 1 {
cmd.Node = args[1].(string)
}
return cmd, nil
}
// makeGetBalance generates the cmd structure for // makeGetBalance generates the cmd structure for
// getbalance commands. // getbalance commands.
func makeGetBalance(args []interface{}) (btcjson.Cmd, error) { func makeGetBalance(args []interface{}) (btcjson.Cmd, error) {