diff --git a/rpcserver.go b/rpcserver.go index a64f390f..c328fb02 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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{}{}, diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 87ffc7da..c6e3934a 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -85,6 +85,7 @@ var commandHandlers = map[string]*handlerData{ "getreceivedbyaccount": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAccount, " [minconf=1]"}, "getreceivedbyaddress": {1, 1, displayGeneric, []conversionHandler{nil, toInt}, makeGetReceivedByAddress, "
[minconf=1]"}, "gettransaction": {1, 1, displayJSONDump, nil, makeGetTransaction, "txid"}, + "gettxout": {2, 1, displayJSONDump, []conversionHandler{nil, toInt, toBool}, makeGetTxOut, " [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")