Add support for decodescript concrete result.

This commit is contained in:
David Hill 2014-04-12 10:41:32 -04:00
parent 0ca3d386ed
commit ea7947f74e
3 changed files with 10 additions and 2 deletions

View file

@ -350,6 +350,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
if err == nil {
result.Result = res
}
case "decodescript":
var res DecodeScriptResult
err = json.Unmarshal(objmap["result"], &res)
if err == nil {
result.Result = res
}
case "getaddednodeinfo":
// getaddednodeinfo can either return a JSON object or a
// slice of strings depending on the verbose flag. Choose the

View file

@ -28,6 +28,8 @@ var resulttests = []struct {
{"anycommand", []byte(`{"error":null,"result":null,"id":"test"}`), false, true},
{"createmultisig", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
{"createmultisig", []byte(`{"error":null,"id":1,"result":{"address":"something","redeemScript":"else"}}`), false, true},
{"decodescript", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
{"decodescript", []byte(`{"error":null,"id":1,"result":{"Asm":"something"}}`), false, true},
{"getinfo", []byte(`{"error":null,"result":null,"id":"test"}`), false, true},
{"getinfo", []byte(`{"error":null,"result":null}`), false, false},
{"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},

View file

@ -439,8 +439,8 @@ github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3)
github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 63.64% (7/11)
github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16)
github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13)
github.com/conformal/btcjson/jsonresults.go ReadResultCmd 59.12% (81/137)
github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22)
github.com/conformal/btcjson/jsonresults.go ReadResultCmd 58.62% (85/145)
github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19)
github.com/conformal/btcjson/jsonapi.go rpcRawCommand 53.33% (8/15)
github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 50.00% (12/24)
@ -462,5 +462,5 @@ github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1)
github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1)
github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1)
github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1)
github.com/conformal/btcjson --------------------------------------- 78.56% (2345/2985)
github.com/conformal/btcjson --------------------------------------- 78.48% (2349/2993)