diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 073d294f..685522d3 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -110,6 +110,7 @@ var commandHandlers = map[string]*handlerData{ "setgenerate": {1, 1, displayGeneric, []conversionHandler{toBool, toInt}, makeSetGenerate, " [genproclimit]"}, "settxfee": {1, 0, displayGeneric, []conversionHandler{toSatoshi}, makeSetTxFee, ""}, "signmessage": {2, 2, displayGeneric, nil, makeSignMessage, "
"}, + "signrawtransaction": {1, 3, displayGeneric, nil, makeSignRawTransaction, " [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex,\"redeemScript\":hex},...] [,...] [sighashtype=\"ALL\"]"}, "stop": {0, 0, displayGeneric, nil, makeStop, ""}, "submitblock": {1, 1, displayGeneric, nil, makeSubmitBlock, " [jsonparametersobject]"}, "validateaddress": {1, 0, displayJSONDump, nil, makeValidateAddress, "
"}, @@ -768,6 +769,21 @@ func makeSignMessage(args []interface{}) (btcjson.Cmd, error) { args[1].(string)) } +// makeSignRawTransaction generates the cmd structure for signrawtransaction commands. +func makeSignRawTransaction(args []interface{}) (btcjson.Cmd, error) { + optArgs := make([]interface{}, 0, 3) + if len(args) > 1 { + optArgs = append(optArgs, args[1]) + } + if len(args) > 2 { + optArgs = append(optArgs, args[2]) + } + if len(args) > 3 { + optArgs = append(optArgs, args[3]) + } + return btcjson.NewSignRawTransactionCmd("btcctl", args[0].(string), optArgs...) +} + // makeStop generates the cmd structure for stop commands. func makeStop(args []interface{}) (btcjson.Cmd, error) { return btcjson.NewStopCmd("btcctl")