Add gettxout to btcctl.

This commit is contained in:
David Hill 2014-07-04 10:50:57 -04:00
parent 29a3bb6e69
commit 2e029b1c3d
2 changed files with 11 additions and 1 deletions

View file

@ -107,6 +107,7 @@ var rpcHandlersBeforeInit = map[string]commandHandler{
"getpeerinfo": handleGetPeerInfo,
"getrawmempool": handleGetRawMempool,
"getrawtransaction": handleGetRawTransaction,
"gettxout": handleUnimplemented,
"getwork": handleGetWork,
"help": handleHelp,
"ping": handlePing,
@ -142,7 +143,6 @@ var rpcAskWallet = map[string]struct{}{
"getreceivedbyaccount": struct{}{},
"getreceivedbyaddress": struct{}{},
"gettransaction": struct{}{},
"gettxout": struct{}{},
"gettxoutsetinfo": struct{}{},
"getunconfirmedbalance": struct{}{},
"getwalletinfo": struct{}{},

View file

@ -85,6 +85,7 @@ var commandHandlers = map[string]*handlerData{
"getreceivedbyaccount": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAccount, "<account> [minconf=1]"},
"getreceivedbyaddress": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAddress, "<address> [minconf=1]"},
"gettransaction": {1, 1, displayJSONDump, nil, makeGetTransaction, "txid"},
"gettxout": {2, 1, displayJSONDump, []conversionHandler{nil, toInt, toBool}, makeGetTxOut, "<txid> <n> [includemempool=false]"},
"gettxoutsetinfo": {0, 0, displayJSONDump, nil, makeGetTxOutSetInfo, ""},
"getwork": {0, 1, displayJSONDump, nil, makeGetWork, "[data]"},
"help": {0, 1, displayGeneric, nil, makeHelp, "[commandName]"},
@ -506,6 +507,15 @@ func makeGetTransaction(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewGetTransactionCmd("btcctl", args[0].(string))
}
// makeGetTxOut generates the cmd structure for gettxout commands.
func makeGetTxOut(args []interface{}) (btcjson.Cmd, error) {
opt := make([]bool, 0, 1)
if len(args) > 2 {
opt = append(opt, args[2].(bool))
}
return btcjson.NewGetTxOutCmd("btcctl", args[0].(string), args[1].(int), opt...)
}
// makeGetTxOutSetInfo generates the cmd structure for gettxoutsetinfo commands.
func makeGetTxOutSetInfo(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewGetTxOutSetInfoCmd("btcctl")