Add decodescript support to btcctl.

This commit is contained in:
Dave Collins 2014-01-03 23:30:08 -06:00
parent 47a78ea5c2
commit 4cb1500a0b

View file

@ -48,6 +48,7 @@ var commandHandlers = map[string]*handlerData{
"createrawtransaction": &handlerData{2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""}, "createrawtransaction": &handlerData{2, 0, displayGeneric, nil, makeCreateRawTransaction, "\"[{\"txid\":\"id\",\"vout\":n},...]\" \"{\"address\":amount,...}\""},
"debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"}, "debuglevel": &handlerData{1, 0, displayGeneric, nil, makeDebugLevel, "<levelspec>"},
"decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"}, "decoderawtransaction": &handlerData{1, 0, displayJSONDump, nil, makeDecodeRawTransaction, "<txhash>"},
"decodescript": &handlerData{1, 0, displayJSONDump, nil, makeDecodeScript, "<hex>"},
"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>"},
@ -187,6 +188,11 @@ func makeDecodeRawTransaction(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewDecodeRawTransactionCmd("btcctl", args[0].(string)) return btcjson.NewDecodeRawTransactionCmd("btcctl", args[0].(string))
} }
// makeDecodeScript generates the cmd structure for decodescript comands.
func makeDecodeScript(args []interface{}) (btcjson.Cmd, error) {
return btcjson.NewDecodeScriptCmd("btcctl", args[0].(string))
}
// makeDumpPrivKey generates the cmd structure for // makeDumpPrivKey generates the cmd structure for
// dumpprivkey commands. // dumpprivkey commands.
func makeDumpPrivKey(args []interface{}) (btcjson.Cmd, error) { func makeDumpPrivKey(args []interface{}) (btcjson.Cmd, error) {