Add support for ListSinceBlockResult
ok @davecgh
This commit is contained in:
parent
e6dca4de6f
commit
372e8c1926
3 changed files with 20 additions and 3 deletions
|
@ -279,6 +279,12 @@ type SignRawTransactionResult struct {
|
|||
Complete bool `json:"complete"`
|
||||
}
|
||||
|
||||
// ListSinceBlockResult models the data from the listsinceblock command.
|
||||
type ListSinceBlockResult struct {
|
||||
Transactions []ListTransactionsResult `json:"transactions"`
|
||||
LastBlock string `json:"lastblock"`
|
||||
}
|
||||
|
||||
// ListUnSpentResult models the data from the ListUnSpentResult command.
|
||||
type ListUnSpentResult struct {
|
||||
TxId string `json:"txid"`
|
||||
|
@ -489,6 +495,15 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
|
|||
if err == nil {
|
||||
result.Result = res
|
||||
}
|
||||
case "listsinceblock":
|
||||
var res ListSinceBlockResult
|
||||
err = json.Unmarshal(objmap["result"], &res)
|
||||
if err == nil {
|
||||
if res.Transactions == nil {
|
||||
res.Transactions = []ListTransactionsResult{}
|
||||
}
|
||||
result.Result = res
|
||||
}
|
||||
case "listtransactions":
|
||||
var res []ListTransactionsResult
|
||||
err = json.Unmarshal(objmap["result"], &res)
|
||||
|
|
|
@ -43,6 +43,8 @@ var resulttests = []struct {
|
|||
{"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true},
|
||||
{"getmininginfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||
{"getmininginfo", []byte(`{"error":null,"id":1,"result":{"generate":true}}`), false, true},
|
||||
{"listsinceblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false},
|
||||
{"listsinceblock", []byte(`{"error":null,"id":1,"result":{"lastblock":"something"}}`), false, true},
|
||||
{"validateaddress", []byte(`{"error":null,"id":1,"result":{"isvalid":false}}`), false, true},
|
||||
{"validateaddress", []byte(`{"error":null,"id":1,"result":{false}}`), false, false},
|
||||
{"signrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"something","complete":false}}`), false, true},
|
||||
|
|
|
@ -436,12 +436,12 @@ github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42
|
|||
github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 66.67% (8/12)
|
||||
github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6)
|
||||
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/jsoncmd.go GetBlockCmd.MarshalJSON 60.00% (6/10)
|
||||
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/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19)
|
||||
github.com/conformal/btcjson/jsonresults.go ReadResultCmd 57.25% (75/131)
|
||||
github.com/conformal/btcjson/jsonapi.go rpcRawCommand 53.33% (8/15)
|
||||
github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 50.00% (12/24)
|
||||
github.com/conformal/btcjson/cmdhelp.go GetHelpString 50.00% (3/6)
|
||||
|
@ -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.51% (2338/2978)
|
||||
github.com/conformal/btcjson --------------------------------------- 78.56% (2345/2985)
|
||||
|
||||
|
|
Loading…
Reference in a new issue