From d5f4e5e989e2b315a5c04300fa6c8fd191f5f5be Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 10 May 2013 15:06:18 -0500 Subject: [PATCH 001/229] Initial commit. --- .gitignore | 33 +++++++++++++++++++++++++++++++++ README.md | 4 ++++ 2 files changed, 37 insertions(+) create mode 100644 .gitignore create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..16e35934 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +# Temp files +*~ + +# Databases +btcd.db +*-shm +*-wal + +# Log files +*.log + +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/README.md b/README.md new file mode 100644 index 00000000..e0e15b39 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +btcjson +======= + +Package btcjson implements the bitcoin JSON-RPC API. From d0d58c54db28d1a84bcc9b8effd985f59135972c Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 10 May 2013 16:16:18 -0400 Subject: [PATCH 002/229] Initial implementation. --- LICENSE | 13 + README.md | 83 +++++- cov_report.sh | 17 ++ doc.go | 88 ++++++ internal_test.go | 87 ++++++ jsonapi.go | 725 ++++++++++++++++++++++++++++++++++++++++++++++ jsonapi_test.go | 245 ++++++++++++++++ jsonfxns.go | 54 ++++ test_coverage.txt | 10 + 9 files changed, 1321 insertions(+), 1 deletion(-) create mode 100644 LICENSE create mode 100644 cov_report.sh create mode 100644 doc.go create mode 100644 internal_test.go create mode 100644 jsonapi.go create mode 100644 jsonapi_test.go create mode 100644 jsonfxns.go create mode 100644 test_coverage.txt diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..0d760cbb --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2013 Conformal Systems LLC. + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index e0e15b39..8f9bf58d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,85 @@ btcjson ======= -Package btcjson implements the bitcoin JSON-RPC API. +Package btcjson implements the bitcoin JSON-RPC API. There is a test +suite which is aiming to reach 100% code coverage. See +`test_coverage.txt` for the current coverage (using gocov). On a +UNIX-like OS, the script `cov_report.sh` can be used to generate the +report. Package btcjson is licensed under the liberal ISC license. + +This package is one of the core packages from btcd, an alternative full-node +implementation of bitcoin which is under active development by Conformal. +Although it was primarily written for btcd, this package has intentionally been +designed so it can be used as a standalone package for any projects needing to +communicate with a bitcoin client using the json rpc interface. +[BlockSafari](http://blocksafari.com) is one such program that uses +btcjson to communicate with btcd (or bitcoind to help test btcd). + +## JSON RPC + +Bitcoin provides an extensive API call list to control bitcoind or +bitcoin-qt through json-rpc. These can be used to get information +from the client or to cause the client to perform some action. + +The general form of the commands are: + +```JSON + {"jsonrpc": "1.0", "id":"test", "method": "getinfo", "params": []} +``` + +btcjson provides code to easily create these commands from go (as some +of the commands can be fairly complex), to send the commands to a +running bitcoin rpc server, and to handle the replies (putting them in +useful Go data structures). + +## Sample Use + +```Go + msg, err := btcjson.CreateMessage("getinfo") + reply, err := btcjson.RpcCommand(user, password, server, msg) +``` + +## Documentation + +Full `go doc` style documentation for the project can be viewed online without +installing this package by using the GoDoc site +[here](http://godoc.org/github.com/conformal/btcjson). + +You can also view the documentation locally once the package is installed with +the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to +http://localhost:6060/pkg/github.com/conformal/btcjson + +## Installation + +```bash +$ go get github.com/conformal/btcjson +``` + +## TODO + +- Add data structures for remaining commands. +- Increase test coverage to 100% + +## GPG Verification Key + +All official release tags are signed by Conformal so users can ensure the code +has not been tampered with and is coming from Conformal. To verify the +signature perform the following: + +- Download the public key from the Conformal website at + https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt + +- Import the public key into your GPG keyring: + ```bash + gpg --import GIT-GPG-KEY-conformal.txt + ``` + +- Verify the release tag with the following command where `TAG_NAME` is a + placeholder for the specific tag: + ```bash + git tag -v TAG_NAME + ``` + +## License + +Package btcjson is licensed under the liberal ISC License. diff --git a/cov_report.sh b/cov_report.sh new file mode 100644 index 00000000..307f05b7 --- /dev/null +++ b/cov_report.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# This script uses gocov to generate a test coverage report. +# The gocov tool my be obtained with the following command: +# go get github.com/axw/gocov/gocov +# +# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. + +# Check for gocov. +type gocov >/dev/null 2>&1 +if [ $? -ne 0 ]; then + echo >&2 "This script requires the gocov tool." + echo >&2 "You may obtain it with the following command:" + echo >&2 "go get github.com/axw/gocov/gocov" + exit 1 +fi +gocov test | gocov report diff --git a/doc.go b/doc.go new file mode 100644 index 00000000..767cc46e --- /dev/null +++ b/doc.go @@ -0,0 +1,88 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +/* +Package btcjson implements the bitcoin JSON-RPC API. + +A complete description of the JSON-RPC protocol as used by bitcoin can +be found on the official wiki at +https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29 with a list of +all the supported calls at +https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list. + +This package provides data structures and code for marshalling and +unmarshalling json for communicating with a running instance of btcd +or bitcoind/bitcoin-qt. It also provides code for sending those +message. It does not provide any code for the client to actually deal +with the messages. Although it is meant primarily for btcd, it is +possible to use this code elsewhere for interacting with a bitcoin +client programatically. + +Protocol + +All messages to bitcoin are of the form: + + {"jsonrpc":"1.0","id":"SOMEID","method":"SOMEMETHOD","params":SOMEPARAMS} + +The params field can vary in what it contains depending on the +different method (or command) being sent. + +Replies will vary in form for the different commands. The basic form is: + + {"result":SOMETHING,"error":null,"id":"btcd"} + +The result field can be as simple as an int, or a complex structure +containing many nested fields. For cases where we have already worked +out the possible types of reply, result is unmarshalled into a +structure that matches the command. For others, an interface is +returned. An interface is not as convenient as one needs to do a type +assertion first before using the value, but it means we can handle +arbitrary replies. + +The error field is null when there is no error. When there is an +error it will return a numeric error code as well as a message +describing the error. + +id is simply the id of the requester. + +Usage + +To use this package, check it out from github: + + go get github.com/conformal/btcjson + +Import it as usual: + + import "github.com/conformal/btcjson" + +Generate the message you want (see the full list on the official bitcoin wiki): + + msg, err := btcjson.CreateMessage("getinfo") + +And then send the message: + + reply, err := btcjson.RpcCommand(user, password, server, msg) + +Since rpc calls must be authenticated, RpcCommand requires a +username and password along with the address of the server. For +details, see the documentation for your bitcoin implementation. + +For convenience, this can be set for bitcoind by setting rpcuser and +rpcpassword in the file ~/.bitcoin/bitcoin.conf with a default local +address of: 127.0.0.1:8332 + +For commands where the reply structure is known (such as getblock), +one can directly access the fields in the Reply structure. For other +commands, the reply uses an interface so one can access individual +items like: + + if reply.Result != nil { + info := reply.Result.(map[string]interface{}) + balance, ok := info["balance"].(float64) + } + +(with appropriate error checking at all steps of course). + +*/ +package btcjson diff --git a/internal_test.go b/internal_test.go new file mode 100644 index 00000000..fe3649d3 --- /dev/null +++ b/internal_test.go @@ -0,0 +1,87 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "bytes" + "encoding/json" + "testing" +) + +/* +This test file is part of the btcjson package rather than than the +btcjson_test package so it can bridge access to the internals to properly test +cases which are either not possible or can't reliably be tested via the public +interface. The functions are only exported while the tests are being run. +*/ + +// TestReadResultCmd tests that readResultCmd can properly unmarshall the +// returned []byte that contains a json reply for both known and unknown +// messages. +func TestReadResultCmd(t *testing.T) { + // Generate a fake message to make sure we can encode and decode it and + // get the same thing back. + msg := []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`) + result, err := readResultCmd("getblockcount", msg) + if err != nil { + t.Errorf("Reading json reply to struct failed. %v", err) + } + msg2, err := json.Marshal(result) + if err != nil { + t.Errorf("Converting struct back to json bytes failed. %v", err) + } + if bytes.Compare(msg, msg2) != 0 { + t.Errorf("json byte arrays differ.") + } + // Generate a fake message to make sure we don't make a command from it. + msg = []byte(`{"result":"test","id":1}`) + _, err = readResultCmd("anycommand", msg) + if err == nil { + t.Errorf("Incorrect json accepted.") + } + return +} + +// TestJsonWIthArgs tests jsonWithArgs to ensure that it can generate a json +// command as well as sending it something that cannot be marshalled to json +// (a channel) to test the failure paths. +func TestJsonWithArgs(t *testing.T) { + cmd := "list" + var args interface{} + _, err := jsonWithArgs(cmd, args) + if err != nil { + t.Errorf("Could not make json with no args. %v", err) + } + + channel := make(chan int) + _, err = jsonWithArgs(cmd, channel) + if _, ok := err.(*json.UnsupportedTypeError); !ok { + t.Errorf("Message with channel should fail. %v", err) + } + + var comp complex128 + _, err = jsonWithArgs(cmd, comp) + if _, ok := err.(*json.UnsupportedTypeError); !ok { + t.Errorf("Message with complex part should fail. %v", err) + } + + return +} + +// TestJsonRpcSend tests jsonRpcSend which actually send the rpc command. +// This currently a negative test only until we setup a fake http server to +// test the actually connection code. +func TestJsonRpcSend(t *testing.T) { + // Just negative test right now. + user := "something" + password := "something" + server := "invalid" + var message []byte + _, err := jsonRpcSend(user, password, server, message) + if err == nil { + t.Errorf("Should fail when it cannot connect.") + } + return +} diff --git a/jsonapi.go b/jsonapi.go new file mode 100644 index 00000000..2f7b0a06 --- /dev/null +++ b/jsonapi.go @@ -0,0 +1,725 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "encoding/json" + "fmt" +) + +// Message contains a message to be sent to the bitcoin client. +type Message struct { + Jsonrpc string `json:"jsonrpc"` + Id string `json:"id"` + Method string `json:"method"` + Params interface{} `json:"params"` +} + +// Reply is the general form of the reply from the bitcoin client. +// The form of the Result part varies from one command to the next so it +// is currently implimented as an interface. +type Reply struct { + Result interface{} `json:"result"` + Error *Error `json:"error"` + // This has to be a pointer for go to put a null in it when empty. + Id *string `json:"id"` +} + +// InfoResult contains the data returned by the getinfo command. +type InfoResult struct { + Version int `json:"version,omitempty"` + ProtocolVersion int `json:"protocolversion,omitempty"` + WalletVersion int `json:"walletversion,omitempty"` + Balance float64 `json:"balance,omitempty"` + Blocks int `json:"blocks,omitempty"` + Connections int `json:"connections,omitempty"` + Proxy string `json:"proxy,omitempty"` + Difficulty float64 `json:"difficulty,omitempty"` + TestNet bool `json:"testnet,omitempty"` + KeypoolOldest int64 `json:"keypoololdest,omitempty"` + KeypoolSize int `json:"keypoolsize,omitempty"` + PaytxFee float64 `json:"paytxfee,omitempty"` + Errors string `json:"errors,omitempty"` +} + +// BlockResult models the data from the getblock command. +type BlockResult struct { + Hash string `json:"hash"` + Confirmations uint64 `json:"confirmations"` + Size int `json:"size"` + Height int64 `json:"height"` + Version uint32 `json:"version"` + MerkleRoot string `json:"merkleroot"` + Tx []string `json:"tx"` + Time int64 `json:"time"` + Nonce uint32 `json:"nonce"` + Bits string `json:"bits"` + Difficulty float64 `json:"difficulty"` + PreviousHash string `json:"previousblockhash"` + NextHash string `json:"nextblockhash"` +} + +// TxRawResult models the data from the getrawtransaction command. +type TxRawResult struct { + Hex string `json:"hex"` + Txid string `json:"txid"` + Version uint32 `json:"version"` + LockTime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` + BlockHash string `json:"blockhash"` + Confirmations uint64 `json:"confirmations"` + Time int64 `json:"time"` + Blocktime int64 `json:"blocktime"` +} + +// TxRawDecodeResult models the data from the decoderawtransaction command. +type TxRawDecodeResult struct { + Txid string `json:"txid"` + Version uint32 `json:"version"` + Locktime int `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` +} + +// Vin models parts of the tx data. It is defined seperately since both +// getrawtransaction and decoderawtransaction use the same structure. +type Vin struct { + Coinbase string `json:"coinbase,omitempty"` + Vout int `json:"vout,omitempty"` + ScriptSig struct { + Txid string `json:"txid"` + Asm string `json:"asm"` + Hex string `json:"hex"` + } `json:"scriptSig,omitempty"` + Sequence float64 `json:"sequence"` +} + +// Vout models parts of the tx data. It is defined seperately since both +// getrawtransaction and decoderawtransaction use the same structure. +type Vout struct { + Value float64 `json:"value"` + N int `json:"n"` + ScriptPubKey struct { + Asm string `json:"asm"` + Hex string `json:"hex"` + ReqSig int `json:"reqSig"` + Type string `json:"type"` + Addresses []string `json:"addresses"` + } `json:"scriptPubKey"` +} + +// Error models the error field of the json returned by a bitcoin client. When +// there is no error, this should be a nil pointer to produce the null in the +// json that bitcoind produces. +type Error struct { + Code int `json:"code,omitempty"` + Message string `json:"message,omitempty"` +} + +// jsonWithArgs takes a command and an interface which contains an array +// of the arguments for that command. It knows NOTHING about the commands so +// all error checking of the arguments must happen before it is called. +func jsonWithArgs(command string, args interface{}) ([]byte, error) { + rawMessage := Message{"1.0", "btcd", command, args} + finalMessage, err := json.Marshal(rawMessage) + if err != nil { + return nil, err + } + return finalMessage, nil +} + +// CreateMessage takes a string and the optional arguments for it. Then, +// if it is a recognized bitcoin json message, generates the json message ready +// to send off to the daemon or server. +// It is capable of handeling all of the commands from the standard client, +// described at: +// https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list +func CreateMessage(message string, args ...interface{}) ([]byte, error) { + var finalMessage []byte + var err error + // Different commands have different required and optional arguments. + // Need to handle them based on that. + switch message { + // No args + case "getblockcount", "getblocknumber", "getconnectioncount", + "getdifficulty", "getgenerate", "gethashespersec", "getinfo", + "getmininginfo", "getpeerinfo", "getrawmempool", + "keypoolrefill", "listaddressgroupings", "listlockunspent", + "stop", "walletlock": + if len(args) > 0 { + err = fmt.Errorf("Too many arguments for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One optional int + case "listaccounts": + if len(args) > 1 { + err = fmt.Errorf("Too many arguments for %s", message) + return finalMessage, err + } + if len(args) == 1 { + _, ok := args[0].(int) + if !ok { + err = fmt.Errorf("Argument must be int for %s", message) + return finalMessage, err + } + } + finalMessage, err = jsonWithArgs(message, args) + // One required int + case "getblockhash": + if len(args) != 1 { + err = fmt.Errorf("Missing argument for %s", message) + return finalMessage, err + } + _, ok := args[0].(int) + if !ok { + err = fmt.Errorf("Argument must be int for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One required float + case "settxfee": + if len(args) != 1 { + err = fmt.Errorf("Missing argument for %s", message) + return finalMessage, err + } + _, ok := args[0].(float64) + if !ok { + err = fmt.Errorf("Argument must be float64 for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One optional string + case "getmemorypool", "getnewaddress", "getwork", "help": + if len(args) > 1 { + err = fmt.Errorf("Too many arguments for %s", message) + return finalMessage, err + } + if len(args) == 1 { + _, ok := args[0].(string) + if !ok { + err = fmt.Errorf("Optional argument must be string for %s", message) + return finalMessage, err + } + } + finalMessage, err = jsonWithArgs(message, args) + // One required string + case "backupwallet", "decoderawtransaction", "dumpprivkey", + "encryptwallet", "getaccount", "getaccountaddress", + "getaddressbyaccount", "getblock", + "gettransaction", "sendrawtransaction", "validateaddress": + if len(args) != 1 { + err = fmt.Errorf("%s requires one argument", message) + return finalMessage, err + } + _, ok := args[0].(string) + if !ok { + err = fmt.Errorf("Argument must be string for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Two required strings + case "listsinceblock", "setaccount", "signmessage", "walletpassphrase", + "walletpassphrasechange": + if len(args) != 2 { + err = fmt.Errorf("Missing arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + _, ok2 := args[1].(string) + if !ok1 || !ok2 { + err = fmt.Errorf("Arguments must be string for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Three required strings + case "verifymessage": + if len(args) != 3 { + err = fmt.Errorf("Three arguments required for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + _, ok2 := args[1].(string) + _, ok3 := args[2].(string) + if !ok1 || !ok2 || !ok3 { + err = fmt.Errorf("Arguments must be string for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One required bool, one optional string + case "getaddednodeinfo": + if len(args) > 2 || len(args) == 0 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(bool) + ok2 := true + if len(args) == 2 { + _, ok2 = args[1].(string) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Arguments must be bool and optionally string for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One required bool, one optional int + case "setgenerate": + if len(args) > 2 || len(args) == 0 { + err = fmt.Errorf("Wrong number of argument for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(bool) + ok2 := true + if len(args) == 2 { + _, ok2 = args[1].(int) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Arguments must be bool and optionally int for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One optional string, one optional int + case "getbalance", "getreceivedbyaccount": + if len(args) > 2 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + ok1 := true + ok2 := true + if len(args) >= 1 { + _, ok1 = args[0].(string) + } + if len(args) == 2 { + _, ok2 = args[1].(int) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Optional arguments must be string and int for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One required string, one optional int + case "addnode", "getrawtransaction", "getreceivedbyaddress": + if len(args) > 2 || len(args) == 0 { + err = fmt.Errorf("Wrong number of argument for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + ok2 := true + if len(args) == 2 { + _, ok2 = args[1].(int) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Arguments must be string and optionally int for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One optional int, one optional bool + case "listreceivedbyaccount", "listreceivedbyaddress": + if len(args) > 2 { + err = fmt.Errorf("Wrong number of argument for %s", message) + return finalMessage, err + } + ok1 := true + ok2 := true + if len(args) >= 1 { + _, ok1 = args[0].(int) + } + if len(args) == 2 { + _, ok2 = args[1].(bool) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Optional arguments must be int and bool for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One optional string, two optional ints + case "listtransactions": + if len(args) > 3 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + ok1 := true + ok2 := true + ok3 := true + if len(args) >= 1 { + _, ok1 = args[0].(string) + } + if len(args) > 1 { + _, ok2 = args[1].(int) + } + if len(args) == 3 { + _, ok3 = args[2].(int) + } + if !ok1 || !ok2 || !ok3 { + err = fmt.Errorf("Optional arguments must be string and up to two ints for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One required string, one optional string, one optional bool + case "importprivkey": + if len(args) > 3 || len(args) == 0 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + ok2 := true + ok3 := true + if len(args) > 1 { + _, ok2 = args[1].(string) + } + if len(args) == 3 { + _, ok3 = args[2].(bool) + } + if !ok1 || !ok2 || !ok3 { + err = fmt.Errorf("Arguments must be string and optionally string and bool for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Two optional ints + case "listunspent": + if len(args) > 2 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + ok1 := true + ok2 := true + if len(args) >= 1 { + _, ok1 = args[0].(int) + } + if len(args) == 2 { + _, ok2 = args[1].(int) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Optional arguments must be ints for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Two required strings, one required float, one optional int, + // two optional strings. + case "sendfrom": + if len(args) > 6 || len(args) < 3 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + _, ok2 := args[1].(string) + _, ok3 := args[2].(float64) + ok4 := true + ok5 := true + ok6 := true + if len(args) >= 4 { + _, ok4 = args[3].(int) + } + if len(args) >= 5 { + _, ok5 = args[4].(string) + } + if len(args) == 6 { + _, ok6 = args[5].(string) + } + if !ok1 || !ok2 || !ok3 || !ok4 || !ok5 || !ok6 { + err = fmt.Errorf("Arguments must be string, string, float64 and optionally int and two strings for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Two required strings, one required float, one optional int, + // one optional string. + case "move": + if len(args) > 5 || len(args) < 3 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + _, ok2 := args[1].(string) + _, ok3 := args[2].(float64) + ok4 := true + ok5 := true + if len(args) >= 4 { + _, ok4 = args[3].(int) + } + if len(args) == 5 { + _, ok5 = args[4].(string) + } + if !ok1 || !ok2 || !ok3 || !ok4 || !ok5 { + err = fmt.Errorf("Arguments must be string, string, float64 and optionally int and string for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // One required strings, one required float, two optional strings + case "sendtoaddress": + if len(args) > 4 || len(args) < 2 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + _, ok2 := args[1].(float64) + ok3 := true + ok4 := true + if len(args) >= 3 { + _, ok3 = args[2].(string) + } + if len(args) == 4 { + _, ok4 = args[3].(string) + } + if !ok1 || !ok2 || !ok3 || !ok4 { + err = fmt.Errorf("Arguments must be string, float64 and optionally two strings for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // required int, required pair of keys (string), optional string + case "addmultisignaddress": + if len(args) > 4 || len(args) < 3 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(int) + _, ok2 := args[1].(string) + _, ok3 := args[2].(string) + ok4 := true + if len(args) == 4 { + _, ok4 = args[2].(string) + } + if !ok1 || !ok2 || !ok3 || !ok4 { + err = fmt.Errorf("Arguments must be int, two string and optionally one for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Must be a set of 3 strings and a float (any number of those) + case "createrawtransaction": + if len(args)%4 != 0 || len(args) == 0 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + type vlist struct { + Vin string `json:"vin"` + Vout string `json:"vout"` + } + vList := make([]vlist, len(args)/4) + addresses := make(map[string]float64) + for i := 0; i < len(args)/4; i += 1 { + vin, ok1 := args[(i*4)+0].(string) + vout, ok2 := args[(i*4)+1].(string) + add, ok3 := args[(i*4)+2].(string) + amt, ok4 := args[(i*4)+3].(float64) + if !ok1 || !ok2 || !ok3 || !ok4 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + vList[i].Vin = vin + vList[i].Vout = vout + addresses[add] = amt + } + finalMessage, err = jsonWithArgs(message, []interface{}{vList, addresses}) + // string, string/float pairs, optional int, and string + case "sendmany": + if len(args) < 3 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + var minconf int + var comment string + _, ok1 := args[0].(string) + if !ok1 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + addresses := make(map[string]float64) + for i := 1; i < len(args); i += 2 { + add, ok1 := args[i].(string) + if ok1 { + if len(args) > i+1 { + amt, ok2 := args[i+1].(float64) + if !ok2 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + // Put a single pair into addresses + addresses[add] = amt + } else { + comment = add + } + } else { + if _, ok := args[i].(int); ok { + minconf = args[i].(int) + } + if len(args)-1 > i { + if _, ok := args[i+1].(string); ok { + comment = args[i+1].(string) + } + } + } + } + finalMessage, err = jsonWithArgs(message, []interface{}{args[0].(string), addresses, minconf, comment}) + // bool and an array of stuff + case "lockunspent": + if len(args) < 2 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(bool) + if !ok1 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // one required string (hex) and at least one set of 4 other strings. + case "signrawtransaction": + if (len(args)-1)%4 != 0 || len(args) < 5 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + if !ok1 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + type txlist struct { + Txid string `json:"txid"` + Vout string `json:"vout"` + ScriptPubKey string `json:"scriptPubKey"` + } + txList := make([]txlist, (len(args)-1)/4) + pkeyList := make([]string, (len(args)-1)/4) + for i := 0; i < len(args)/4; i += 1 { + txid, ok1 := args[(i*4)+0].(string) + vout, ok2 := args[(i*4)+1].(string) + spkey, ok3 := args[(i*4)+2].(string) + pkey, ok4 := args[(i*4)+3].(string) + if !ok1 || !ok2 || !ok3 || !ok4 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + txList[i].Txid = txid + txList[i].Vout = vout + txList[i].ScriptPubKey = spkey + pkeyList[i] = pkey + } + finalMessage, err = jsonWithArgs(message, []interface{}{args[0].(string), txList, pkeyList}) + // Any other message + default: + err = fmt.Errorf("Not a valid command: %s", message) + } + return finalMessage, err +} + +// readResultCmd unmarshalls the json reply with data struct for specific +// commands or an interface if it is not a command where we already have a +// struct ready. +func readResultCmd(cmd string, message []byte) (Reply, error) { + var result Reply + var err error + var objmap map[string]json.RawMessage + err = json.Unmarshal(message, &objmap) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + // Take care of the parts that are the same for all replies. + var jsonErr Error + var id string + err = json.Unmarshal(objmap["error"], &jsonErr) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + err = json.Unmarshal(objmap["id"], &id) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + + // If it is a command where we have already worked out the reply, + // generate put the results in the proper structure. + switch cmd { + case "getinfo": + var res InfoResult + err = json.Unmarshal(objmap["result"], &res) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + result.Result = res + case "getblock": + var res BlockResult + err = json.Unmarshal(objmap["result"], &res) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + result.Result = res + case "getrawtransaction": + var res TxRawResult + err = json.Unmarshal(objmap["result"], &res) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + result.Result = res + case "decoderawtransaction": + var res TxRawDecodeResult + err = json.Unmarshal(objmap["result"], &res) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + result.Result = res + // For anything else put it in an interface. All the data is still + // there, just a little less convenient to deal with. + default: + err = json.Unmarshal(message, &result) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + } + // Only want the error field when there is an actual error to report. + if jsonErr.Code != 0 { + result.Error = &jsonErr + } + result.Id = &id + return result, err +} + +// RpcCommand takes a message generated from one of the routines above +// along with the login/server info, sends it, and gets a reply, returning +// a go struct with the result. +func RpcCommand(user string, password string, server string, message []byte) (Reply, error) { + var result Reply + // Need this so we can tell what kind of message we are sending + // so we can unmarshal it properly. + var method string + var msg interface{} + err := json.Unmarshal(message, &msg) + if err != nil { + err := fmt.Errorf("Error, message does not appear to be valid json: %v", err) + return result, err + } + m := msg.(map[string]interface{}) + for k, v := range m { + if k == "method" { + method = v.(string) + } + } + if method == "" { + err := fmt.Errorf("Error, no method specified.") + return result, err + } + resp, err := jsonRpcSend(user, password, server, message) + if err != nil { + err := fmt.Errorf("Error Sending json message.") + return result, err + } + body, err := GetRaw(resp.Body) + if err != nil { + err := fmt.Errorf("Error getting json reply: %v", err) + return result, err + } + result, err = readResultCmd(method, body) + if err != nil { + err := fmt.Errorf("Error reading json message: %v", err) + return result, err + } + return result, err +} diff --git a/jsonapi_test.go b/jsonapi_test.go new file mode 100644 index 00000000..7896aa29 --- /dev/null +++ b/jsonapi_test.go @@ -0,0 +1,245 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "github.com/conformal/btcjson" + "io" + "io/ioutil" + "testing" +) + +// cmdtests is a table of all the possible commands and a list of inputs, +// some of which should work, some of which should not (indicated by the +// pass variable). This mainly checks the type and number of the arguments, +// it does not actually check to make sure the values are correct (i.e., that +// addresses are reasonable) as the bitcoin client must be able to deal with +// that. +var cmdtests = []struct { + cmd string + args []interface{} + pass bool +}{ + {"getinfo", nil, true}, + {"getinfo", []interface{}{1}, false}, + {"listaccounts", nil, true}, + {"listaccounts", []interface{}{1}, true}, + {"listaccounts", []interface{}{"test"}, false}, + {"listaccounts", []interface{}{1, 2}, false}, + {"getblockhash", nil, false}, + {"getblockhash", []interface{}{1}, true}, + {"getblockhash", []interface{}{1, 2}, false}, + {"getblockhash", []interface{}{1.1}, false}, + {"settxfee", nil, false}, + {"settxfee", []interface{}{1.0}, true}, + {"settxfee", []interface{}{1.0, 2.0}, false}, + {"settxfee", []interface{}{1}, false}, + {"getmemorypool", nil, true}, + {"getmemorypool", []interface{}{"test"}, true}, + {"getmemorypool", []interface{}{1}, false}, + {"getmemorypool", []interface{}{"test", 2}, false}, + {"backupwallet", nil, false}, + {"backupwallet", []interface{}{1, 2}, false}, + {"backupwallet", []interface{}{1}, false}, + {"backupwallet", []interface{}{"testpath"}, true}, + {"setaccount", nil, false}, + {"setaccount", []interface{}{1}, false}, + {"setaccount", []interface{}{1, 2, 3}, false}, + {"setaccount", []interface{}{1, "test"}, false}, + {"setaccount", []interface{}{"test", "test"}, true}, + {"verifymessage", nil, false}, + {"verifymessage", []interface{}{1}, false}, + {"verifymessage", []interface{}{1, 2}, false}, + {"verifymessage", []interface{}{1, 2, 3, 4}, false}, + {"verifymessage", []interface{}{"test", "test", "test"}, true}, + {"verifymessage", []interface{}{"test", "test", 1}, false}, + {"getaddednodeinfo", nil, false}, + {"getaddednodeinfo", []interface{}{1}, false}, + {"getaddednodeinfo", []interface{}{true}, true}, + {"getaddednodeinfo", []interface{}{true, 1}, false}, + {"getaddednodeinfo", []interface{}{true, "test"}, true}, + {"setgenerate", nil, false}, + {"setgenerate", []interface{}{1, 2, 3}, false}, + {"setgenerate", []interface{}{true}, true}, + {"setgenerate", []interface{}{true, 1}, true}, + {"setgenerate", []interface{}{true, 1.1}, false}, + {"setgenerate", []interface{}{"true", 1}, false}, + {"getbalance", nil, true}, + {"getbalance", []interface{}{"test"}, true}, + {"getbalance", []interface{}{"test", 1}, true}, + {"getbalance", []interface{}{"test", 1.0}, false}, + {"getbalance", []interface{}{1, 1}, false}, + {"getbalance", []interface{}{"test", 1, 2}, false}, + {"getbalance", []interface{}{1}, false}, + {"addnode", nil, false}, + {"addnode", []interface{}{1, 2, 3}, false}, + {"addnode", []interface{}{"test"}, true}, + {"addnode", []interface{}{1}, false}, + {"addnode", []interface{}{"test", 1}, true}, + {"addnode", []interface{}{"test", 1.0}, false}, + {"listreceivedbyaccount", nil, true}, + {"listreceivedbyaccount", []interface{}{1, 2, 3}, false}, + {"listreceivedbyaccount", []interface{}{1}, true}, + {"listreceivedbyaccount", []interface{}{1.0}, false}, + {"listreceivedbyaccount", []interface{}{1, false}, true}, + {"listreceivedbyaccount", []interface{}{1, "false"}, false}, + {"listtransactions", nil, true}, + {"listtransactions", []interface{}{"test"}, true}, + {"listtransactions", []interface{}{"test", 1}, true}, + {"listtransactions", []interface{}{"test", 1, 2}, true}, + {"listtransactions", []interface{}{"test", 1, 2, 3}, false}, + {"listtransactions", []interface{}{1}, false}, + {"listtransactions", []interface{}{"test", 1.0}, false}, + {"listtransactions", []interface{}{"test", 1, "test"}, false}, + {"importprivkey", nil, false}, + {"importprivkey", []interface{}{"test"}, true}, + {"importprivkey", []interface{}{1}, false}, + {"importprivkey", []interface{}{"test", "test"}, true}, + {"importprivkey", []interface{}{"test", "test", true}, true}, + {"importprivkey", []interface{}{"test", "test", true, 1}, false}, + {"importprivkey", []interface{}{"test", 1.0, true}, false}, + {"importprivkey", []interface{}{"test", "test", "true"}, false}, + {"listunspent", nil, true}, + {"listunspent", []interface{}{1}, true}, + {"listunspent", []interface{}{1, 2}, true}, + {"listunspent", []interface{}{1, 2, 3}, false}, + {"listunspent", []interface{}{1.0}, false}, + {"listunspent", []interface{}{1, 2.0}, false}, + {"sendfrom", nil, false}, + {"sendfrom", []interface{}{"test"}, false}, + {"sendfrom", []interface{}{"test", "test"}, false}, + {"sendfrom", []interface{}{"test", "test", 1.0}, true}, + {"sendfrom", []interface{}{"test", 1, 1.0}, false}, + {"sendfrom", []interface{}{1, "test", 1.0}, false}, + {"sendfrom", []interface{}{"test", "test", 1}, false}, + {"sendfrom", []interface{}{"test", "test", 1.0, 1}, true}, + {"sendfrom", []interface{}{"test", "test", 1.0, 1, "test"}, true}, + {"sendfrom", []interface{}{"test", "test", 1.0, 1, "test", "test"}, true}, + {"move", nil, false}, + {"move", []interface{}{1, 2, 3, 4, 5, 6}, false}, + {"move", []interface{}{1, 2}, false}, + {"move", []interface{}{"test", "test", 1.0}, true}, + {"move", []interface{}{"test", "test", 1.0, 1, "test"}, true}, + {"move", []interface{}{"test", "test", 1.0, 1}, true}, + {"move", []interface{}{1, "test", 1.0}, false}, + {"move", []interface{}{"test", 1, 1.0}, false}, + {"move", []interface{}{"test", "test", 1}, false}, + {"move", []interface{}{"test", "test", 1.0, 1.0, "test"}, false}, + {"move", []interface{}{"test", "test", 1.0, 1, true}, false}, + {"sendtoaddress", nil, false}, + {"sendtoaddress", []interface{}{"test"}, false}, + {"sendtoaddress", []interface{}{"test", 1.0}, true}, + {"sendtoaddress", []interface{}{"test", 1.0, "test"}, true}, + {"sendtoaddress", []interface{}{"test", 1.0, "test", "test"}, true}, + {"sendtoaddress", []interface{}{1, 1.0, "test", "test"}, false}, + {"sendtoaddress", []interface{}{"test", 1, "test", "test"}, false}, + {"sendtoaddress", []interface{}{"test", 1.0, 1.0, "test"}, false}, + {"sendtoaddress", []interface{}{"test", 1.0, "test", 1.0}, false}, + {"sendtoaddress", []interface{}{"test", 1.0, "test", "test", 1}, false}, + {"addmultisignaddress", []interface{}{1, "test", "test"}, true}, + {"addmultisignaddress", []interface{}{1, "test"}, false}, + {"addmultisignaddress", []interface{}{1, 1.0, "test"}, false}, + {"addmultisignaddress", []interface{}{1, "test", "test", "test"}, true}, + {"createrawtransaction", []interface{}{"in1", "out1", "a1", 1.0}, true}, + {"createrawtransaction", []interface{}{"in1", "out1", "a1", 1.0, "test"}, false}, + {"createrawtransaction", []interface{}{}, false}, + {"createrawtransaction", []interface{}{"in1", 1.0, "a1", 1.0}, false}, + {"sendmany", []interface{}{"in1", "out1", 1.0, 1, "comment"}, true}, + {"sendmany", []interface{}{"in1", "out1", 1.0, "comment"}, true}, + {"sendmany", []interface{}{"in1", "out1"}, false}, + {"sendmany", []interface{}{true, "out1", 1.0, 1, "comment"}, false}, + {"sendmany", []interface{}{"in1", "out1", "test", 1, "comment"}, false}, + {"lockunspent", []interface{}{true, "something"}, true}, + {"lockunspent", []interface{}{true}, false}, + {"lockunspent", []interface{}{1.0, "something"}, false}, + {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3", "test4"}, true}, + {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3"}, false}, + {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, + {"signrawtransaction", []interface{}{"hexstring", 1, "test2", "test3", "test4"}, false}, + {"signrawtransaction", []interface{}{"hexstring", "test", 2, "test3", "test4"}, false}, + {"signrawtransaction", []interface{}{"hexstring", "test", "test2", 3, "test4"}, false}, + {"fakecommand", nil, false}, +} + +// TestRpcCreateMessage tests CreateMessage using the table of messages +// in cmdtests. +func TestRpcCreateMessage(t *testing.T) { + var err error + for i, tt := range cmdtests { + if tt.args == nil { + _, err = btcjson.CreateMessage(tt.cmd) + } else { + _, err = btcjson.CreateMessage(tt.cmd, tt.args...) + } + if tt.pass { + if err != nil { + t.Errorf("Could not create command %d: %s %v.", i, tt.cmd, err) + } + } else { + if err == nil { + t.Errorf("Should create command. %d: %s", i, tt.cmd) + } + } + } + return +} + +// TestRpcCommand tests RpcCommand by generating some commands and +// trying to send them off. +func TestRpcCommand(t *testing.T) { + user := "something" + pass := "something" + server := "invalid" + var msg []byte + _, err := btcjson.RpcCommand(user, pass, server, msg) + if err == nil { + t.Errorf("Should fail.") + } + msg, err = btcjson.CreateMessage("getinfo") + if err != nil { + t.Errorf("Cannot create valid json message") + } + _, err = btcjson.RpcCommand(user, pass, server, msg) + if err == nil { + t.Errorf("Should not connect to server.") + } + + badMsg := []byte("{\"jsonrpc\":\"1.0\",\"id\":\"btcd\",\"method\":\"\"}") + _, err = btcjson.RpcCommand(user, pass, server, badMsg) + if err == nil { + t.Errorf("Cannot have no method in msg..") + } + return +} + +// FailingReadClose is a type used for testing so we can get something that +// fails past Go's type system. +type FailingReadCloser struct{} + +func (f *FailingReadCloser) Close() error { + return io.ErrUnexpectedEOF +} + +func (f *FailingReadCloser) Read(p []byte) (n int, err error) { + return 0, io.ErrUnexpectedEOF +} + +// TestRpcReply tests JsonGetRaw by sending both a good and a bad buffer +// to it. +func TestRpcReply(t *testing.T) { + buffer := new(bytes.Buffer) + buffer2 := ioutil.NopCloser(buffer) + _, err := btcjson.GetRaw(buffer2) + if err != nil { + t.Errorf("Error reading rpc reply.") + } + failBuf := &FailingReadCloser{} + _, err = btcjson.GetRaw(failBuf) + if err == nil { + t.Errorf("Error, this should fail.") + } + return +} diff --git a/jsonfxns.go b/jsonfxns.go new file mode 100644 index 00000000..2d336259 --- /dev/null +++ b/jsonfxns.go @@ -0,0 +1,54 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" +) + +// MarshallAndSend takes the reply structure, marshalls it to json, and +// sends it back to the http writer, returning a log message and an error if +// there is one. +func MarshallAndSend(rawReply Reply, w http.ResponseWriter) (string, error) { + finalReply, err := json.Marshal(rawReply) + if err != nil { + msg := fmt.Sprintf("[RPCS] Error Marshalling reply: %v", err) + return msg, err + } + fmt.Fprintf(w, "%s\n", finalReply) + msg := fmt.Sprintf("[RPCS] reply: %v", rawReply) + return msg, nil +} + +// jsonRpcSend connects to the daemon with the specified username, password, +// and ip/port and then send the supplied message. This uses net/http rather +// than net/rpc/jsonrpc since that one doesn't support http connections and is +// therefore useless. +func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) { + resp, err := http.Post("http://"+user+":"+password+"@"+server, + "application/json", bytes.NewBuffer(message)) + if err != nil { + err = fmt.Errorf("Error Sending json message.") + } + return resp, err +} + +// GetRaw should be called after JsonRpcSend. It reads and returns +// the reply (which you can then call readResult() on) and closes the +// connection. +func GetRaw(resp io.ReadCloser) ([]byte, error) { + body, err := ioutil.ReadAll(resp) + resp.Close() + if err != nil { + err = fmt.Errorf("Error reading json reply: %v", err) + return body, err + } + return body, nil +} diff --git a/test_coverage.txt b/test_coverage.txt new file mode 100644 index 00000000..382d31d6 --- /dev/null +++ b/test_coverage.txt @@ -0,0 +1,10 @@ + +github.com/conformal/btcjson/jsonapi.go JsonCreateMessage 100.00% (310/310) +github.com/conformal/btcjson/jsonfxns.go JsonGetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (4/4) +github.com/conformal/btcjson/jsonapi.go JsonRpcCommand 66.67% (18/27) +github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) +github.com/conformal/btcjson/jsonfxns.go JsonMarshallAndSend 0.00% (0/7) +github.com/conformal/btcjson ------------------- 88.75% (363/409) + From 648e6317bb20f5fac32c717f393da7d69c40bdf7 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 13 May 2013 13:21:01 -0500 Subject: [PATCH 003/229] Fix comment typo -- implimented -> implemented. --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 2f7b0a06..853b78e9 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -19,7 +19,7 @@ type Message struct { // Reply is the general form of the reply from the bitcoin client. // The form of the Result part varies from one command to the next so it -// is currently implimented as an interface. +// is currently implemented as an interface. type Reply struct { Result interface{} `json:"result"` Error *Error `json:"error"` From 2fc8982be59ad8e2bca6a5ac40ab1e497030c846 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 14 May 2013 10:13:44 -0400 Subject: [PATCH 004/229] Add tests for MarshallAndSend function. --- jsonfxns.go | 6 +++--- jsonfxns_test.go | 55 +++++++++++++++++++++++++++++++++++++++++++++++ test_coverage.txt | 16 +++++++------- 3 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 jsonfxns_test.go diff --git a/jsonfxns.go b/jsonfxns.go index 2d336259..555f612c 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -14,9 +14,9 @@ import ( ) // MarshallAndSend takes the reply structure, marshalls it to json, and -// sends it back to the http writer, returning a log message and an error if -// there is one. -func MarshallAndSend(rawReply Reply, w http.ResponseWriter) (string, error) { +// sends it back to the io.Writer (most likely an http.ResponseWriter). +// returning a log message and an error if there is one. +func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { finalReply, err := json.Marshal(rawReply) if err != nil { msg := fmt.Sprintf("[RPCS] Error Marshalling reply: %v", err) diff --git a/jsonfxns_test.go b/jsonfxns_test.go new file mode 100644 index 00000000..5f1b316a --- /dev/null +++ b/jsonfxns_test.go @@ -0,0 +1,55 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "fmt" + "github.com/conformal/btcjson" + "testing" +) + +// TestMarshallAndSend tests the MarshallAndSend function to make sure it can +// create a json message to write to the io.Writerr and to make sure +// it fails properly in cases where it cannot generate json. +func TestMarshallAndSend(t *testing.T) { + jsonError := btcjson.Error{ + Code: -32700, + Message: "Parse error", + } + // json.Marshal cannot handle channels so this is a good way to get a + // marshal failure. + badRes := make(chan interface{}) + rawReply := btcjson.Reply{ + Result: badRes, + Error: &jsonError, + Id: nil, + } + var w bytes.Buffer + + msg, err := btcjson.MarshallAndSend(rawReply, &w) + if fmt.Sprintf("%s", err) != "json: unsupported type: chan interface {}" { + t.Error("Should not be able to unmarshall channel") + } + + // Use something simple so we can compare the reply. + rawReply = btcjson.Reply{ + Result: nil, + Error: nil, + Id: nil, + } + + msg, err = btcjson.MarshallAndSend(rawReply, &w) + if msg != "[RPCS] reply: { }" { + t.Error("Incorrect reply:", msg) + } + + expBuf := "{\"result\":null,\"error\":null,\"id\":null}\n" + + if w.String() != expBuf { + t.Error("Incorrect data in buffer:", w.String()) + } + return +} diff --git a/test_coverage.txt b/test_coverage.txt index 382d31d6..bdbebbc3 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,10 +1,10 @@ -github.com/conformal/btcjson/jsonapi.go JsonCreateMessage 100.00% (310/310) -github.com/conformal/btcjson/jsonfxns.go JsonGetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (4/4) -github.com/conformal/btcjson/jsonapi.go JsonRpcCommand 66.67% (18/27) -github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) -github.com/conformal/btcjson/jsonfxns.go JsonMarshallAndSend 0.00% (0/7) -github.com/conformal/btcjson ------------------- 88.75% (363/409) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) +github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (4/4) +github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) +github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) +github.com/conformal/btcjson --------------- 90.46% (370/409) From c896d6162517105218119df0addebb220e3e64c2 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 15 May 2013 19:29:20 -0500 Subject: [PATCH 005/229] Improve examples in package overview documentation. This commit makes the examples a little more clear by providing complete examples of the two different types of replies. These changes were prompted by PaulCapes on IRC who pointed out the previous example was not very clear. ok jcv@ --- doc.go | 79 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 28 deletions(-) diff --git a/doc.go b/doc.go index 767cc46e..418fdda7 100644 --- a/doc.go +++ b/doc.go @@ -46,43 +46,66 @@ describing the error. id is simply the id of the requester. +RPC Server Authentication + +All RPC calls must be authenticated with a username and password. The specifics +on how to configure the RPC server varies depending on the specific bitcoin +implementation. For bitcoind, this is accomplished by setting rpcuser and +rpcpassword in the file ~/.bitcoin/bitcoin.conf. The default local address +of bitcoind is 127.0.0.1:8332. + Usage -To use this package, check it out from github: +The general pattern to use this package consists of generating a message (see +the full list on the official bitcoin wiki), sending the message, and handling +the result after asserting its type. - go get github.com/conformal/btcjson +For commands where the reply structure is known, such as getinfo, one can +directly access the fields in the Reply structure by type asserting the +reply to the appropriate concrete type. -Import it as usual: + // Create a getinfo message. + msg, err := btcjson.CreateMessage("getinfo") + if err != nil { + // Log and handle error. + } - import "github.com/conformal/btcjson" + // Send the message to server using the appropriate username and + // password. + reply, err := btcjson.RpcCommand(user, password, server, msg) + if err != nil { + // Log and handle error. + } -Generate the message you want (see the full list on the official bitcoin wiki): + // Ensure there is a result and type assert it to a btcjson.InfoResult. + if reply.Result != nil { + if info, ok := reply.Result.(btcjson.InfoResult); ok { + fmt.Println("balance =", info.Balance) + } + } - msg, err := btcjson.CreateMessage("getinfo") +For other commands where this package does not yet provide a concrete +implementation for the reply, such as getrawmempool, the reply uses a generic +interface so one can access individual items as follows: -And then send the message: + // Create a getrawmempool message. + msg, err := btcjson.CreateMessage("getrawmempool") + if err != nil { + // Log and handle error. + } - reply, err := btcjson.RpcCommand(user, password, server, msg) - -Since rpc calls must be authenticated, RpcCommand requires a -username and password along with the address of the server. For -details, see the documentation for your bitcoin implementation. - -For convenience, this can be set for bitcoind by setting rpcuser and -rpcpassword in the file ~/.bitcoin/bitcoin.conf with a default local -address of: 127.0.0.1:8332 - -For commands where the reply structure is known (such as getblock), -one can directly access the fields in the Reply structure. For other -commands, the reply uses an interface so one can access individual -items like: - - if reply.Result != nil { - info := reply.Result.(map[string]interface{}) - balance, ok := info["balance"].(float64) - } - -(with appropriate error checking at all steps of course). + // Send the message to server using the appropriate username and + // password. + reply, err := btcjson.RpcCommand(user, password, server, msg) + if err != nil { + // Log and handle error. + } + // Ensure there is a result and type assert it to an interface slice. + if reply.Result != nil { + if mempool, ok := reply.Result.([]interface{}); ok { + fmt.Println("num mempool entries =", len(mempool)) + } + } */ package btcjson From 7b4aeb23539b52e3b0a4e40eb4270460b7b00322 Mon Sep 17 00:00:00 2001 From: AndreasM Date: Fri, 31 May 2013 01:23:23 +0300 Subject: [PATCH 006/229] the JSON-RPC 1.0 spec allows the id to be of any type --- jsonapi.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 853b78e9..1c22aebb 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -12,7 +12,7 @@ import ( // Message contains a message to be sent to the bitcoin client. type Message struct { Jsonrpc string `json:"jsonrpc"` - Id string `json:"id"` + Id interface{} `json:"id"` Method string `json:"method"` Params interface{} `json:"params"` } @@ -24,7 +24,7 @@ type Reply struct { Result interface{} `json:"result"` Error *Error `json:"error"` // This has to be a pointer for go to put a null in it when empty. - Id *string `json:"id"` + Id *interface{} `json:"id"` } // InfoResult contains the data returned by the getinfo command. @@ -618,7 +618,7 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { } // Take care of the parts that are the same for all replies. var jsonErr Error - var id string + var id interface{} err = json.Unmarshal(objmap["error"], &jsonErr) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) From 4ab8ca5eef57e22f74b8312159a834a4d9d7d085 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 31 May 2013 10:59:46 -0400 Subject: [PATCH 007/229] Add code to test for allowable types in json rpc id field along with test code for the new function. --- jsonapi.go | 19 +++++++++++++++++++ jsonapi_test.go | 23 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index 1c22aebb..b2bcaa38 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -723,3 +723,22 @@ func RpcCommand(user string, password string, server string, message []byte) (Re } return result, err } + +// IsValidIdType checks that the Id field (which can go in any of the json +// messages is valid. json rpc 1.0 allows any (json) type, but we still need +// to prevent values that cannot be marshalled from going in. json rpc 2.0 +// (which bitcoind follows for some parts) only allows string, number, or null, +// so we restrict to that list. Ths is only necessary if you manually marshal +// a message. The normal btcjson functions only use string ids. +func IsValidIdType(id interface{}) bool { + switch id.(type) { + case int, int8, int16, int32, int64, + uint, uint8, uint16, uint32, uint64, + float32, float64, + string, + nil: + return true + default: + return false + } +} diff --git a/jsonapi_test.go b/jsonapi_test.go index 7896aa29..5fd5dcad 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -243,3 +243,26 @@ func TestRpcReply(t *testing.T) { } return } + +var idtests = []struct { + testId []interface{} + pass bool +}{ + {[]interface{}{"string test"}, true}, + {[]interface{}{1}, true}, + {[]interface{}{1.0}, true}, + {[]interface{}{nil}, true}, + {[]interface{}{make(chan int)}, false}, +} + +// TestIsValidIdType tests that IsValidIdType allows (and disallows the correct +// types. +func TestIsValidIdType(t *testing.T) { + for _, tt := range idtests { + res := btcjson.IsValidIdType(tt.testId[0]) + if res != tt.pass { + t.Errorf("Incorrect type result %v.", tt) + } + } + return +} From 27b69ccca3819cc9e9f3a45cf5115a03b4866c0a Mon Sep 17 00:00:00 2001 From: AndreasM Date: Thu, 13 Jun 2013 19:16:41 +0300 Subject: [PATCH 008/229] unhide error message from jsonRpcSend --- jsonapi.go | 2 +- jsonfxns.go | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index b2bcaa38..f0f7699e 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -708,7 +708,7 @@ func RpcCommand(user string, password string, server string, message []byte) (Re } resp, err := jsonRpcSend(user, password, server, message) if err != nil { - err := fmt.Errorf("Error Sending json message.") + err := fmt.Errorf("Error sending json message: "+err.Error()) return result, err } body, err := GetRaw(resp.Body) diff --git a/jsonfxns.go b/jsonfxns.go index 555f612c..56991b2f 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -34,9 +34,7 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) { resp, err := http.Post("http://"+user+":"+password+"@"+server, "application/json", bytes.NewBuffer(message)) - if err != nil { - err = fmt.Errorf("Error Sending json message.") - } + return resp, err } From e4a80edc9572f8bc07638211b946dd1f50121501 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 14 Jun 2013 11:32:05 -0400 Subject: [PATCH 009/229] Clean the error message on connect failure so username and password is not shown. --- jsonfxns.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jsonfxns.go b/jsonfxns.go index 56991b2f..7726cdb9 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -11,6 +11,7 @@ import ( "io" "io/ioutil" "net/http" + "regexp" ) // MarshallAndSend takes the reply structure, marshalls it to json, and @@ -34,7 +35,10 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) { resp, err := http.Post("http://"+user+":"+password+"@"+server, "application/json", bytes.NewBuffer(message)) - + // We do not want to log the username/password in the errors. + re := regexp.MustCompile(`http://\w+:\w+`) + errString := re.ReplaceAllString(fmt.Sprintf("%v", err), "") + err = fmt.Errorf(errString) return resp, err } From 21d1240502acfa40881d128e0fb6d6f45aaf1ee0 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 14 Jun 2013 11:36:44 -0400 Subject: [PATCH 010/229] Update test_coverage.txt --- test_coverage.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index bdbebbc3..f0e3d661 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -3,8 +3,9 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (4/4) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (5/5) +github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) -github.com/conformal/btcjson --------------- 90.46% (370/409) +github.com/conformal/btcjson --------------- 90.56% (374/413) From 2a475d729999ff71607acd07d97b906175e2285c Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 14 Jun 2013 11:47:09 -0400 Subject: [PATCH 011/229] Need to test for nil before regex. --- jsonfxns.go | 10 ++++++---- test_coverage.txt | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/jsonfxns.go b/jsonfxns.go index 7726cdb9..a703acd5 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -35,10 +35,12 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) { resp, err := http.Post("http://"+user+":"+password+"@"+server, "application/json", bytes.NewBuffer(message)) - // We do not want to log the username/password in the errors. - re := regexp.MustCompile(`http://\w+:\w+`) - errString := re.ReplaceAllString(fmt.Sprintf("%v", err), "") - err = fmt.Errorf(errString) + if err != nil { + // We do not want to log the username/password in the errors. + re := regexp.MustCompile(`http://\w+:\w+`) + errString := re.ReplaceAllString(fmt.Sprintf("%v", err), "") + err = fmt.Errorf(errString) + } return resp, err } diff --git a/test_coverage.txt b/test_coverage.txt index f0e3d661..863b0e8d 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,10 +2,10 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) -github.com/conformal/btcjson --------------- 90.56% (374/413) +github.com/conformal/btcjson --------------- 90.58% (375/414) From 10542e057389ef8d282bec4aadf7e99dd9b8eac6 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 14 Jun 2013 11:19:50 -0500 Subject: [PATCH 012/229] Optimize and improve credential stripping code. Since we already have the specific username and password we want to strip from errors, use a specific search string rather than a generic regular expression. This is quite a bit more efficient than using regular expressions and also has the benefit of being more accurate. Also, rather than using the added overhead of fmt to convert the error to a string, just call Error() directly on it to get the string. Finally, instead of just stripping it, replace it with the literal string ":" to avoid any possible confusion in the error messages where it might otherwise appear the url was being constructed incorrectly. ok jcv@ --- jsonfxns.go | 11 ++++++----- test_coverage.txt | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/jsonfxns.go b/jsonfxns.go index a703acd5..ccee3661 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -11,7 +11,7 @@ import ( "io" "io/ioutil" "net/http" - "regexp" + "strings" ) // MarshallAndSend takes the reply structure, marshalls it to json, and @@ -33,13 +33,14 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { // than net/rpc/jsonrpc since that one doesn't support http connections and is // therefore useless. func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) { - resp, err := http.Post("http://"+user+":"+password+"@"+server, + credentials := user + ":" + password + resp, err := http.Post("http://"+credentials+"@"+server, "application/json", bytes.NewBuffer(message)) if err != nil { // We do not want to log the username/password in the errors. - re := regexp.MustCompile(`http://\w+:\w+`) - errString := re.ReplaceAllString(fmt.Sprintf("%v", err), "") - err = fmt.Errorf(errString) + replaceStr := ":" + str := strings.Replace(err.Error(), credentials, replaceStr, -1) + err = fmt.Errorf("%v", str) } return resp, err } diff --git a/test_coverage.txt b/test_coverage.txt index 863b0e8d..7203dd6f 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,11 +1,11 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) -github.com/conformal/btcjson --------------- 90.58% (375/414) +github.com/conformal/btcjson --------------- 90.60% (376/415) From 39cef5e76a845248e325c6bb07bf78dac96c3def Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 8 Jul 2013 17:12:16 -0400 Subject: [PATCH 013/229] Fix typo in command name getaddressesbyaccount. Caught by jrick@ --- jsonapi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index f0f7699e..1741894e 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -209,7 +209,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { // One required string case "backupwallet", "decoderawtransaction", "dumpprivkey", "encryptwallet", "getaccount", "getaccountaddress", - "getaddressbyaccount", "getblock", + "getaddressesbyaccount", "getblock", "gettransaction", "sendrawtransaction", "validateaddress": if len(args) != 1 { err = fmt.Errorf("%s requires one argument", message) @@ -708,7 +708,7 @@ func RpcCommand(user string, password string, server string, message []byte) (Re } resp, err := jsonRpcSend(user, password, server, message) if err != nil { - err := fmt.Errorf("Error sending json message: "+err.Error()) + err := fmt.Errorf("Error sending json message: " + err.Error()) return result, err } body, err := GetRaw(resp.Body) From 86f848ddd478003483eb4d86fcd7805828b68d0a Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 26 Jun 2013 16:34:45 -0400 Subject: [PATCH 014/229] Convert floats to int64. Following the example of bitcoind and the bitcoin wiki, provide a function to convert floats (which are returned by the json-rpc server) to int64 (which is the normal representation for most values involving bitcoins). --- jsonapi.go | 33 +++++++++++++++++++++++++++++++++ jsonapi_test.go | 33 ++++++++++++++++++++++++++++++++- test_coverage.txt | 3 ++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 1741894e..db2d94b0 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -742,3 +742,36 @@ func IsValidIdType(id interface{}) bool { return false } } + +// JSONToAmount Safely converts a floating point value to an int. +// Clearly not all floating point numbers can be converted to ints (there +// is no one-to-one mapping, but bitcoin's json api returns most numbers as +// floats which are not safe to use when handling money. Since bitcoins can +// only be divided in a limited way, this methods works for the amounts returned +// by the json api. It is not for general use. +// This follows the method described at: +// https://en.bitcoin.it/wiki/Proper_Money_Handling_%28JSON-RPC%29 +func JSONToAmount(jsonAmount float64) (int64, error) { + var amount int64 + var err error + if jsonAmount > 1.797693134862315708145274237317043567981e+300 { + err := fmt.Errorf("Error %d is too large to convert", jsonAmount) + return amount, err + } + if jsonAmount < -1.797693134862315708145274237317043567981e+300 { + err := fmt.Errorf("Error %d is too small to convert", jsonAmount) + return amount, err + } + tempVal := 1e8 * jsonAmount + // So we round properly. float won't == 0 and if it did, that + // would be converted fine anyway. + if tempVal < 0 { + tempVal = tempVal - 0.5 + } + if tempVal > 0 { + tempVal = tempVal + 0.5 + } + // Then just rely on the integer truncating + amount = int64(tempVal) + return amount, err +} diff --git a/jsonapi_test.go b/jsonapi_test.go index 5fd5dcad..74f7bc7b 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -256,7 +256,7 @@ var idtests = []struct { } // TestIsValidIdType tests that IsValidIdType allows (and disallows the correct -// types. +// types). func TestIsValidIdType(t *testing.T) { for _, tt := range idtests { res := btcjson.IsValidIdType(tt.testId[0]) @@ -266,3 +266,34 @@ func TestIsValidIdType(t *testing.T) { } return } + +var floattests = []struct { + in float64 + out int64 + pass bool +}{ + {1.0, 100000000, true}, + {-1.0, -100000000, true}, + {0.0, 0, true}, + {0.00000001, 1, true}, + {-0.00000001, -1, true}, + {-1.0e307, 0, false}, + {1.0e307, 0, false}, +} + +// TestJSONtoAmount tests that JSONtoAmount returns the proper values. +func TestJSONtoAmount(t *testing.T) { + for _, tt := range floattests { + res, err := btcjson.JSONToAmount(tt.in) + if tt.pass { + if res != tt.out || err != nil { + t.Errorf("Should not fail: ", tt.in) + } + } else { + if err == nil { + t.Errorf("Should not pass: ", tt.in) + } + } + } + return +} diff --git a/test_coverage.txt b/test_coverage.txt index 7203dd6f..ecd72d1d 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,5 +1,6 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) +github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) @@ -7,5 +8,5 @@ github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) -github.com/conformal/btcjson --------------- 90.60% (376/415) +github.com/conformal/btcjson --------------- 90.93% (391/430) From 39a1be8682426a94a6d354a16f8362ca40f0f02e Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 15 May 2013 14:20:17 -0400 Subject: [PATCH 015/229] Increase test coverage. --- internal_test.go | 65 +++++++++++++++++++++++++++++++++-------------- test_coverage.txt | 4 +-- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/internal_test.go b/internal_test.go index fe3649d3..2e11d805 100644 --- a/internal_test.go +++ b/internal_test.go @@ -17,30 +17,57 @@ cases which are either not possible or can't reliably be tested via the public interface. The functions are only exported while the tests are being run. */ +var resulttests = []struct { + cmd string + msg []byte + comp bool + pass bool +}{ + // Generate a fake message to make sure we can encode and decode it and + // get the same thing back. + {"getblockcount", + []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`), + true, true}, + // Generate a fake message to make sure we don't make a command from it. + {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, + {"anycommand", []byte(`{some junk}`), false, false}, + {"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}, + {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, +} + // TestReadResultCmd tests that readResultCmd can properly unmarshall the // returned []byte that contains a json reply for both known and unknown // messages. func TestReadResultCmd(t *testing.T) { - // Generate a fake message to make sure we can encode and decode it and - // get the same thing back. - msg := []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`) - result, err := readResultCmd("getblockcount", msg) - if err != nil { - t.Errorf("Reading json reply to struct failed. %v", err) - } - msg2, err := json.Marshal(result) - if err != nil { - t.Errorf("Converting struct back to json bytes failed. %v", err) - } - if bytes.Compare(msg, msg2) != 0 { - t.Errorf("json byte arrays differ.") - } - // Generate a fake message to make sure we don't make a command from it. - msg = []byte(`{"result":"test","id":1}`) - _, err = readResultCmd("anycommand", msg) - if err == nil { - t.Errorf("Incorrect json accepted.") + for i, tt := range resulttests { + result, err := readResultCmd(tt.cmd, tt.msg) + if tt.pass { + if err != nil { + t.Errorf("Should read result: %d %v", i, err) + } + // Due to the pointer for the Error and other structs, + // we can't always guarantee byte for byte comparison. + if tt.comp { + msg2, err := json.Marshal(result) + if err != nil { + t.Errorf("Should unmarshal result: %d %v", i, err) + } + if bytes.Compare(tt.msg, msg2) != 0 { + t.Errorf("json byte arrays differ. %d %v %v", i, tt.msg, msg2) + } + } + + } else { + if err == nil { + t.Errorf("Should fail: %d, %s", i, tt.msg) + } + } } + return } diff --git a/test_coverage.txt b/test_coverage.txt index ecd72d1d..1c42bb88 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,7 @@ github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsonapi.go readResultCmd 90.00% (45/50) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50) -github.com/conformal/btcjson --------------- 90.93% (391/430) +github.com/conformal/btcjson --------------- 96.74% (416/430) From e3c9ebd26f1e37b4874f911140721805253265bb Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 10 Jul 2013 13:47:59 -0400 Subject: [PATCH 016/229] Add more concrete types. Add concrete return type for getaddressesbyaccount and make some of the other command type handeling more explicit in the code. --- internal_test.go | 2 ++ jsonapi.go | 17 +++++++++++++++++ test_coverage.txt | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/internal_test.go b/internal_test.go index 2e11d805..7a4d9268 100644 --- a/internal_test.go +++ b/internal_test.go @@ -37,6 +37,8 @@ var resulttests = []struct { {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true}, } // TestReadResultCmd tests that readResultCmd can properly unmarshall the diff --git a/jsonapi.go b/jsonapi.go index db2d94b0..42f30efe 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -665,6 +665,23 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { return result, err } result.Result = res + case "getaddressesbyaccount": + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + result.Result = res + // For commands that return a single item, we get it with the + // correct concrete type for free (but treat them seperately + // for clarity. + case "getblockcount": + err = json.Unmarshal(message, &result) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } // For anything else put it in an interface. All the data is still // there, just a little less convenient to deal with. default: diff --git a/test_coverage.txt b/test_coverage.txt index 1c42bb88..2ca69f2a 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,7 @@ github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go readResultCmd 90.00% (45/50) +github.com/conformal/btcjson/jsonapi.go readResultCmd 85.00% (51/60) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 96.74% (416/430) +github.com/conformal/btcjson --------------- 95.91% (422/440) From 796df5b105e64fb5178d2a7594e61f9660276bd5 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 11 Jul 2013 13:46:32 -0400 Subject: [PATCH 017/229] Tests and typos. Increase test coverage. Fix spelling and typos in a comment. Minor update to todo in README.md --- README.md | 3 ++- internal_test.go | 3 +++ jsonapi.go | 4 ++-- test_coverage.txt | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8f9bf58d..88a574dd 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,8 @@ $ go get github.com/conformal/btcjson ## TODO - Add data structures for remaining commands. -- Increase test coverage to 100% +- Increase test coverage to 100%. +- Add https support. ## GPG Verification Key diff --git a/internal_test.go b/internal_test.go index 7a4d9268..665618e6 100644 --- a/internal_test.go +++ b/internal_test.go @@ -35,8 +35,11 @@ var resulttests = []struct { {"getinfo", []byte(`{"error":null,"result":null}`), false, false}, {"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true}, } diff --git a/jsonapi.go b/jsonapi.go index 42f30efe..e07d5aa0 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -674,8 +674,8 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { } result.Result = res // For commands that return a single item, we get it with the - // correct concrete type for free (but treat them seperately - // for clarity. + // correct concrete type for free (but treat them separately + // for clarity). case "getblockcount": err = json.Unmarshal(message, &result) if err != nil { diff --git a/test_coverage.txt b/test_coverage.txt index 2ca69f2a..4c58d3ec 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,7 @@ github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go readResultCmd 85.00% (51/60) +github.com/conformal/btcjson/jsonapi.go readResultCmd 90.16% (55/61) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 95.91% (422/440) +github.com/conformal/btcjson --------------- 96.60% (426/441) From a0dd367cd9c19fee617a7bfe75199317f6c12bf5 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 12 Jul 2013 12:39:12 -0400 Subject: [PATCH 018/229] Add a few more commands with known types. --- jsonapi.go | 3 ++- test_coverage.txt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index e07d5aa0..aef9321f 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -676,7 +676,8 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { // For commands that return a single item, we get it with the // correct concrete type for free (but treat them separately // for clarity). - case "getblockcount": + case "getblockcount", "getbalance", "getblocknumber", "getgenerate", + "getconnetioncount", "getdifficulty", "gethashespersec": err = json.Unmarshal(message, &result) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) diff --git a/test_coverage.txt b/test_coverage.txt index 4c58d3ec..642e5261 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,7 @@ github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go readResultCmd 90.16% (55/61) +github.com/conformal/btcjson/jsonapi.go readResultCmd 90.00% (54/60) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 96.60% (426/441) +github.com/conformal/btcjson --------------- 96.59% (425/440) From 7a1a05d69536b97095dace9c5b7b81328fd958b0 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 15 Jul 2013 10:51:58 -0400 Subject: [PATCH 019/229] Clarify comment and add command to concrete type list. --- jsonapi.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index aef9321f..abccdc03 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -673,11 +673,12 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { return result, err } result.Result = res - // For commands that return a single item, we get it with the - // correct concrete type for free (but treat them separately + // For commands that return a single item (or no items), we get it with + // the correct concrete type for free (but treat them separately // for clarity). case "getblockcount", "getbalance", "getblocknumber", "getgenerate", - "getconnetioncount", "getdifficulty", "gethashespersec": + "getconnetioncount", "getdifficulty", "gethashespersec", + "setgenerate": err = json.Unmarshal(message, &result) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) From ed7214afda98d5f83da644fa0f9e0b632c279965 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 16 Jul 2013 13:39:12 -0400 Subject: [PATCH 020/229] Add types for a few more commands. Add types for getmininginfo, getrawmempool, stop, and settxfee along with tests. --- internal_test.go | 4 ++++ jsonapi.go | 26 ++++++++++++++++++++++++-- test_coverage.txt | 4 ++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/internal_test.go b/internal_test.go index 665618e6..01afd6a9 100644 --- a/internal_test.go +++ b/internal_test.go @@ -42,6 +42,10 @@ var resulttests = []struct { {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"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}, + {"getrawmempool", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawmempool", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true}, } // TestReadResultCmd tests that readResultCmd can properly unmarshall the diff --git a/jsonapi.go b/jsonapi.go index abccdc03..1a7d5b03 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -111,6 +111,20 @@ type Vout struct { } `json:"scriptPubKey"` } +// GetMiningInfoResult models the data from the getmininginfo command. +type GetMiningInfoResult struct { + CurrentBlockSize float64 `json:"currentblocksize"` + Difficulty float64 `json:"difficulty"` + Errors string `json:"errors"` + Generate bool `json:"generate"` + GenProcLimit float64 `json:"genproclimit"` + PooledTx float64 `json:"pooledtx"` + Testnet bool `json:"testnet"` + Blocks float64 `json:"blocks"` + CurrentBlockTx float64 `json:"currentblocktx"` + HashesPerSec float64 `json:"hashespersec"` +} + // Error models the error field of the json returned by a bitcoin client. When // there is no error, this should be a nil pointer to produce the null in the // json that bitcoind produces. @@ -665,7 +679,7 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { return result, err } result.Result = res - case "getaddressesbyaccount": + case "getaddressesbyaccount", "getrawmempool": var res []string err = json.Unmarshal(objmap["result"], &res) if err != nil { @@ -673,12 +687,20 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { return result, err } result.Result = res + case "getmininginfo": + var res GetMiningInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + result.Result = res // For commands that return a single item (or no items), we get it with // the correct concrete type for free (but treat them separately // for clarity). case "getblockcount", "getbalance", "getblocknumber", "getgenerate", "getconnetioncount", "getdifficulty", "gethashespersec", - "setgenerate": + "setgenerate", "stop", "settxfee": err = json.Unmarshal(message, &result) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) diff --git a/test_coverage.txt b/test_coverage.txt index 642e5261..ca6c2517 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,7 @@ github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go readResultCmd 90.00% (54/60) +github.com/conformal/btcjson/jsonapi.go readResultCmd 90.91% (60/66) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 96.59% (425/440) +github.com/conformal/btcjson --------------- 96.64% (431/446) From 3b6c9b6d78452439254d0a71c733212b5858b427 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 16 Jul 2013 16:01:51 -0400 Subject: [PATCH 021/229] Simplify some code and increase test coverage. --- internal_test.go | 1 + jsonapi.go | 49 ++++++++++++++++------------------------------- test_coverage.txt | 6 +++--- 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/internal_test.go b/internal_test.go index 01afd6a9..fc8dbc1e 100644 --- a/internal_test.go +++ b/internal_test.go @@ -31,6 +31,7 @@ var resulttests = []struct { // Generate a fake message to make sure we don't make a command from it. {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, {"anycommand", []byte(`{some junk}`), false, false}, + {"anycommand", []byte(`{"error":null,"result":null,"id":"test"}`), 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}, diff --git a/jsonapi.go b/jsonapi.go index 1a7d5b03..ec66454c 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -646,55 +646,44 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { // If it is a command where we have already worked out the reply, // generate put the results in the proper structure. + // We handle the error condition after the switch statement. switch cmd { case "getinfo": var res InfoResult err = json.Unmarshal(objmap["result"], &res) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err + if err == nil { + result.Result = res } - result.Result = res case "getblock": var res BlockResult err = json.Unmarshal(objmap["result"], &res) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err + if err == nil { + result.Result = res } - result.Result = res case "getrawtransaction": var res TxRawResult err = json.Unmarshal(objmap["result"], &res) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err + if err == nil { + result.Result = res } - result.Result = res case "decoderawtransaction": var res TxRawDecodeResult err = json.Unmarshal(objmap["result"], &res) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err + if err == nil { + result.Result = res } - result.Result = res case "getaddressesbyaccount", "getrawmempool": var res []string err = json.Unmarshal(objmap["result"], &res) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err + if err == nil { + result.Result = res } - result.Result = res case "getmininginfo": var res GetMiningInfoResult err = json.Unmarshal(objmap["result"], &res) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err + if err == nil { + result.Result = res } - result.Result = res // For commands that return a single item (or no items), we get it with // the correct concrete type for free (but treat them separately // for clarity). @@ -702,18 +691,14 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { "getconnetioncount", "getdifficulty", "gethashespersec", "setgenerate", "stop", "settxfee": err = json.Unmarshal(message, &result) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err - } // For anything else put it in an interface. All the data is still // there, just a little less convenient to deal with. default: err = json.Unmarshal(message, &result) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err - } + } + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err } // Only want the error field when there is an actual error to report. if jsonErr.Code != 0 { diff --git a/test_coverage.txt b/test_coverage.txt index ca6c2517..d230675f 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,12 +1,12 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) +github.com/conformal/btcjson/jsonapi.go readResultCmd 100.00% (51/51) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go readResultCmd 90.91% (60/66) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 96.64% (431/446) +github.com/conformal/btcjson --------------- 97.91% (422/431) From f8fdabe53b361f8b78595153150ae15c52d4f3a2 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 16 Jul 2013 16:10:35 -0400 Subject: [PATCH 022/229] Fix some error formatting from go vet. --- jsonapi.go | 4 ++-- jsonapi_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index ec66454c..37a14c12 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -781,11 +781,11 @@ func JSONToAmount(jsonAmount float64) (int64, error) { var amount int64 var err error if jsonAmount > 1.797693134862315708145274237317043567981e+300 { - err := fmt.Errorf("Error %d is too large to convert", jsonAmount) + err := fmt.Errorf("Error %v is too large to convert", jsonAmount) return amount, err } if jsonAmount < -1.797693134862315708145274237317043567981e+300 { - err := fmt.Errorf("Error %d is too small to convert", jsonAmount) + err := fmt.Errorf("Error %v is too small to convert", jsonAmount) return amount, err } tempVal := 1e8 * jsonAmount diff --git a/jsonapi_test.go b/jsonapi_test.go index 74f7bc7b..db8aa9ed 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -287,11 +287,11 @@ func TestJSONtoAmount(t *testing.T) { res, err := btcjson.JSONToAmount(tt.in) if tt.pass { if res != tt.out || err != nil { - t.Errorf("Should not fail: ", tt.in) + t.Errorf("Should not fail: %v", tt.in) } } else { if err == nil { - t.Errorf("Should not pass: ", tt.in) + t.Errorf("Should not pass: %v", tt.in) } } } From 285faf8c75170bf0bb02055de212008f523b1b7f Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 5 Aug 2013 17:26:59 -0400 Subject: [PATCH 023/229] Add additional commands to ones we know return data type. getaccount and getnewaddress --- jsonapi.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 37a14c12..e4303309 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -689,7 +689,8 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { // for clarity). case "getblockcount", "getbalance", "getblocknumber", "getgenerate", "getconnetioncount", "getdifficulty", "gethashespersec", - "setgenerate", "stop", "settxfee": + "setgenerate", "stop", "settxfee", "getaccount", + "getnewaddress": err = json.Unmarshal(message, &result) // For anything else put it in an interface. All the data is still // there, just a little less convenient to deal with. From b28cded23e5817799108048457502098d48df32e Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 8 Aug 2013 11:44:15 -0400 Subject: [PATCH 024/229] Add return types for additional commands and bug fixes. Add return types for serveral additional commands. Fix required vs. optional arguments for createrawtransaction. Update tests and test coverage for all changes. --- internal_test.go | 4 ++++ jsonapi.go | 46 +++++++++++++++++++++++++++++++++++++--------- jsonapi_test.go | 3 ++- test_coverage.txt | 4 ++-- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/internal_test.go b/internal_test.go index fc8dbc1e..ef1f1021 100644 --- a/internal_test.go +++ b/internal_test.go @@ -47,6 +47,10 @@ var resulttests = []struct { {"getmininginfo", []byte(`{"error":null,"id":1,"result":{"generate":true}}`), false, true}, {"getrawmempool", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getrawmempool", []byte(`{"error":null,"id":1,"result":["test"]}`), 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}, + {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, } // TestReadResultCmd tests that readResultCmd can properly unmarshall the diff --git a/jsonapi.go b/jsonapi.go index e4303309..aa164e97 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -125,6 +125,22 @@ type GetMiningInfoResult struct { HashesPerSec float64 `json:"hashespersec"` } +// ValidateAddressResult models the data from the validateaddress command. +type ValidateAddressResult struct { + IsValid bool `json:"isvalid"` + Address string `json:"address,omitempty"` + IsMine bool `json:"ismine,omitempty"` + IsScript bool `json:"isscript,omitempty"` + PubKey string `json:"pubkey,omitempty"` + IsCompressed bool `json:"iscompressed,omitempty"` + Account string `json:"account,omitempty"` +} + +type SignRawTransactionResult struct { + Hex string `json:"hex"` + Complete bool `json:"complete"` +} + // Error models the error field of the json returned by a bitcoin client. When // there is no error, this should be a nil pointer to produce the null in the // json that bitcoind produces. @@ -500,28 +516,28 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } finalMessage, err = jsonWithArgs(message, args) - // Must be a set of 3 strings and a float (any number of those) + // Must be a set of string, int, string, float (any number of those). case "createrawtransaction": if len(args)%4 != 0 || len(args) == 0 { err = fmt.Errorf("Wrong number of arguments for %s", message) return finalMessage, err } type vlist struct { - Vin string `json:"vin"` - Vout string `json:"vout"` + Txid string `json:"txid"` + Vout int `json:"vout"` } vList := make([]vlist, len(args)/4) addresses := make(map[string]float64) for i := 0; i < len(args)/4; i += 1 { - vin, ok1 := args[(i*4)+0].(string) - vout, ok2 := args[(i*4)+1].(string) + txid, ok1 := args[(i*4)+0].(string) + vout, ok2 := args[(i*4)+1].(int) add, ok3 := args[(i*4)+2].(string) amt, ok4 := args[(i*4)+3].(float64) if !ok1 || !ok2 || !ok3 || !ok4 { err = fmt.Errorf("Incorrect arguement types.") return finalMessage, err } - vList[i].Vin = vin + vList[i].Txid = txid vList[i].Vout = vout addresses[add] = amt } @@ -578,9 +594,9 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } finalMessage, err = jsonWithArgs(message, args) - // one required string (hex) and at least one set of 4 other strings. + // one required string (hex) and sets of 4 optional strings. case "signrawtransaction": - if (len(args)-1)%4 != 0 || len(args) < 5 { + if len(args) < 1 || (len(args)-1)%4 != 0 { err = fmt.Errorf("Wrong number of arguments for %s", message) return finalMessage, err } @@ -684,13 +700,25 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "validateaddress": + var res ValidateAddressResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "signrawtransaction": + var res SignRawTransactionResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } // For commands that return a single item (or no items), we get it with // the correct concrete type for free (but treat them separately // for clarity). case "getblockcount", "getbalance", "getblocknumber", "getgenerate", "getconnetioncount", "getdifficulty", "gethashespersec", "setgenerate", "stop", "settxfee", "getaccount", - "getnewaddress": + "getnewaddress", "sendtoaddress", "createrawtransaction": err = json.Unmarshal(message, &result) // For anything else put it in an interface. All the data is still // there, just a little less convenient to deal with. diff --git a/jsonapi_test.go b/jsonapi_test.go index db8aa9ed..d767edfd 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -143,7 +143,7 @@ var cmdtests = []struct { {"addmultisignaddress", []interface{}{1, "test"}, false}, {"addmultisignaddress", []interface{}{1, 1.0, "test"}, false}, {"addmultisignaddress", []interface{}{1, "test", "test", "test"}, true}, - {"createrawtransaction", []interface{}{"in1", "out1", "a1", 1.0}, true}, + {"createrawtransaction", []interface{}{"in1", 0, "a1", 1.0}, true}, {"createrawtransaction", []interface{}{"in1", "out1", "a1", 1.0, "test"}, false}, {"createrawtransaction", []interface{}{}, false}, {"createrawtransaction", []interface{}{"in1", 1.0, "a1", 1.0}, false}, @@ -155,6 +155,7 @@ var cmdtests = []struct { {"lockunspent", []interface{}{true, "something"}, true}, {"lockunspent", []interface{}{true}, false}, {"lockunspent", []interface{}{1.0, "something"}, false}, + {"signrawtransaction", []interface{}{"hexstring"}, true}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3", "test4"}, true}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3"}, false}, {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, diff --git a/test_coverage.txt b/test_coverage.txt index d230675f..ca17db99 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,6 +1,6 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) -github.com/conformal/btcjson/jsonapi.go readResultCmd 100.00% (51/51) +github.com/conformal/btcjson/jsonapi.go readResultCmd 100.00% (59/59) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) @@ -8,5 +8,5 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 97.91% (422/431) +github.com/conformal/btcjson --------------- 97.95% (430/439) From da7e87235429f9a5458ca4244b6adbb8ca604ac4 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 9 Aug 2013 15:34:24 -0400 Subject: [PATCH 025/229] Add proper result type for listunspent. --- internal_test.go | 2 ++ jsonapi.go | 16 ++++++++++++++++ test_coverage.txt | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/internal_test.go b/internal_test.go index ef1f1021..1647f379 100644 --- a/internal_test.go +++ b/internal_test.go @@ -51,6 +51,8 @@ var resulttests = []struct { {"validateaddress", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"something","complete":false}}`), false, true}, {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, + {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, + {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, } // TestReadResultCmd tests that readResultCmd can properly unmarshall the diff --git a/jsonapi.go b/jsonapi.go index aa164e97..4811dca8 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -141,6 +141,16 @@ type SignRawTransactionResult struct { Complete bool `json:"complete"` } +type ListUnSpentResult struct { + TxId string `json:"txid"` + Vout float64 `json:"vout"` + Address string `json:"address"` + Account string `json:"account"` + ScriptPubKey string `json:"scriptPubKey"` + Amount float64 `json:"amount"` + Confirmations float64 `json:"confirmations"` +} + // Error models the error field of the json returned by a bitcoin client. When // there is no error, this should be a nil pointer to produce the null in the // json that bitcoind produces. @@ -712,6 +722,12 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "listunspent": + var res []ListUnSpentResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } // For commands that return a single item (or no items), we get it with // the correct concrete type for free (but treat them separately // for clarity). diff --git a/test_coverage.txt b/test_coverage.txt index ca17db99..2b8ab6b6 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,6 +1,6 @@ github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) -github.com/conformal/btcjson/jsonapi.go readResultCmd 100.00% (59/59) +github.com/conformal/btcjson/jsonapi.go readResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) @@ -8,5 +8,5 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 97.95% (430/439) +github.com/conformal/btcjson --------------- 97.97% (434/443) From dc2fe40a3d9fe7749f340c6de5f4bef60c9a2df1 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 12 Aug 2013 11:24:49 -0400 Subject: [PATCH 026/229] Fix comment typo noticed by jrick@ --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 4811dca8..ebd47a17 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -796,7 +796,7 @@ func RpcCommand(user string, password string, server string, message []byte) (Re } // IsValidIdType checks that the Id field (which can go in any of the json -// messages is valid. json rpc 1.0 allows any (json) type, but we still need +// messages) is valid. json rpc 1.0 allows any (json) type, but we still need // to prevent values that cannot be marshalled from going in. json rpc 2.0 // (which bitcoind follows for some parts) only allows string, number, or null, // so we restrict to that list. Ths is only necessary if you manually marshal From c8bb6b304e2fdcc8d7a875b9b2fa47128c48c79d Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 12 Aug 2013 13:46:03 -0400 Subject: [PATCH 027/229] Correct optional parameters for listsinceblock. Fixes #3 --- jsonapi.go | 22 +++++++++++++++++++++- jsonapi_test.go | 5 +++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index ebd47a17..16fff664 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -262,7 +262,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { } finalMessage, err = jsonWithArgs(message, args) // Two required strings - case "listsinceblock", "setaccount", "signmessage", "walletpassphrase", + case "setaccount", "signmessage", "walletpassphrase", "walletpassphrasechange": if len(args) != 2 { err = fmt.Errorf("Missing arguments for %s", message) @@ -437,6 +437,26 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } finalMessage, err = jsonWithArgs(message, args) + // Two optional strings + case "listsinceblock": + if len(args) > 2 { + err = fmt.Errorf("Wrong number of arguments for %s", message) + return finalMessage, err + } + ok1 := true + ok2 := true + if len(args) >= 1 { + _, ok1 = args[0].(string) + } + if len(args) == 2 { + _, ok2 = args[1].(string) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Optional arguments must be strings for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, args) + // Two required strings, one required float, one optional int, // two optional strings. case "sendfrom": diff --git a/jsonapi_test.go b/jsonapi_test.go index d767edfd..66e8a2cc 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -162,6 +162,11 @@ var cmdtests = []struct { {"signrawtransaction", []interface{}{"hexstring", 1, "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", 2, "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", 3, "test4"}, false}, + {"listsinceblock", []interface{}{"test", "test"}, true}, + {"listsinceblock", []interface{}{"test", "test", "test"}, false}, + {"listsinceblock", []interface{}{"test"}, true}, + {"listsinceblock", []interface{}{}, true}, + {"listsinceblock", []interface{}{1, "test"}, false}, {"fakecommand", nil, false}, } From 96a68227bdeaf8a951a16020e7cd56380cc99479 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 12 Aug 2013 12:50:04 -0400 Subject: [PATCH 028/229] Add RpcRawCommand and export ReadResultCommand. Add new RpcRawCommand to get []byte represtation of reply instead of btcjson.Result. Export ReadResultCommand to allow caller of RpcRawCommand to deal with the reply in the same way RpcCommand does. Adjust test code to for the above changes. --- internal_test.go | 71 ----------------------------------------------- jsonapi.go | 35 +++++++++++++++++------ jsonapi_test.go | 71 +++++++++++++++++++++++++++++++++++++++++++++++ test_coverage.txt | 11 ++++---- 4 files changed, 104 insertions(+), 84 deletions(-) diff --git a/internal_test.go b/internal_test.go index 1647f379..33d51063 100644 --- a/internal_test.go +++ b/internal_test.go @@ -5,7 +5,6 @@ package btcjson import ( - "bytes" "encoding/json" "testing" ) @@ -17,76 +16,6 @@ cases which are either not possible or can't reliably be tested via the public interface. The functions are only exported while the tests are being run. */ -var resulttests = []struct { - cmd string - msg []byte - comp bool - pass bool -}{ - // Generate a fake message to make sure we can encode and decode it and - // get the same thing back. - {"getblockcount", - []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`), - true, true}, - // Generate a fake message to make sure we don't make a command from it. - {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, - {"anycommand", []byte(`{some junk}`), false, false}, - {"anycommand", []byte(`{"error":null,"result":null,"id":"test"}`), 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}, - {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, - {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, - {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, - {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"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}, - {"getrawmempool", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"getrawmempool", []byte(`{"error":null,"id":1,"result":["test"]}`), 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}, - {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, - {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, - {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, -} - -// TestReadResultCmd tests that readResultCmd can properly unmarshall the -// returned []byte that contains a json reply for both known and unknown -// messages. -func TestReadResultCmd(t *testing.T) { - for i, tt := range resulttests { - result, err := readResultCmd(tt.cmd, tt.msg) - if tt.pass { - if err != nil { - t.Errorf("Should read result: %d %v", i, err) - } - // Due to the pointer for the Error and other structs, - // we can't always guarantee byte for byte comparison. - if tt.comp { - msg2, err := json.Marshal(result) - if err != nil { - t.Errorf("Should unmarshal result: %d %v", i, err) - } - if bytes.Compare(tt.msg, msg2) != 0 { - t.Errorf("json byte arrays differ. %d %v %v", i, tt.msg, msg2) - } - } - - } else { - if err == nil { - t.Errorf("Should fail: %d, %s", i, tt.msg) - } - } - } - - return -} - // TestJsonWIthArgs tests jsonWithArgs to ensure that it can generate a json // command as well as sending it something that cannot be marshalled to json // (a channel) to test the failure paths. diff --git a/jsonapi.go b/jsonapi.go index 16fff664..4aa5b320 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -664,10 +664,10 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } -// readResultCmd unmarshalls the json reply with data struct for specific +// ReadResultCmd unmarshalls the json reply with data struct for specific // commands or an interface if it is not a command where we already have a // struct ready. -func readResultCmd(cmd string, message []byte) (Reply, error) { +func ReadResultCmd(cmd string, message []byte) (Reply, error) { var result Reply var err error var objmap map[string]json.RawMessage @@ -797,21 +797,40 @@ func RpcCommand(user string, password string, server string, message []byte) (Re err := fmt.Errorf("Error, no method specified.") return result, err } + body, err := RpcRawCommand(user, password, server, message) + if err != nil { + err := fmt.Errorf("Error getting json reply: %v", err) + return result, err + } + result, err = ReadResultCmd(method, body) + if err != nil { + err := fmt.Errorf("Error reading json message: %v", err) + return result, err + } + return result, err +} + +// RpcRawCommand takes a message generated from one of the routines above +// along with the login/server info, sends it, and gets a reply, returning +// the raw []byte response for use with ReadResultCmd. +func RpcRawCommand(user string, password string, server string, message []byte) ([]byte, error) { + var result []byte + var msg interface{} + err := json.Unmarshal(message, &msg) + if err != nil { + err := fmt.Errorf("Error, message does not appear to be valid json: %v", err) + return result, err + } resp, err := jsonRpcSend(user, password, server, message) if err != nil { err := fmt.Errorf("Error sending json message: " + err.Error()) return result, err } - body, err := GetRaw(resp.Body) + result, err = GetRaw(resp.Body) if err != nil { err := fmt.Errorf("Error getting json reply: %v", err) return result, err } - result, err = readResultCmd(method, body) - if err != nil { - err := fmt.Errorf("Error reading json message: %v", err) - return result, err - } return result, err } diff --git a/jsonapi_test.go b/jsonapi_test.go index 66e8a2cc..108b032c 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -6,6 +6,7 @@ package btcjson_test import ( "bytes" + "encoding/json" "github.com/conformal/btcjson" "io" "io/ioutil" @@ -303,3 +304,73 @@ func TestJSONtoAmount(t *testing.T) { } return } + +var resulttests = []struct { + cmd string + msg []byte + comp bool + pass bool +}{ + // Generate a fake message to make sure we can encode and decode it and + // get the same thing back. + {"getblockcount", + []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`), + true, true}, + // Generate a fake message to make sure we don't make a command from it. + {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, + {"anycommand", []byte(`{some junk}`), false, false}, + {"anycommand", []byte(`{"error":null,"result":null,"id":"test"}`), 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}, + {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, + {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"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}, + {"getrawmempool", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawmempool", []byte(`{"error":null,"id":1,"result":["test"]}`), 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}, + {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, + {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, + {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, +} + +// TestReadResultCmd tests that readResultCmd can properly unmarshall the +// returned []byte that contains a json reply for both known and unknown +// messages. +func TestReadResultCmd(t *testing.T) { + for i, tt := range resulttests { + result, err := btcjson.ReadResultCmd(tt.cmd, tt.msg) + if tt.pass { + if err != nil { + t.Errorf("Should read result: %d %v", i, err) + } + // Due to the pointer for the Error and other structs, + // we can't always guarantee byte for byte comparison. + if tt.comp { + msg2, err := json.Marshal(result) + if err != nil { + t.Errorf("Should unmarshal result: %d %v", i, err) + } + if bytes.Compare(tt.msg, msg2) != 0 { + t.Errorf("json byte arrays differ. %d %v %v", i, tt.msg, msg2) + } + } + + } else { + if err == nil { + t.Errorf("Should fail: %d, %s", i, tt.msg) + } + } + } + + return +} diff --git a/test_coverage.txt b/test_coverage.txt index 2b8ab6b6..1fbd79b9 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,12 +1,13 @@ -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310) -github.com/conformal/btcjson/jsonapi.go readResultCmd 100.00% (63/63) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (323/323) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 97.97% (434/443) +github.com/conformal/btcjson/jsonapi.go RpcCommand 78.26% (18/23) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) +github.com/conformal/btcjson --------------- 97.43% (455/467) From a456d195d6f2dbcb9ee482288c559742e40a1277 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 13 Aug 2013 12:56:30 -0400 Subject: [PATCH 029/229] Add JSONGetMethod to get method name from raw json reply. --- jsonapi.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 4aa5b320..7b98312d 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -773,11 +773,9 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { return result, err } -// RpcCommand takes a message generated from one of the routines above -// along with the login/server info, sends it, and gets a reply, returning -// a go struct with the result. -func RpcCommand(user string, password string, server string, message []byte) (Reply, error) { - var result Reply +// JSONGetMethod takes a message and tries to find the bitcoin command that it +// is in reply to so it can be processed further. +func JSONGetMethod(message []byte) (string, error) { // Need this so we can tell what kind of message we are sending // so we can unmarshal it properly. var method string @@ -785,7 +783,7 @@ func RpcCommand(user string, password string, server string, message []byte) (Re err := json.Unmarshal(message, &msg) if err != nil { err := fmt.Errorf("Error, message does not appear to be valid json: %v", err) - return result, err + return method, err } m := msg.(map[string]interface{}) for k, v := range m { @@ -795,6 +793,18 @@ func RpcCommand(user string, password string, server string, message []byte) (Re } if method == "" { err := fmt.Errorf("Error, no method specified.") + return method, err + } + return method, err +} + +// RpcCommand takes a message generated from one of the routines above +// along with the login/server info, sends it, and gets a reply, returning +// a go struct with the result. +func RpcCommand(user string, password string, server string, message []byte) (Reply, error) { + var result Reply + method, err := JSONGetMethod(message) + if err != nil { return result, err } body, err := RpcRawCommand(user, password, server, message) From 2e77f0bb0e0c9ed0e17a78ec940548efd29efe97 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 13 Aug 2013 14:05:08 -0400 Subject: [PATCH 030/229] Add CreateMessageWithId to allow custom id to be sent with message. --- internal_test.go | 6 ++-- jsonapi.go | 71 +++++++++++++++++++++++++++-------------------- test_coverage.txt | 24 ++++++++-------- 3 files changed, 57 insertions(+), 44 deletions(-) diff --git a/internal_test.go b/internal_test.go index 33d51063..12b8ad01 100644 --- a/internal_test.go +++ b/internal_test.go @@ -22,19 +22,19 @@ interface. The functions are only exported while the tests are being run. func TestJsonWithArgs(t *testing.T) { cmd := "list" var args interface{} - _, err := jsonWithArgs(cmd, args) + _, err := jsonWithArgs(cmd, "test", args) if err != nil { t.Errorf("Could not make json with no args. %v", err) } channel := make(chan int) - _, err = jsonWithArgs(cmd, channel) + _, err = jsonWithArgs(cmd, "test", channel) if _, ok := err.(*json.UnsupportedTypeError); !ok { t.Errorf("Message with channel should fail. %v", err) } var comp complex128 - _, err = jsonWithArgs(cmd, comp) + _, err = jsonWithArgs(cmd, "test", comp) if _, ok := err.(*json.UnsupportedTypeError); !ok { t.Errorf("Message with complex part should fail. %v", err) } diff --git a/jsonapi.go b/jsonapi.go index 7b98312d..443afc66 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -159,11 +159,11 @@ type Error struct { Message string `json:"message,omitempty"` } -// jsonWithArgs takes a command and an interface which contains an array -// of the arguments for that command. It knows NOTHING about the commands so -// all error checking of the arguments must happen before it is called. -func jsonWithArgs(command string, args interface{}) ([]byte, error) { - rawMessage := Message{"1.0", "btcd", command, args} +// jsonWithArgs takes a command, an id, and an interface which contains an +// array of the arguments for that command. It knows NOTHING about the commands +// so all error checking of the arguments must happen before it is called. +func jsonWithArgs(command string, id string, args interface{}) ([]byte, error) { + rawMessage := Message{"1.0", id, command, args} finalMessage, err := json.Marshal(rawMessage) if err != nil { return nil, err @@ -178,6 +178,17 @@ func jsonWithArgs(command string, args interface{}) ([]byte, error) { // described at: // https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list func CreateMessage(message string, args ...interface{}) ([]byte, error) { + finalMessage, err := CreateMessageWithId(message, "btcd", args...) + return finalMessage, err +} + +// CreateMessage takes a string, an id, and the optional arguments for it. +// Then, if it is a recognized bitcoin json message, generates the json message +// ready to send off to the daemon or server. +// It is capable of handeling all of the commands from the standard client, +// described at: +// https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list +func CreateMessageWithId(message string, id string, args ...interface{}) ([]byte, error) { var finalMessage []byte var err error // Different commands have different required and optional arguments. @@ -193,7 +204,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Too many arguments for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One optional int case "listaccounts": if len(args) > 1 { @@ -207,7 +218,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required int case "getblockhash": if len(args) != 1 { @@ -219,7 +230,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Argument must be int for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required float case "settxfee": if len(args) != 1 { @@ -231,7 +242,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Argument must be float64 for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One optional string case "getmemorypool", "getnewaddress", "getwork", "help": if len(args) > 1 { @@ -245,7 +256,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required string case "backupwallet", "decoderawtransaction", "dumpprivkey", "encryptwallet", "getaccount", "getaccountaddress", @@ -260,7 +271,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Argument must be string for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Two required strings case "setaccount", "signmessage", "walletpassphrase", "walletpassphrasechange": @@ -274,7 +285,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Three required strings case "verifymessage": if len(args) != 3 { @@ -288,7 +299,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required bool, one optional string case "getaddednodeinfo": if len(args) > 2 || len(args) == 0 { @@ -304,7 +315,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be bool and optionally string for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required bool, one optional int case "setgenerate": if len(args) > 2 || len(args) == 0 { @@ -320,7 +331,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be bool and optionally int for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One optional string, one optional int case "getbalance", "getreceivedbyaccount": if len(args) > 2 { @@ -339,7 +350,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Optional arguments must be string and int for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required string, one optional int case "addnode", "getrawtransaction", "getreceivedbyaddress": if len(args) > 2 || len(args) == 0 { @@ -355,7 +366,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string and optionally int for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One optional int, one optional bool case "listreceivedbyaccount", "listreceivedbyaddress": if len(args) > 2 { @@ -374,7 +385,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Optional arguments must be int and bool for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One optional string, two optional ints case "listtransactions": if len(args) > 3 { @@ -397,7 +408,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Optional arguments must be string and up to two ints for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required string, one optional string, one optional bool case "importprivkey": if len(args) > 3 || len(args) == 0 { @@ -417,7 +428,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string and optionally string and bool for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Two optional ints case "listunspent": if len(args) > 2 { @@ -436,7 +447,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Optional arguments must be ints for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Two optional strings case "listsinceblock": if len(args) > 2 { @@ -455,7 +466,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Optional arguments must be strings for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Two required strings, one required float, one optional int, // two optional strings. @@ -483,7 +494,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string, string, float64 and optionally int and two strings for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Two required strings, one required float, one optional int, // one optional string. case "move": @@ -506,7 +517,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string, string, float64 and optionally int and string for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // One required strings, one required float, two optional strings case "sendtoaddress": if len(args) > 4 || len(args) < 2 { @@ -527,7 +538,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be string, float64 and optionally two strings for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // required int, required pair of keys (string), optional string case "addmultisignaddress": if len(args) > 4 || len(args) < 3 { @@ -545,7 +556,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Arguments must be int, two string and optionally one for %s", message) return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // Must be a set of string, int, string, float (any number of those). case "createrawtransaction": if len(args)%4 != 0 || len(args) == 0 { @@ -571,7 +582,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { vList[i].Vout = vout addresses[add] = amt } - finalMessage, err = jsonWithArgs(message, []interface{}{vList, addresses}) + finalMessage, err = jsonWithArgs(message, id, []interface{}{vList, addresses}) // string, string/float pairs, optional int, and string case "sendmany": if len(args) < 3 { @@ -611,7 +622,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { } } } - finalMessage, err = jsonWithArgs(message, []interface{}{args[0].(string), addresses, minconf, comment}) + finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), addresses, minconf, comment}) // bool and an array of stuff case "lockunspent": if len(args) < 2 { @@ -623,7 +634,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { err = fmt.Errorf("Incorrect arguement types.") return finalMessage, err } - finalMessage, err = jsonWithArgs(message, args) + finalMessage, err = jsonWithArgs(message, id, args) // one required string (hex) and sets of 4 optional strings. case "signrawtransaction": if len(args) < 1 || (len(args)-1)%4 != 0 { @@ -656,7 +667,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { txList[i].ScriptPubKey = spkey pkeyList[i] = pkey } - finalMessage, err = jsonWithArgs(message, []interface{}{args[0].(string), txList, pkeyList}) + finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), txList, pkeyList}) // Any other message default: err = fmt.Errorf("Not a valid command: %s", message) diff --git a/test_coverage.txt b/test_coverage.txt index 1fbd79b9..2b77f721 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,13 +1,15 @@ -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (323/323) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) -github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go RpcCommand 78.26% (18/23) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson --------------- 97.43% (455/467) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 100.00% (323/323) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) +github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) +github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) +github.com/conformal/btcjson ------------------- 97.46% (461/473) From 7a7fa56407005328f81440869a533d0ca486baae Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 13 Aug 2013 17:01:38 -0400 Subject: [PATCH 031/229] Make id an interface in CreateMessageWithId to match the struct better. --- jsonapi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 443afc66..271bae90 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -162,7 +162,7 @@ type Error struct { // jsonWithArgs takes a command, an id, and an interface which contains an // array of the arguments for that command. It knows NOTHING about the commands // so all error checking of the arguments must happen before it is called. -func jsonWithArgs(command string, id string, args interface{}) ([]byte, error) { +func jsonWithArgs(command string, id interface{}, args interface{}) ([]byte, error) { rawMessage := Message{"1.0", id, command, args} finalMessage, err := json.Marshal(rawMessage) if err != nil { @@ -188,7 +188,7 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { // It is capable of handeling all of the commands from the standard client, // described at: // https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list -func CreateMessageWithId(message string, id string, args ...interface{}) ([]byte, error) { +func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([]byte, error) { var finalMessage []byte var err error // Different commands have different required and optional arguments. From 5d40d51672376946bf32ae70921efd870976f2e8 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 14 Aug 2013 10:15:16 -0400 Subject: [PATCH 032/229] Correct bug in walletpassphrase arguements. Thanks to pureveg and hngchiming for pointing it out. --- jsonapi.go | 16 ++++++++++++++-- jsonapi_test.go | 3 +++ test_coverage.txt | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 271bae90..af347d90 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -273,8 +273,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } finalMessage, err = jsonWithArgs(message, id, args) // Two required strings - case "setaccount", "signmessage", "walletpassphrase", - "walletpassphrasechange": + case "setaccount", "signmessage", "walletpassphrasechange": if len(args) != 2 { err = fmt.Errorf("Missing arguments for %s", message) return finalMessage, err @@ -286,6 +285,19 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) + // One required string, one required int + case "walletpassphrase": + if len(args) != 2 { + err = fmt.Errorf("Missing arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + _, ok2 := args[1].(int) + if !ok1 || !ok2 { + err = fmt.Errorf("Arguments must be string and int for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, id, args) // Three required strings case "verifymessage": if len(args) != 3 { diff --git a/jsonapi_test.go b/jsonapi_test.go index 108b032c..e243d2dd 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -168,6 +168,9 @@ var cmdtests = []struct { {"listsinceblock", []interface{}{"test"}, true}, {"listsinceblock", []interface{}{}, true}, {"listsinceblock", []interface{}{1, "test"}, false}, + {"walletpassphrase", []interface{}{"test", 1}, true}, + {"walletpassphrase", []interface{}{"test"}, false}, + {"walletpassphrase", []interface{}{"test", "test"}, false}, {"fakecommand", nil, false}, } diff --git a/test_coverage.txt b/test_coverage.txt index 2b77f721..34190458 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,5 +1,5 @@ -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 100.00% (323/323) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 100.00% (332/332) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) @@ -11,5 +11,5 @@ github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson ------------------- 97.46% (461/473) +github.com/conformal/btcjson ------------------- 97.51% (470/482) From b0ca6d590325a42c870a8511ad2d0c0c11f627ba Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 15 Aug 2013 10:15:25 -0400 Subject: [PATCH 033/229] Fix typo in comment. --- jsonfxns.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonfxns.go b/jsonfxns.go index ccee3661..cc323879 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -46,7 +46,7 @@ func jsonRpcSend(user string, password string, server string, message []byte) (* } // GetRaw should be called after JsonRpcSend. It reads and returns -// the reply (which you can then call readResult() on) and closes the +// the reply (which you can then call ReadResultCmd() on) and closes the // connection. func GetRaw(resp io.ReadCloser) ([]byte, error) { body, err := ioutil.ReadAll(resp) From dc9618c9ab1ec795fb76aaa3edd3aea94fbdfbf0 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 30 Sep 2013 17:13:19 -0400 Subject: [PATCH 034/229] Add a Error() to the Error struct. Resolves #6 --- jsonapi.go | 3 +++ test_coverage.txt | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index af347d90..af693c89 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -6,6 +6,7 @@ package btcjson import ( "encoding/json" + "errors" "fmt" ) @@ -157,6 +158,7 @@ type ListUnSpentResult struct { type Error struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` + Error error `json:"-"` } // jsonWithArgs takes a command, an id, and an interface which contains an @@ -703,6 +705,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { var jsonErr Error var id interface{} err = json.Unmarshal(objmap["error"], &jsonErr) + jsonErr.Error = errors.New(string(jsonErr.Code) + ": " + jsonErr.Message) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) return result, err diff --git a/test_coverage.txt b/test_coverage.txt index 34190458..55d1ee00 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,6 +1,6 @@ github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 100.00% (332/332) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (64/64) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) @@ -11,5 +11,5 @@ github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson ------------------- 97.51% (470/482) +github.com/conformal/btcjson ------------------- 97.52% (471/483) From 5444d262b80de5056fce0d6a9194c0ade3a73268 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 12 Aug 2013 16:01:01 -0400 Subject: [PATCH 035/229] Fix for signrawtransaction. Add sendrawtransaction to list of commands we know the return type for. --- jsonapi.go | 50 ++++++++++++++++++++++++++++++++--------------- jsonapi_test.go | 5 ++--- test_coverage.txt | 4 ++-- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index af693c89..68bb4045 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -649,9 +649,10 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) - // one required string (hex) and sets of 4 optional strings. + // one required string (hex) and optional sets of one string, one int, + // and one string along with another optional string. case "signrawtransaction": - if len(args) < 1 || (len(args)-1)%4 != 0 { + if len(args) < 1 { err = fmt.Errorf("Wrong number of arguments for %s", message) return finalMessage, err } @@ -662,26 +663,42 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } type txlist struct { Txid string `json:"txid"` - Vout string `json:"vout"` + Vout int `json:"vout"` ScriptPubKey string `json:"scriptPubKey"` } - txList := make([]txlist, (len(args)-1)/4) - pkeyList := make([]string, (len(args)-1)/4) - for i := 0; i < len(args)/4; i += 1 { - txid, ok1 := args[(i*4)+0].(string) - vout, ok2 := args[(i*4)+1].(string) - spkey, ok3 := args[(i*4)+2].(string) - pkey, ok4 := args[(i*4)+3].(string) + txList := make([]txlist, 1) + + if len(args) > 1 { + txid, ok2 := args[1].(string) + vout, ok3 := args[2].(int) + spkey, ok4 := args[3].(string) if !ok1 || !ok2 || !ok3 || !ok4 { err = fmt.Errorf("Incorrect arguement types.") return finalMessage, err } - txList[i].Txid = txid - txList[i].Vout = vout - txList[i].ScriptPubKey = spkey - pkeyList[i] = pkey + txList[0].Txid = txid + txList[0].Vout = vout + txList[0].ScriptPubKey = spkey } - finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), txList, pkeyList}) + /* + pkeyList := make([]string, (len(args)-1)/4) + for i := 0; i < len(args)/4; i += 1 { + fmt.Println(args[(i*4)+4]) + txid, ok1 := args[(i*4)+1].(string) + vout, ok2 := args[(i*4)+2].(int) + spkey, ok3 := args[(i*4)+3].(string) + pkey, ok4 := args[(i*4)+4].(string) + if !ok1 || !ok2 || !ok3 || !ok4 { + err = fmt.Errorf("Incorrect arguement types.") + return finalMessage, err + } + txList[i].Txid = txid + txList[i].Vout = vout + txList[i].ScriptPubKey = spkey + pkeyList[i] = pkey + } + */ + finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), txList}) // Any other message default: err = fmt.Errorf("Not a valid command: %s", message) @@ -780,7 +797,8 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { case "getblockcount", "getbalance", "getblocknumber", "getgenerate", "getconnetioncount", "getdifficulty", "gethashespersec", "setgenerate", "stop", "settxfee", "getaccount", - "getnewaddress", "sendtoaddress", "createrawtransaction": + "getnewaddress", "sendtoaddress", "createrawtransaction", + "sendrawtransaction": err = json.Unmarshal(message, &result) // For anything else put it in an interface. All the data is still // there, just a little less convenient to deal with. diff --git a/jsonapi_test.go b/jsonapi_test.go index e243d2dd..bc9076d2 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -156,12 +156,11 @@ var cmdtests = []struct { {"lockunspent", []interface{}{true, "something"}, true}, {"lockunspent", []interface{}{true}, false}, {"lockunspent", []interface{}{1.0, "something"}, false}, - {"signrawtransaction", []interface{}{"hexstring"}, true}, - {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3", "test4"}, true}, + {"signrawtransaction", []interface{}{"hexstring", "test", 1, "test"}, true}, + {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3"}, false}, {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", 1, "test2", "test3", "test4"}, false}, - {"signrawtransaction", []interface{}{"hexstring", "test", 2, "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", 3, "test4"}, false}, {"listsinceblock", []interface{}{"test", "test"}, true}, {"listsinceblock", []interface{}{"test", "test", "test"}, false}, diff --git a/test_coverage.txt b/test_coverage.txt index 55d1ee00..c72b7f48 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,5 +1,4 @@ -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 100.00% (332/332) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (64/64) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) @@ -9,7 +8,8 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 99.39% (327/329) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson ------------------- 97.52% (471/483) +github.com/conformal/btcjson ------------------- 97.08% (466/480) From 7ad6d73416fb3c31f5bfcbb073f93a79ee709089 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 11 Oct 2013 13:18:55 -0400 Subject: [PATCH 036/229] Add support for recent commands: getrawchangeaddress and getbestblockhash. --- jsonapi.go | 7 ++++--- jsonapi_test.go | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 68bb4045..0752a702 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -201,7 +201,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ "getdifficulty", "getgenerate", "gethashespersec", "getinfo", "getmininginfo", "getpeerinfo", "getrawmempool", "keypoolrefill", "listaddressgroupings", "listlockunspent", - "stop", "walletlock": + "stop", "walletlock", "getbestblockhash": if len(args) > 0 { err = fmt.Errorf("Too many arguments for %s", message) return finalMessage, err @@ -246,7 +246,8 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } finalMessage, err = jsonWithArgs(message, id, args) // One optional string - case "getmemorypool", "getnewaddress", "getwork", "help": + case "getmemorypool", "getnewaddress", "getwork", "help", + "getrawchangeaddress": if len(args) > 1 { err = fmt.Errorf("Too many arguments for %s", message) return finalMessage, err @@ -798,7 +799,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { "getconnetioncount", "getdifficulty", "gethashespersec", "setgenerate", "stop", "settxfee", "getaccount", "getnewaddress", "sendtoaddress", "createrawtransaction", - "sendrawtransaction": + "sendrawtransaction", "getbestblockhash", "getrawchangeaddress": err = json.Unmarshal(message, &result) // For anything else put it in an interface. All the data is still // there, just a little less convenient to deal with. diff --git a/jsonapi_test.go b/jsonapi_test.go index bc9076d2..24c076ca 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -170,6 +170,11 @@ var cmdtests = []struct { {"walletpassphrase", []interface{}{"test", 1}, true}, {"walletpassphrase", []interface{}{"test"}, false}, {"walletpassphrase", []interface{}{"test", "test"}, false}, + {"getrawchangeaddress", []interface{}{}, true}, + {"getrawchangeaddress", []interface{}{"something"}, true}, + {"getrawchangeaddress", []interface{}{"something", "test"}, false}, + {"getbestblockhash", []interface{}{}, true}, + {"getbestblockhash", []interface{}{"something"}, false}, {"fakecommand", nil, false}, } From 31489c15b3a178562aa4245a83e353414ddeb044 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 9 Oct 2013 09:44:28 -0400 Subject: [PATCH 037/229] Remove the embedded error and satisify the builtin error interface This also adds tests to verify that the created error string follows the expected format of "code: message" and tests to verify that Error can be used as an error. Additionally, the idiom var _, _ error = Error{}, &Error{} was added so the build will fail if the builtin error interface is never satisified in the future. --- jsonapi.go | 12 +++++++++--- jsonapi_test.go | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 0752a702..30d30578 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -6,7 +6,6 @@ package btcjson import ( "encoding/json" - "errors" "fmt" ) @@ -158,7 +157,15 @@ type ListUnSpentResult struct { type Error struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` - Error error `json:"-"` +} + +// Guarantee Error satisifies the builtin error interface +var _, _ error = Error{}, &Error{} + +// Error returns a string describing the btcjson error. This +// satisifies the builtin error interface. +func (e Error) Error() string { + return fmt.Sprintf("%d: %s", e.Code, e.Message) } // jsonWithArgs takes a command, an id, and an interface which contains an @@ -723,7 +730,6 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { var jsonErr Error var id interface{} err = json.Unmarshal(objmap["error"], &jsonErr) - jsonErr.Error = errors.New(string(jsonErr.Code) + ": " + jsonErr.Message) if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) return result, err diff --git a/jsonapi_test.go b/jsonapi_test.go index 24c076ca..1135d2c0 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -7,6 +7,7 @@ package btcjson_test import ( "bytes" "encoding/json" + "fmt" "github.com/conformal/btcjson" "io" "io/ioutil" @@ -381,3 +382,51 @@ func TestReadResultCmd(t *testing.T) { return } + +// TestErrorInterface tests that the Error type satisifies the builtin +// error interface and tests that the error string is created in the form +// "code: message". +func TestErrorInterface(t *testing.T) { + codes := []int{ + -1, + 0, + 1, + } + messages := []string{ + "parse error", + "error getting field", + "method not found", + } + + // Create an Error and check that both Error and *Error can be used + // as an error. + var jsonError btcjson.Error + var iface interface{} = jsonError + var ifacep interface{} = &jsonError + if _, ok := iface.(error); !ok { + t.Error("cannot type assert Error as error") + return + } + if _, ok := ifacep.(error); !ok { + t.Error("cannot type assert *Error as error") + return + } + + // Verify jsonError is converted to the expected string using a few + // combinations of codes and messages. + for _, code := range codes { + for _, message := range messages { + // Create Error + jsonError := btcjson.Error{ + Code: code, + Message: message, + } + + exp := fmt.Sprintf("%d: %s", jsonError.Code, jsonError.Message) + res := fmt.Sprintf("%v", jsonError) + if exp != res { + t.Errorf("error string '%s' differs from expected '%v'", res, exp) + } + } + } +} From 440f336d349869a00d7367b94caa9606873492c3 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 21 Oct 2013 13:22:52 -0400 Subject: [PATCH 038/229] Correct addnode's required argument type. --- jsonapi.go | 4 ++-- jsonapi_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 30d30578..e1923bca 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -283,7 +283,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } finalMessage, err = jsonWithArgs(message, id, args) // Two required strings - case "setaccount", "signmessage", "walletpassphrasechange": + case "setaccount", "signmessage", "walletpassphrasechange", "addnode": if len(args) != 2 { err = fmt.Errorf("Missing arguments for %s", message) return finalMessage, err @@ -374,7 +374,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } finalMessage, err = jsonWithArgs(message, id, args) // One required string, one optional int - case "addnode", "getrawtransaction", "getreceivedbyaddress": + case "getrawtransaction", "getreceivedbyaddress": if len(args) > 2 || len(args) == 0 { err = fmt.Errorf("Wrong number of argument for %s", message) return finalMessage, err diff --git a/jsonapi_test.go b/jsonapi_test.go index 1135d2c0..2e7b1c73 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -78,9 +78,9 @@ var cmdtests = []struct { {"getbalance", []interface{}{1}, false}, {"addnode", nil, false}, {"addnode", []interface{}{1, 2, 3}, false}, - {"addnode", []interface{}{"test"}, true}, + {"addnode", []interface{}{"test", "test"}, true}, {"addnode", []interface{}{1}, false}, - {"addnode", []interface{}{"test", 1}, true}, + {"addnode", []interface{}{"test", 1}, false}, {"addnode", []interface{}{"test", 1.0}, false}, {"listreceivedbyaccount", nil, true}, {"listreceivedbyaccount", []interface{}{1, 2, 3}, false}, From 850870f14b3ce35da30bb765df5472b6102d9537 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 22 Oct 2013 09:18:55 -0400 Subject: [PATCH 039/229] Fix some doc typos (from oga@) --- jsonapi.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index e1923bca..d3bab377 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -191,11 +191,10 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { return finalMessage, err } -// CreateMessage takes a string, an id, and the optional arguments for it. -// Then, if it is a recognized bitcoin json message, generates the json message -// ready to send off to the daemon or server. -// It is capable of handeling all of the commands from the standard client, -// described at: +// CreateMessageWithId takes a string, an id, and the optional arguments for +// it. Then, if it is a recognized bitcoin json message, generates the json +// message ready to send off to the daemon or server. It is capable of handling +// all of the commands from the standard client, described at: // https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([]byte, error) { var finalMessage []byte From 9ddb768c47601c0ad3838303a9228bd1cc6f9a70 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 22 Oct 2013 09:51:14 -0400 Subject: [PATCH 040/229] Define errors. Define errors (previously done in btcwallet and btcd's rpcserver) in one place so they can just be called by name rather than generated in code using btcjson. Closes #5 --- jsonerr.go | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 jsonerr.go diff --git a/jsonerr.go b/jsonerr.go new file mode 100644 index 00000000..4b8935c7 --- /dev/null +++ b/jsonerr.go @@ -0,0 +1,147 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +// Standard JSON-RPC 2.0 errors +var ( + ErrInvalidRequest = Error{ + Code: -32600, + Message: "Invalid request", + } + ErrMethodNotFound = Error{ + Code: -32601, + Message: "Method not found", + } + ErrInvalidParams = Error{ + Code: -32602, + Message: "Invalid paramaters", + } + ErrInternal = Error{ + Code: -32603, + Message: "Internal error", + } + ErrParse = Error{ + Code: -32700, + Message: "Parse error", + } +) + +// General application defined JSON errors +var ( + ErrMisc = Error{ + Code: -1, + Message: "Miscellaneous error", + } + ErrForbiddenBySafeMode = Error{ + Code: -2, + Message: "Server is in safe mode, and command is not allowed in safe mode", + } + ErrType = Error{ + Code: -3, + Message: "Unexpected type was passed as parameter", + } + ErrInvalidAddressOrKey = Error{ + Code: -5, + Message: "Invalid address or key", + } + ErrOutOfMemory = Error{ + Code: -7, + Message: "Ran out of memory during operation", + } + ErrInvalidParameter = Error{ + Code: -8, + Message: "Invalid, missing or duplicate parameter", + } + ErrDatabase = Error{ + Code: -20, + Message: "Database error", + } + ErrDeserialization = Error{ + Code: -22, + Message: "Error parsing or validating structure in raw format", + } +) + +// Wallet JSON errors +var ( + ErrWallet = Error{ + Code: -4, + Message: "Unspecified problem with wallet", + } + ErrWalletInsufficientFunds = Error{ + Code: -6, + Message: "Not enough funds in wallet or account", + } + ErrWalletInvalidAccountName = Error{ + Code: -11, + Message: "Invalid account name", + } + ErrWalletKeypoolRanOut = Error{ + Code: -12, + Message: "Keypool ran out, call keypoolrefill first", + } + ErrWalletUnlockNeeded = Error{ + Code: -13, + Message: "Enter the wallet passphrase with walletpassphrase first", + } + ErrWalletPassphraseIncorrect = Error{ + Code: -14, + Message: "The wallet passphrase entered was incorrect", + } + ErrWalletWrongEncState = Error{ + Code: -15, + Message: "Command given in wrong wallet encryption state", + } + ErrWalletEncryptionFailed = Error{ + Code: -16, + Message: "Failed to encrypt the wallet", + } + ErrWalletAlreadyUnlocked = Error{ + Code: -17, + Message: "Wallet is already unlocked", + } +) + +// Specific Errors related to commands. These are the ones a user of the rpc +// server are most likely to see. Generally, the codes should match one of the +// more general errors above. +var ( + ErrBlockNotFound = Error{ + Code: -5, + Message: "Block not found", + } + ErrBlockCount = Error{ + Code: -5, + Message: "Error getting block count", + } + ErrBestBlockHash = Error{ + Code: -5, + Message: "Error getting best block hash", + } + ErrDifficulty = Error{ + Code: -5, + Message: "Error getting difficulty", + } + ErrOutOfRange = Error{ + Code: -1, + Message: "Block number out of range", + } + ErrNoTxInfo = Error{ + Code: -5, + Message: "No information available about transaction", + } + ErrNoNewestBlockInfo = Error{ + Code: -5, + Message: "No information about newest block", + } + ErrRawTxString = Error{ + Code: -32602, + Message: "Raw tx is not a string", + } + ErrDecodeHexString = Error{ + Code: -22, + Message: "Unable to decode hex string", + } +) From cbd3d730a91fa92a851aa4aa97053a0dc628e8c4 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 22 Oct 2013 15:11:01 -0400 Subject: [PATCH 041/229] Add initial support for submitblock command. Closes #7 --- jsonapi.go | 19 +++++++++++++++++++ jsonapi_test.go | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index d3bab377..5ab57f2c 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -388,6 +388,25 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) + // One required string, one optional string + // Strictly, the optional arg for submit block is an object, but + // bitcoind ignores it for now, so best to just allow string until + // support for it is complete. + case "submitblock": + if len(args) > 2 || len(args) == 0 { + err = fmt.Errorf("Wrong number of argument for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + ok2 := true + if len(args) == 2 { + _, ok2 = args[1].(string) + } + if !ok1 || !ok2 { + err = fmt.Errorf("Arguments must be string and optionally string for %s", message) + return finalMessage, err + } + finalMessage, err = jsonWithArgs(message, id, args) // One optional int, one optional bool case "listreceivedbyaccount", "listreceivedbyaddress": if len(args) > 2 { diff --git a/jsonapi_test.go b/jsonapi_test.go index 2e7b1c73..dc35de58 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -176,6 +176,11 @@ var cmdtests = []struct { {"getrawchangeaddress", []interface{}{"something", "test"}, false}, {"getbestblockhash", []interface{}{}, true}, {"getbestblockhash", []interface{}{"something"}, false}, + {"submitblock", []interface{}{}, false}, + {"submitblock", []interface{}{"something"}, true}, + {"submitblock", []interface{}{"something", "something else"}, true}, + {"submitblock", []interface{}{"something", "something else", "more"}, false}, + {"submitblock", []interface{}{"something", 1}, false}, {"fakecommand", nil, false}, } From 6227c446d3a9871f66a84763adff83091022686f Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Tue, 22 Oct 2013 15:12:12 +0100 Subject: [PATCH 042/229] Add a framewowrk for parsing and creating json commands. Initial prototype for one command mostly from jrick, with discussion with me and jcv. Other commands mocked up in a couple of long boring days by yours truly. Code isn't fully tested yet so may well still be buggy in the type conversions. Test will be added over the next few days to get this up to snuff. --- jsoncmd.go | 6464 +++++++++++++++++++++++++++++++++++++++++++++++ jsoncmd_test.go | 193 ++ 2 files changed, 6657 insertions(+) create mode 100644 jsoncmd.go create mode 100644 jsoncmd_test.go diff --git a/jsoncmd.go b/jsoncmd.go new file mode 100644 index 00000000..0fcf1ce9 --- /dev/null +++ b/jsoncmd.go @@ -0,0 +1,6464 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "encoding/json" + "errors" +) + +// ErrTooManyOptArgs describes an error where too many optional +// arguments were passed when creating a new Cmd. +var ErrTooManyOptArgs = errors.New("too many optional arguments") + +// ErrWrongNumberOfParams describes an error where an incorrect number of +// parameters are found in an unmarshalled command. +var ErrWrongNumberOfParams = errors.New("incorrect number of parameters") + +// Cmd is an interface for all Bitcoin JSON API commands to marshal +// and unmarshal as a JSON object. +type Cmd interface { + json.Marshaler + json.Unmarshaler + Id() interface{} + Method() string +} + +// RawCmd is a type for unmarshaling raw commands into before the +// custom command type is set. Other packages may register their +// own RawCmd to Cmd converters by calling RegisterCustomCmd. +type RawCmd struct { + Jsonrpc string `json:"jsonrpc"` + Id interface{} `json:"id"` + Method string `json:"method"` + Params []interface{} `json:"params"` +} + +// ParseRawCmd is a function to create a custom Cmd from a RawCmd. +type RawCmdParser func(*RawCmd) (Cmd, error) + +var customCmds = make(map[string]RawCmdParser) + +// RegisterCustomCmd registers a custom RawCmd parsing func for a +// non-standard Bitcoin command. +func RegisterCustomCmd(method string, parser RawCmdParser) { + customCmds[method] = parser +} + +// ParseMarshaledCmd parses a raw command and unmarshals as a Cmd. +// Code that reads and handles commands should switch on the type and +// type assert as the particular commands supported by the program. +func ParseMarshaledCmd(b []byte) (Cmd, error) { + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return nil, err + } + + // Return a custom command type for recognized + var cmd Cmd = nil + switch r.Method { + case "addmultisigaddress": + cmd = new(AddMultisigAddressCmd) + + case "addnode": + cmd = new(AddNodeCmd) + + case "backupwallet": + cmd = new(BackupWalletCmd) + + case "createmultisig": + cmd = new(CreateMultisigCmd) + + case "createrawtransaction": + cmd = new(CreateRawTransactionCmd) + + case "decoderawtransaction": + cmd = new(DecodeRawTransactionCmd) + + case "decodescript": + cmd = new(DecodeScriptCmd) + + case "dumpprivkey": + cmd = new(DumpPrivKeyCmd) + + case "dumpwallet": + cmd = new(DumpWalletCmd) + + case "encryptwallet": + cmd = new(EncryptWalletCmd) + + case "getaccount": + cmd = new(GetAccountCmd) + + case "getaccountaddress": + cmd = new(GetAccountAddressCmd) + + case "getaddednodeinfo": + cmd = new(GetAddedNodeInfoCmd) + + case "getaddressesbyaccount": + cmd = new(GetAddressesByAccountCmd) + + case "getbalance": + cmd = new(GetBalanceCmd) + + case "getbestblockhash": + cmd = new(GetBestBlockHashCmd) + + case "getblock": + cmd = new(GetBlockCmd) + + case "getblockcount": + cmd = new(GetBlockCountCmd) + + case "getblockhash": + cmd = new(GetBlockHashCmd) + + case "getblocktemplate": + cmd = new(GetBlockTemplateCmd) + + case "getconnectioncount": + cmd = new(GetConnectionCountCmd) + + case "getdifficulty": + cmd = new(GetDifficultyCmd) + + case "getgenerate": + cmd = new(GetGenerateCmd) + + case "gethashespersec": + cmd = new(GetHashesPerSecCmd) + + case "getinfo": + cmd = new(GetInfoCmd) + + case "getnettotals": + cmd = new(GetNetTotalsCmd) + + case "getnetworkhashps": + cmd = new(GetNetworkHashPSCmd) + + case "getnewaddress": + cmd = new(GetNewAddressCmd) + + case "getpeerinfo": + cmd = new(GetPeerInfoCmd) + + case "getrawchangeaddress": + cmd = new(GetRawChangeAddressCmd) + + case "getrawmempool": + cmd = new(GetRawMempoolCmd) + + case "getrawtransaction": + cmd = new(GetRawTransactionCmd) + + case "getreceivedbyaccount": + cmd = new(GetReceivedByAccountCmd) + + case "getreceivedbyaddress": + cmd = new(GetReceivedByAddressCmd) + + case "gettransaction": + cmd = new(GetTransactionCmd) + + case "gettxout": + cmd = new(GetTxOutCmd) + + case "gettxoutsetinfo": + cmd = new(GetTxOutSetInfoCmd) + + case "getwork": + cmd = new(GetWorkCmd) + + case "help": + cmd = new(HelpCmd) + + case "importprivkey": + cmd = new(ImportPrivKeyCmd) + + case "importwallet": + cmd = new(ImportWalletCmd) + + case "keypoolrefill": + cmd = new(KeyPoolRefillCmd) + + case "listaccounts": + cmd = new(ListAccountsCmd) + + case "listaddressgroupings": + cmd = new(ListAddressGroupingsCmd) + + case "listlockunspent": + cmd = new(ListLockUnspentCmd) + + case "listreceivedbyaccount": + cmd = new(ListReceivedByAccountCmd) + + case "listreceivedbyaddress": + cmd = new(ListReceivedByAddressCmd) + + case "listsinceblock": + cmd = new(ListSinceBlockCmd) + + case "listtransactions": + cmd = new(ListTransactionsCmd) + + case "listunspent": + cmd = new(ListUnspentCmd) + + case "lockunspent": + cmd = new(LockUnspentCmd) + + case "move": + cmd = new(MoveCmd) + + case "ping": + cmd = new(PingCmd) + + case "sendfrom": + cmd = new(SendFromCmd) + + case "sendmany": + cmd = new(SendManyCmd) + + case "sendrawtransaction": + cmd = new(SendRawTransactionCmd) + + case "sendtoaddress": + cmd = new(SendToAddressCmd) + + case "setaccount": + cmd = new(SetAccountCmd) + + case "setgenerate": + cmd = new(SetGenerateCmd) + + case "settxfee": + cmd = new(SetTxFeeCmd) + + case "signmessage": + cmd = new(SignMessageCmd) + + case "signrawtransaction": + cmd = new(SignRawTransactionCmd) + + case "stop": + cmd = new(StopCmd) + + case "submitblock": + cmd = new(SubmitBlockCmd) + + case "validateaddress": + cmd = new(ValidateAddressCmd) + + case "verifychain": + cmd = new(VerifyChainCmd) + + case "verifymessage": + cmd = new(VerifyMessageCmd) + + case "walletlock": + cmd = new(WalletLockCmd) + + case "walletpassphrase": + cmd = new(WalletPassphraseCmd) + + case "walletpassphrasechange": + cmd = new(WalletPassphraseChangeCmd) + + default: + // None of the standard Bitcoin RPC methods matched. Try + // registered custom commands. + if f, ok := customCmds[r.Method]; ok { + return f(&r) + } + } + + if cmd == nil { + return nil, errors.New("unimplemented") + } + + // If we get here we have a cmd that can unmarshal itself. + if err := cmd.UnmarshalJSON(b); err != nil { + return nil, err + } else { + return cmd, nil + } +} + +// AddMultisigAddressCmd is a type handling custom marshaling and +// unmarshaling of addmultisigaddress JSON RPC commands. +type AddMultisigAddressCmd struct { + id interface{} + NRequired int + Keys []string + Account string +} + +// Enforce that AddMultisigAddress satisifies the Cmd interface. +var _ Cmd = &AddMultisigAddressCmd{} + +// NewAddMultisigAddressCmd creates a new AddMultisigAddressCmd, +// parsing the optional arguments optArgs which may be either empty or an +// optional account name. +func NewAddMultisigAddressCmd(id interface{}, nRequired int, keys []string, + optArgs ...string) (*AddMultisigAddressCmd, error) { + // Optional parameters set to their defaults. + var account string + + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + account = optArgs[0] + } + + return &AddMultisigAddressCmd{ + id: id, + NRequired: nRequired, + Keys: keys, + Account: account, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *AddMultisigAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *AddMultisigAddressCmd) Method() string { + return "addmultisigaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *AddMultisigAddressCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "addmultisigaddress", + Id: cmd.id, + Params: []interface{}{ + cmd.NRequired, + cmd.Keys, + }, + } + + if cmd.Account != "" { + raw.Params = append(raw.Params, cmd.Account) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *AddMultisigAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) < 2 || len(r.Params) > 3 { + return ErrWrongNumberOfParams + } + nRequired, ok := r.Params[0].(float64) + if !ok { + return errors.New("first parameter nrequired must be a number") + } + ikeys, ok := r.Params[1].([]interface{}) + if !ok { + return errors.New("second parameter keys must be an array") + } + keys := make([]string, len(ikeys)) + for i, val := range(ikeys) { + keys[i], ok = val.(string) + if !ok { + return errors.New("second parameter keys must be an array of strings") + } + } + var account string + if len(r.Params) > 2 { + account, ok = r.Params[2].(string) + if !ok { + return errors.New("third (optional) parameter account must be a string") + } + } + newCmd, err := NewAddMultisigAddressCmd(r.Id, int(nRequired), keys, + account) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// AddNodeCmd is a type handling custom marshaling and +// unmarshaling of addmultisigaddress JSON RPC commands. +type AddNodeCmd struct { + id interface{} + Addr string + SubCmd string // One of "add","remove","onetry". TODO(oga) enum? +} + +// Enforce that AddNodeCmd satisifies the Cmd interface. +var _ Cmd = &AddNodeCmd{} + +// NewAddNodeCmd creates a new AddNodeCmd for the given address and subcommand. +func NewAddNodeCmd(id interface{}, addr string, subcmd string) ( + *AddNodeCmd, error) { + + switch subcmd { + case "add": + // fine + case "remove": + // fine + case "onetry": + // fine + default: + return nil, errors.New("Invalid subcommand for addnode") + } + + return &AddNodeCmd{ + id: id, + Addr: addr, + SubCmd: subcmd, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *AddNodeCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *AddNodeCmd) Method() string { + return "addnode" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *AddNodeCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "addnode", + Id: cmd.id, + Params: []interface{}{ + cmd.Addr, + cmd.SubCmd, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *AddNodeCmd) UnmarshalJSON(b []byte) error { + // Unmarshal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 { + return ErrWrongNumberOfParams + } + addr, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter addr must be a string") + } + subcmd, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter subcmd must be a string") + } + newCmd, err := NewAddNodeCmd(r.Id, addr, subcmd) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// BackupWalletCmd is a type handling custom marshaling and +// unmarshaling of backupwallet JSON RPC commands. +type BackupWalletCmd struct { + id interface{} + Destination string +} + +// Enforce that BackupWalletCmd satisifies the Cmd interface. +var _ Cmd = &BackupWalletCmd{} + +// NewBackupWalletCmd creates a new BackupWalletCmd. +func NewBackupWalletCmd(id interface{}, path string) (*BackupWalletCmd, error) { + + return &BackupWalletCmd{ + id: id, + Destination: path, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *BackupWalletCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *BackupWalletCmd) Method() string { + return "backupwallet" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *BackupWalletCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "backupwallet", + Id: cmd.id, + Params: []interface{}{ + cmd.Destination, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *BackupWalletCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + destination, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter desitnation must be a string") + } + newCmd, err := NewBackupWalletCmd(r.Id, destination) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// CreateMultisigCmd is a type handling custom marshaling and +// unmarshaling of createmultisig JSON RPC commands. +type CreateMultisigCmd struct { + id interface{} + NRequired int + Keys []string +} + +// Enforce that AddMultisigAddress satisifies the Cmd interface. +var _ Cmd = &CreateMultisigCmd{} + +// NewCreateMultisigCmd creates a new CreateMultisigCmd, +// parsing the optional arguments optArgs. +func NewCreateMultisigCmd(id interface{}, nRequired int, keys []string) (*CreateMultisigCmd, error) { + return &CreateMultisigCmd{ + id: id, + NRequired: nRequired, + Keys: keys, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *CreateMultisigCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *CreateMultisigCmd) Method() string { + return "createmultisig" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *CreateMultisigCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "createmultisig", + Id: cmd.id, + Params: []interface{}{ + cmd.NRequired, + cmd.Keys, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *CreateMultisigCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 { + return ErrWrongNumberOfParams + } + nRequired, ok := r.Params[0].(float64) + if !ok { + return errors.New("first parameter nrequired must be a number") + } + + ikeys, ok := r.Params[1].([]interface{}) + if !ok { + return errors.New("second parameter keys must be an array") + } + keys := make([]string, len(ikeys)) + for i, val := range(ikeys) { + keys[i], ok = val.(string) + if !ok { + return errors.New("second parameter keys must be an array of strings") + } + } + + newCmd, err := NewCreateMultisigCmd(r.Id, int(nRequired), keys) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// TransactionInput represents the inputs to a transaction. Specifically a +// transactionsha and output number pair. +type TransactionInput struct { + Txid string `json:"txid"` + Vout int `json:"vout"` +} + +// CreateRawTransactionCmd is a type handling custom marshaling and +// unmarshaling of createrawtransaction JSON RPC commands. +type CreateRawTransactionCmd struct { + id interface{} + Inputs []TransactionInput + Amounts map[string]int64 +} + +// Enforce that CreateRawTransactionCmd satisifies the Cmd interface. +var _ Cmd = &CreateRawTransactionCmd{} + +// NewCreateRawTransactionCmd creates a new CreateRawTransactionCmd. +func NewCreateRawTransactionCmd(id interface{}, inputs []TransactionInput, amounts map[string]int64) (*CreateRawTransactionCmd, error) { + return &CreateRawTransactionCmd{ + id: id, + Inputs: inputs, + Amounts: amounts, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *CreateRawTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *CreateRawTransactionCmd) Method() string { + return "createrawtransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *CreateRawTransactionCmd) MarshalJSON() ([]byte, error) { + floatAmount := make(map[string]float64) + + for k, v := range cmd.Amounts { + floatAmount[k] = float64(v) / 1e8 + } + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "createrawtransaction", + Id: cmd.id, + Params: []interface{}{ + cmd.Inputs, + floatAmount, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *CreateRawTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 { + return ErrWrongNumberOfParams + } + iinputs, ok := r.Params[0].([]interface{}) + if !ok { + return errors.New("first parameter inputs must be an array") + } + inputs := make([]TransactionInput, len(iinputs)) + for i, iv := range iinputs { + v, ok := iv.(map[string]interface{}) + if !ok { + return errors.New("first parameter inputs must be an array of objects") + } + + if len(v) != 2 { + return errors.New("input with wrong number of members") + } + txid, ok := v["txid"] + if !ok { + return errors.New("input without txid") + } + inputs[i].Txid, ok = txid.(string) + if !ok { + return errors.New("input txid isn't a string") + } + + vout, ok := v["vout"] + if !ok { + return errors.New("input without vout") + } + fvout, ok := vout.(float64) + if !ok { + return errors.New("input vout not a number") + } + inputs[i].Vout = int(fvout) + } + cmd.Inputs = inputs + famounts, ok := r.Params[1].(map[string]interface{}) + if !ok { + return errors.New("second parameter keys must be a map") + } + + amounts := make(map[string]int64) + for k, v := range famounts { + fv, ok := v.(float64) + if !ok { + return errors.New("second parameter keys must be a number map") + } + var err error + amounts[k], err = JSONToAmount(fv) + if err != nil { + return err + } + } + + newCmd, err := NewCreateRawTransactionCmd(r.Id, inputs, amounts) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// DecodeRawTransactionCmd is a type handling custom marshaling and +// unmarshaling of decoderawtransaction JSON RPC commands. +type DecodeRawTransactionCmd struct { + id interface{} + HexTx string +} + +// Enforce that DecodeRawTransactionCmd satisifies the Cmd interface. +var _ Cmd = &DecodeRawTransactionCmd{} + +// NewDecodeRawTransactionCmd creates a new DecodeRawTransactionCmd. +func NewDecodeRawTransactionCmd(id interface{}, hextx string) (*DecodeRawTransactionCmd, error) { + return &DecodeRawTransactionCmd{ + id: id, + HexTx: hextx, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *DecodeRawTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *DecodeRawTransactionCmd) Method() string { + return "decoderawtransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *DecodeRawTransactionCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "decoderawtransaction", + Id: cmd.id, + Params: []interface{}{ + cmd.HexTx, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *DecodeRawTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + hextx, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter hextx must be an array of objects") + } + + newCmd, err := NewDecodeRawTransactionCmd(r.Id, hextx) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// DecodeScriptCmd is a type handling custom marshaling and +// unmarshaling of decodescript JSON RPC commands. +type DecodeScriptCmd struct { + id interface{} + HexScript string +} + +// Enforce that DecodeScriptCmd satisifies the Cmd interface. +var _ Cmd = &DecodeScriptCmd{} + +// NewDecodeScriptCmd creates a new DecodeScriptCmd. +func NewDecodeScriptCmd(id interface{}, hexscript string) (*DecodeScriptCmd, error) { + return &DecodeScriptCmd{ + id: id, + HexScript: hexscript, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *DecodeScriptCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *DecodeScriptCmd) Method() string { + return "decodescript" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *DecodeScriptCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "decodescript", + Id: cmd.id, + Params: []interface{}{ + cmd.HexScript, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *DecodeScriptCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + hexscript, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter hexscript must be an array of objects") + } + + newCmd, err := NewDecodeScriptCmd(r.Id, hexscript) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// DumpPrivKeyCmd is a type handling custom marshaling and +// unmarshaling of dumpprivkey JSON RPC commands. +type DumpPrivKeyCmd struct { + id interface{} + Address string +} + +// Enforce that DumpPrivKeyCmd satisifies the Cmd interface. +var _ Cmd = &DumpPrivKeyCmd{} + +// NewDumpPrivKeyCmd creates a new DumpPrivkeyCmd. +func NewDumpPrivKeyCmd(id interface{}, address string) (*DumpPrivKeyCmd, error) { + return &DumpPrivKeyCmd{ + id: id, + Address: address, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *DumpPrivKeyCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *DumpPrivKeyCmd) Method() string { + return "dumpprivkey" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *DumpPrivKeyCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "dumpprivkey", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *DumpPrivKeyCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be an array of objects") + } + + newCmd, err := NewDumpPrivKeyCmd(r.Id, address) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// DumpWalletCmd is a type handling custom marshaling and +// unmarshaling of dumpwallet JSON RPC commands. +type DumpWalletCmd struct { + id interface{} + Filename string +} + +// Enforce that DumpWalletCmd satisifies the Cmd interface. +var _ Cmd = &DumpWalletCmd{} + +// NewDumpWalletCmd creates a new DumpPrivkeyCmd. +func NewDumpWalletCmd(id interface{}, filename string) (*DumpWalletCmd, error) { + return &DumpWalletCmd{ + id: id, + Filename: filename, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *DumpWalletCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *DumpWalletCmd) Method() string { + return "dumpwallet" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *DumpWalletCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "dumpwallet", + Id: cmd.id, + Params: []interface{}{ + cmd.Filename, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *DumpWalletCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + filename, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter filename must be an array of objects") + } + + newCmd, err := NewDumpWalletCmd(r.Id, filename) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// EncryptWalletCmd is a type handling custom marshaling and +// unmarshaling of ecryptwallet JSON RPC commands. +type EncryptWalletCmd struct { + id interface{} + Passphrase string +} + +// Enforce that EncryptWalletCmd satisifies the Cmd interface. +var _ Cmd = &EncryptWalletCmd{} + +// NewEncryptWalletCmd creates a new EncryptWalletCmd. +func NewEncryptWalletCmd(id interface{}, passphrase string) (*EncryptWalletCmd, error) { + return &EncryptWalletCmd{ + id: id, + Passphrase: passphrase, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *EncryptWalletCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *EncryptWalletCmd) Method() string { + return "encryptwallet" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *EncryptWalletCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "encryptwallet", + Id: cmd.id, + Params: []interface{}{ + cmd.Passphrase, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *EncryptWalletCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + passphrase, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter passphrase must be a string") + } + + newCmd, err := NewEncryptWalletCmd(r.Id, passphrase) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetAccountCmd is a type handling custom marshaling and +// unmarshaling of getaccount JSON RPC commands. +type GetAccountCmd struct { + id interface{} + Address string +} + +// Enforce that GetAccountCmd satisifies the Cmd interface. +var _ Cmd = &GetAccountCmd{} + +// NewGetAccountCmd creates a new GetAccountCmd. +func NewGetAccountCmd(id interface{}, address string) (*GetAccountCmd, error) { + return &GetAccountCmd{ + id: id, + Address: address, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetAccountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetAccountCmd) Method() string { + return "getaccount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetAccountCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getaccount", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetAccountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be a string") + } + + newCmd, err := NewGetAccountCmd(r.Id, address) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetAccountAddressCmd is a type handling custom marshaling and +// unmarshaling of getaccountaddress JSON RPC commands. +type GetAccountAddressCmd struct { + id interface{} + Account string +} + +// Enforce that GetAccountAddressCmd satisifies the Cmd interface. +var _ Cmd = &GetAccountAddressCmd{} + +// NewGetAccountAddressCmd creates a new GetAccountAddressCmd. +func NewGetAccountAddressCmd(id interface{}, account string) (*GetAccountAddressCmd, error) { + return &GetAccountAddressCmd{ + id: id, + Account: account, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetAccountAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetAccountAddressCmd) Method() string { + return "getaccountaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetAccountAddressCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "accountaddress", + Id: cmd.id, + Params: []interface{}{ + cmd.Account, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetAccountAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter account must be a string") + } + + newCmd, err := NewGetAccountAddressCmd(r.Id, account) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetAddedNodeInfoCmd is a type handling custom marshaling and +// unmarshaling of getaddednodeinfo JSON RPC commands. +type GetAddedNodeInfoCmd struct { + id interface{} + Dns bool + Node string +} + +// Enforce that GetAddedNodeInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetAddedNodeInfoCmd{} + +// NewGetAddedNodeInfoCmd creates a new GetAddedNodeInfoCmd. Optionally the +// node to be queried may be provided. More than one optonal argument is an +// error. +func NewGetAddedNodeInfoCmd(id interface{}, dns bool, optArgs ...string) (*GetAddedNodeInfoCmd, error) { + var node string + + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + node = optArgs[1] + } + return &GetAddedNodeInfoCmd{ + id: id, + Dns: dns, + Node: node, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetAddedNodeInfoCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetAddedNodeInfoCmd) Method() string { + return "getaddednodeinfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetAddedNodeInfoCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + var raw RawCmd + if cmd.Node == "" { + raw = RawCmd{ + Jsonrpc: "1.0", + Method: "getaddednodeinfo", + Id: cmd.id, + Params: []interface{}{ + cmd.Dns, + }, + } + } else { + raw = RawCmd{ + Jsonrpc: "1.0", + Method: "getaddednodeinfo", + Id: cmd.id, + Params: []interface{}{ + cmd.Dns, + cmd.Node, + }, + } + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetAddedNodeInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) < 1 || len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + dns, ok := r.Params[0].(bool) + if !ok { + return errors.New("first parameter dns must be a bool") + } + + var node string + if len(r.Params) == 2 { + node, ok = r.Params[1].(string) + if !ok { + return errors.New("second parameter node must be a string") + } + + } + + newCmd, err := NewGetAddedNodeInfoCmd(r.Id, dns, node) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetAddressesByAccountCmd is a type handling custom marshaling and +// unmarshaling of getaddressesbyaccount JSON RPC commands. +type GetAddressesByAccountCmd struct { + id interface{} + Account string +} + +// Enforce that GetAddressesByAccountCmd satisifies the Cmd interface. +var _ Cmd = &GetAddressesByAccountCmd{} + +// NewGetAddressesByAccountCmd creates a new GetAddressesByAccountCmd. +func NewGetAddressesByAccountCmd(id interface{}, account string) (*GetAddressesByAccountCmd, error) { + return &GetAddressesByAccountCmd{ + id: id, + Account: account, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetAddressesByAccountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetAddressesByAccountCmd) Method() string { + return "getaddressesbyaccount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetAddressesByAccountCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getaddressesbyaccount", + Id: cmd.id, + Params: []interface{}{ + cmd.Account, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetAddressesByAccountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter account must be a string") + } + + newCmd, err := NewGetAddressesByAccountCmd(r.Id, account) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetBalanceCmd is a type handling custom marshaling and +// unmarshaling of getbalance JSON RPC commands. +type GetBalanceCmd struct { + id interface{} + Account string + Minconf int +} + +// Enforce that GetBalanceCmd satisifies the Cmd interface. +var _ Cmd = &GetBalanceCmd{} + +// NewGetBalanceCmd creates a new GetBalanceCmd. Optionally a string for account +// and an int for minconf may be provided as arguments. +func NewGetBalanceCmd(id interface{}, optArgs ...interface{}) (*GetBalanceCmd, error) { + var account string + var minconf int = 1 + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + if len(optArgs) > 0 { + a, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("first optional argument account is not a string") + } + account = a + } + + if len(optArgs) > 1 { + m, ok := optArgs[1].(int) + if !ok { + return nil, errors.New("second optional argument minconf is not a int") + } + minconf = m + } + + return &GetBalanceCmd{ + id: id, + Account: account, + Minconf: minconf, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBalanceCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBalanceCmd) Method() string { + return "getbalance" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBalanceCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getbalance", + Id: cmd.id, + Params: []interface{}{ + cmd.Account, + }, + } + + if cmd.Account != "" || cmd.Minconf != 1 { + raw.Params = append(raw.Params, cmd.Account) + } + if cmd.Minconf != 1 { + raw.Params = append(raw.Params, cmd.Minconf) + } + + // Fill and marshal a RawCmd. + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBalanceCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 0 { + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter account must be a string") + } + optArgs = append(optArgs, account) + } + + if len(r.Params) > 1 { + minconf, ok := r.Params[1].(float64) + if !ok { + return errors.New("first optional parameter minconf must be a number") + } + optArgs = append(optArgs, int(minconf)) + } + + newCmd, err := NewGetBalanceCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetBestBlockHashCmd is a type handling custom marshaling and +// unmarshaling of getbestblockhash JSON RPC commands. +type GetBestBlockHashCmd struct { + id interface{} +} + +// Enforce that GetBestBlockHashCmd satisifies the Cmd interface. +var _ Cmd = &GetBestBlockHashCmd{} + +// NewGetBestBlockHashCmd creates a new GetBestBlockHashCmd. +func NewGetBestBlockHashCmd(id interface{}) (*GetBestBlockHashCmd, error) { + return &GetBestBlockHashCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBestBlockHashCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBestBlockHashCmd) Method() string { + return "getbestblockhash" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBestBlockHashCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getbestblockhash", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBestBlockHashCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetBestBlockHashCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetBlockCmd is a type handling custom marshaling and +// unmarshaling of getblock JSON RPC commands. +type GetBlockCmd struct { + id interface{} + Hash string +} + +// Enforce that GetBlockCmd satisifies the Cmd interface. +var _ Cmd = &GetBlockCmd{} + +// NewGetBlockCmd creates a new GetBlockCmd. +func NewGetBlockCmd(id interface{}, hash string) (*GetBlockCmd, error) { + return &GetBlockCmd{ + id: id, + Hash: hash, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBlockCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBlockCmd) Method() string { + return "getblock" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBlockCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getblock", + Id: cmd.id, + Params: []interface{}{ + cmd.Hash, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBlockCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + hash, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter hash must be a string") + } + + newCmd, err := NewGetBlockCmd(r.Id, hash) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetBlockCountCmd is a type handling custom marshaling and +// unmarshaling of getblockcount JSON RPC commands. +type GetBlockCountCmd struct { + id interface{} +} + +// Enforce that GetBlockCountCmd satisifies the Cmd interface. +var _ Cmd = &GetBlockCountCmd{} + +// NewGetBlockCountCmd creates a new GetBlockCountCmd. +func NewGetBlockCountCmd(id interface{}) (*GetBlockCountCmd, error) { + return &GetBlockCountCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBlockCountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBlockCountCmd) Method() string { + return "getblockcount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBlockCountCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getblockcount", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBlockCountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetBlockCountCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetBlockHashCmd is a type handling custom marshaling and +// unmarshaling of getblockhash JSON RPC commands. +type GetBlockHashCmd struct { + id interface{} + Index int64 +} + +// Enforce that GetBlockHashCmd satisifies the Cmd interface. +var _ Cmd = &GetBlockHashCmd{} + +// NewGetBlockHashCmd creates a new GetBlockHashCmd. +func NewGetBlockHashCmd(id interface{}, index int64) (*GetBlockHashCmd, error) { + return &GetBlockHashCmd{ + id: id, + Index: index, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBlockHashCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBlockHashCmd) Method() string { + return "getblockhash" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBlockHashCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getblockhash", + Id: cmd.id, + Params: []interface{}{ + cmd.Index, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBlockHashCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + hash, ok := r.Params[0].(float64) + if !ok { + return errors.New("first parameter hash must be a number") + } + + newCmd, err := NewGetBlockHashCmd(r.Id, int64(hash)) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// TemplateRequest is a request object as defined in BIP22 +// (https://en.bitcoin.it/wiki/BIP_0022), it is optionally provided as an +// pointer argument to GetBlockTemplateCmd. +type TemplateRequest struct { + Mode string `json:"mode,omitempty"` + Capabilities []string `json:"capabilities"` +} + +// GetBlockTemplateCmd is a type handling custom marshaling and +// unmarshaling of getblocktemplate JSON RPC commands. +type GetBlockTemplateCmd struct { + id interface{} + Request *TemplateRequest +} + +// Enforce that GetBlockTemplateCmd satisifies the Cmd interface. +var _ Cmd = &GetBlockTemplateCmd{} + +// NewGetBlockTemplateCmd creates a new GetBlockTemplateCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewGetBlockTemplateCmd(id interface{}, optArgs ...*TemplateRequest) (*GetBlockTemplateCmd, error) { + var request *TemplateRequest + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + request = optArgs[0] + } + return &GetBlockTemplateCmd{ + id: id, + Request: request, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBlockTemplateCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBlockTemplateCmd) Method() string { + return "getblocktemplate" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBlockTemplateCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getblocktemplate", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Request != nil { + raw.Params = append(raw.Params, cmd.Request) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBlockTemplateCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 1 { + return ErrWrongNumberOfParams + } + optArgs := make([]*TemplateRequest, 0, 1) + if len(r.Params) > 0 { + rmap, ok := r.Params[0].(map[string]interface{}) + if !ok { + return errors.New("first optional parameter template request must be an object") + } + + trequest := new(TemplateRequest) + // optional mode string. + mode, ok := rmap["mode"] + if ok { + smode, ok := mode.(string) + if !ok { + return errors.New("TemplateRequest mode must be a string") + } + trequest.Mode = smode + } + + capabilities, ok := rmap["capabilities"] + if ok { + scap, ok := capabilities.([]string) + if !ok { + return errors.New("TemplateRequest mode must be a string array") + } + trequest.Capabilities = scap + } + + optArgs = append(optArgs, trequest) + } + + newCmd, err := NewGetBlockTemplateCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetConnectionCountCmd is a type handling custom marshaling and +// unmarshaling of getconnectioncount JSON RPC commands. +type GetConnectionCountCmd struct { + id interface{} +} + +// Enforce that GetConnectionCountCmd satisifies the Cmd interface. +var _ Cmd = &GetConnectionCountCmd{} + +// NewGetConnectionCountCmd creates a new GetConnectionCountCmd. +func NewGetConnectionCountCmd(id interface{}) (*GetConnectionCountCmd, error) { + return &GetConnectionCountCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetConnectionCountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetConnectionCountCmd) Method() string { + return "getconnectioncount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetConnectionCountCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getconnectioncount", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetConnectionCountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetConnectionCountCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetDifficultyCmd is a type handling custom marshaling and +// unmarshaling of getdifficulty JSON RPC commands. +type GetDifficultyCmd struct { + id interface{} +} + +// Enforce that GetDifficultyCmd satisifies the Cmd interface. +var _ Cmd = &GetDifficultyCmd{} + +// NewGetDifficultyCmd creates a new GetDifficultyCmd. +func NewGetDifficultyCmd(id interface{}) (*GetDifficultyCmd, error) { + return &GetDifficultyCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetDifficultyCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetDifficultyCmd) Method() string { + return "getdifficulty" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetDifficultyCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getdifficulty", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetDifficultyCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetDifficultyCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetGenerateCmd is a type handling custom marshaling and +// unmarshaling of getgenerate JSON RPC commands. +type GetGenerateCmd struct { + id interface{} +} + +// Enforce that GetGenerateCmd satisifies the Cmd interface. +var _ Cmd = &GetGenerateCmd{} + +// NewGetGenerateCmd creates a new GetGenerateCmd. +func NewGetGenerateCmd(id interface{}) (*GetGenerateCmd, error) { + return &GetGenerateCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetGenerateCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetGenerateCmd) Method() string { + return "getgenerate" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetGenerateCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getgenerate", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetGenerateCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetGenerateCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetHashesPerSecCmd is a type handling custom marshaling and +// unmarshaling of gethashespersec JSON RPC commands. +type GetHashesPerSecCmd struct { + id interface{} +} + +// Enforce that GetHashesPerSecCmd satisifies the Cmd interface. +var _ Cmd = &GetHashesPerSecCmd{} + +// NewGetHashesPerSecCmd creates a new GetHashesPerSecCmd. +func NewGetHashesPerSecCmd(id interface{}) (*GetHashesPerSecCmd, error) { + return &GetHashesPerSecCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetHashesPerSecCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetHashesPerSecCmd) Method() string { + return "gethashespersec" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetHashesPerSecCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "gethashespersec", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetHashesPerSecCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetHashesPerSecCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetInfoCmd is a type handling custom marshaling and +// unmarshaling of getinfo JSON RPC commands. +type GetInfoCmd struct { + id interface{} +} + +// Enforce that GetInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetInfoCmd{} + +// NewGetInfoCmd creates a new GetInfoCmd. +func NewGetInfoCmd(id interface{}) (*GetInfoCmd, error) { + return &GetInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetInfoCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetInfoCmd) Method() string { + return "getinfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetInfoCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getinfo", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetNetTotalsCmd is a type handling custom marshaling and +// unmarshaling of getnettotals JSON RPC commands. +type GetNetTotalsCmd struct { + id interface{} +} + +// Enforce that GetNetTotalsCmd satisifies the Cmd interface. +var _ Cmd = &GetNetTotalsCmd{} + +// NewGetNetTotalsCmd creates a new GetNetTotalsCmd. +func NewGetNetTotalsCmd(id interface{}) (*GetNetTotalsCmd, error) { + return &GetNetTotalsCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetNetTotalsCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetNetTotalsCmd) Method() string { + return "getnettotals" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetNetTotalsCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getnettotals", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetNetTotalsCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetNetTotalsCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetNetworkHashPSCmd is a type handling custom marshaling and +// unmarshaling of getnetworkhashps JSON RPC commands. +type GetNetworkHashPSCmd struct { + id interface{} + Blocks int + Height int +} + +// Enforce that GetNetworkHashPSCmd satisifies the Cmd interface. +var _ Cmd = &GetNetworkHashPSCmd{} + +// NewGetNetworkHashPSCmd creates a new GetNetworkHashPSCmd. +func NewGetNetworkHashPSCmd(id interface{}, optArgs ...int) (*GetNetworkHashPSCmd, error) { + blocks := 120 + height := -1 + + if len(optArgs) > 0 { + if len(optArgs) > 2 { + return nil, ErrTooManyOptArgs + } + + blocks = optArgs[0] + + if len(optArgs) > 1 { + height = optArgs[1] + } + } + return &GetNetworkHashPSCmd{ + id: id, + Blocks: blocks, + Height: height, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetNetworkHashPSCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetNetworkHashPSCmd) Method() string { + return "getnetworkhashps" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetNetworkHashPSCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getnetworkhashps", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Blocks != 120 || cmd.Height != -1 { + raw.Params = append(raw.Params, cmd.Blocks) + } + + if cmd.Height != -1 { + raw.Params = append(raw.Params, cmd.Height) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetNetworkHashPSCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]int, 0, 2) + if len(r.Params) > 0 { + blocks, ok := r.Params[0].(float64) + if !ok { + return errors.New("first optional parameter blocks must be a number") + } + + optArgs = append(optArgs, int(blocks)) + } + + if len(r.Params) > 1 { + height, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter height must be a number") + } + + optArgs = append(optArgs, int(height)) + } + newCmd, err := NewGetNetworkHashPSCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetMiningInfoCmd is a type handling custom marshaling and +// unmarshaling of getmininginfo JSON RPC commands. +type GetMiningInfoCmd struct { + id interface{} +} + +// Enforce that GetMiningInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetMiningInfoCmd{} + +// NewGetMiningInfoCmd creates a new GetMiningInfoCmd. +func NewGetMiningInfoCmd(id interface{}) (*GetMiningInfoCmd, error) { + return &GetMiningInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetMiningInfoCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetMiningInfoCmd) Method() string { + return "getmininginfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetMiningInfoCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getmininginfo", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetMiningInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetMiningInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetNewAddressCmd is a type handling custom marshaling and +// unmarshaling of getnewaddress JSON RPC commands. +type GetNewAddressCmd struct { + id interface{} + Address string +} + +// Enforce that GetNewAddressCmd satisifies the Cmd interface. +var _ Cmd = &GetNewAddressCmd{} + +// NewGetNewAddressCmd creates a new GetNewAddressCmd. +func NewGetNewAddressCmd(id interface{}, optArgs ...string) (*GetNewAddressCmd, error) { + var address string + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + address = optArgs[0] + + } + return &GetNewAddressCmd{ + id: id, + Address: address, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetNewAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetNewAddressCmd) Method() string { + return "getnewaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetNewAddressCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getnewaddress", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Address != "" { + raw.Params = append(raw.Params, cmd.Address) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetNewAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 1 { + return ErrWrongNumberOfParams + } + + optArgs := make([]string, 0, 1) + if len(r.Params) > 0 { + addr, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter address must be a string") + } + + optArgs = append(optArgs, addr) + } + + newCmd, err := NewGetNewAddressCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetPeerInfoCmd is a type handling custom marshaling and +// unmarshaling of getpeerinfo JSON RPC commands. +type GetPeerInfoCmd struct { + id interface{} +} + +// Enforce that GetPeerInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetPeerInfoCmd{} + +// NewGetPeerInfoCmd creates a new GetPeerInfoCmd. +func NewGetPeerInfoCmd(id interface{}) (*GetPeerInfoCmd, error) { + return &GetPeerInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetPeerInfoCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetPeerInfoCmd) Method() string { + return "getpeerinfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetPeerInfoCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getpeerinfo", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetPeerInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetPeerInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetRawChangeAddressCmd is a type handling custom marshaling and +// unmarshaling of getrawchangeaddress JSON RPC commands. +type GetRawChangeAddressCmd struct { + id interface{} + Account string +} + +// Enforce that GetRawChangeAddressCmd satisifies the Cmd interface. +var _ Cmd = &GetRawChangeAddressCmd{} + +// NewGetRawChangeAddressCmd creates a new GetRawChangeAddressCmd. +func NewGetRawChangeAddressCmd(id interface{}, optArgs ...string) (*GetRawChangeAddressCmd, error) { + var account string + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + account = optArgs[0] + + } + return &GetRawChangeAddressCmd{ + id: id, + Account: account, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetRawChangeAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetRawChangeAddressCmd) Method() string { + return "getrawchangeaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetRawChangeAddressCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getrawchangeaddress", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Account != "" { + raw.Params = append(raw.Params, cmd.Account) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetRawChangeAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 1 { + return ErrWrongNumberOfParams + } + + optArgs := make([]string, 0, 1) + if len(r.Params) > 0 { + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter account must be a string") + } + + optArgs = append(optArgs, account) + } + + newCmd, err := NewGetRawChangeAddressCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetRawMempoolCmd is a type handling custom marshaling and +// unmarshaling of getrawmempool JSON RPC commands. +type GetRawMempoolCmd struct { + id interface{} +} + +// Enforce that GetRawMempoolCmd satisifies the Cmd interface. +var _ Cmd = &GetRawMempoolCmd{} + +// NewGetRawMempoolCmd creates a new GetRawMempoolCmd. +func NewGetRawMempoolCmd(id interface{}) (*GetRawMempoolCmd, error) { + return &GetRawMempoolCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetRawMempoolCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetRawMempoolCmd) Method() string { + return "getrawmempool" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetRawMempoolCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getrawmempool", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetRawMempoolCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetRawMempoolCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetRawTransactionCmd is a type handling custom marshaling and +// unmarshaling of getrawtransaction JSON RPC commands. +type GetRawTransactionCmd struct { + id interface{} + Txid string + Verbose bool +} + +// Enforce that GetRawTransactionCmd satisifies the Cmd interface. +var _ Cmd = &GetRawTransactionCmd{} + +// NewGetRawTransactionCmd creates a new GetRawTransactionCmd. +func NewGetRawTransactionCmd(id interface{}, txid string, optArgs ...bool) (*GetRawTransactionCmd, error) { + var verbose bool + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + verbose = optArgs[0] + + } + return &GetRawTransactionCmd{ + id: id, + Txid: txid, + Verbose: verbose, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetRawTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetRawTransactionCmd) Method() string { + return "getrawtransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetRawTransactionCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getrawtransaction", + Id: cmd.id, + Params: []interface{}{ + cmd.Txid, + }, + } + + if cmd.Verbose { + raw.Params = append(raw.Params, cmd.Verbose) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetRawTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 || len(r.Params) < 1 { + return ErrWrongNumberOfParams + } + + txid, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter txid must be a string") + } + + optArgs := make([]bool, 0, 1) + if len(r.Params) == 2 { + verbose, ok := r.Params[1].(bool) + if !ok { + return errors.New("second optional parameter verbose must be a bool") + } + + optArgs = append(optArgs, verbose) + } + + newCmd, err := NewGetRawTransactionCmd(r.Id, txid, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetReceivedByAccountCmd is a type handling custom marshaling and +// unmarshaling of getreceivedbyaccount JSON RPC commands. +type GetReceivedByAccountCmd struct { + id interface{} + Account string + Minconf int +} + +// Enforce that GetReceivedByAccountCmd satisifies the Cmd interface. +var _ Cmd = &GetReceivedByAccountCmd{} + +// NewGetReceivedByAccountCmd creates a new GetReceivedByAccountCmd. +func NewGetReceivedByAccountCmd(id interface{}, optArgs ...interface{}) (*GetReceivedByAccountCmd, error) { + if len(optArgs) > 2 { + return nil, ErrTooManyOptArgs + } + var account string + if len(optArgs) > 0 { + a, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("first optional argument account is not a string") + } + + account = a + } + var minconf int = 1 + if len(optArgs) > 1 { + m, ok := optArgs[1].(int) + if !ok { + return nil, errors.New("second optional argument minconf is not a int") + } + minconf = m + + } + return &GetReceivedByAccountCmd{ + id: id, + Account: account, + Minconf: minconf, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetReceivedByAccountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetReceivedByAccountCmd) Method() string { + return "getreceivedbyaccount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetReceivedByAccountCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getreceivedbyaccount", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Account != "" || cmd.Minconf != 1 { + raw.Params = append(raw.Params, cmd.Account) + } + + if cmd.Minconf != 1 { + raw.Params = append(raw.Params, cmd.Minconf) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 0 { + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter account must be a string") + } + + optArgs = append(optArgs, account) + } + + if len(r.Params) > 1 { + minconf, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter verbose must be a number") + } + + optArgs = append(optArgs, int(minconf)) + } + + newCmd, err := NewGetReceivedByAccountCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetReceivedByAddressCmd is a type handling custom marshaling and +// unmarshaling of getrecievedbyaddress JSON RPC commands. +type GetReceivedByAddressCmd struct { + id interface{} + Address string + Minconf int +} + +// Enforce that GetReceivedByAddressCmd satisifies the Cmd interface. +var _ Cmd = &GetReceivedByAddressCmd{} + +// NewGetReceivedByAddressCmd creates a new GetReceivedByAddressCmd. +func NewGetReceivedByAddressCmd(id interface{}, optArgs ...interface{}) (*GetReceivedByAddressCmd, error) { + if len(optArgs) > 2 { + return nil, ErrTooManyOptArgs + } + var address string + if len(optArgs) > 0 { + a, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("first optional argument address is not a string") + } + + address = a + } + var minconf int = 1 + if len(optArgs) > 1 { + m, ok := optArgs[1].(int) + if !ok { + return nil, errors.New("second optional argument minconf is not a int") + } + minconf = m + + } + return &GetReceivedByAddressCmd{ + id: id, + Address: address, + Minconf: minconf, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetReceivedByAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetReceivedByAddressCmd) Method() string { + return "getrecievedbyaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetReceivedByAddressCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getrecievedbyaddress", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Address != "" || cmd.Minconf != 1 { + raw.Params = append(raw.Params, cmd.Address) + } + + if cmd.Minconf != 1 { + raw.Params = append(raw.Params, cmd.Minconf) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetReceivedByAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 0 { + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter address must be a string") + } + + optArgs = append(optArgs, address) + } + + if len(r.Params) > 1 { + minconf, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter verbose must be a number") + } + + optArgs = append(optArgs, int(minconf)) + } + + newCmd, err := NewGetReceivedByAddressCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetTransactionCmd is a type handling custom marshaling and +// unmarshaling of gettransaction JSON RPC commands. +type GetTransactionCmd struct { + id interface{} + Txid string +} + +// Enforce that GetTransactionCmd satisifies the Cmd interface. +var _ Cmd = &GetTransactionCmd{} + +// NewGetTransactionCmd creates a new GetTransactionCmd. +func NewGetTransactionCmd(id interface{}, txid string) (*GetTransactionCmd, error) { + return &GetTransactionCmd{ + id: id, + Txid: txid, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetTransactionCmd) Method() string { + return "gettransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetTransactionCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "gettransaction", + Id: cmd.id, + Params: []interface{}{ + cmd.Txid, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + txid, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter txid must be a string") + } + + newCmd, err := NewGetTransactionCmd(r.Id, txid) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetTxOutCmd is a type handling custom marshaling and +// unmarshaling of gettxout JSON RPC commands. +type GetTxOutCmd struct { + id interface{} + Txid string + Output int + IncludeMempool bool +} + +// Enforce that GetTxOutCmd satisifies the Cmd interface. +var _ Cmd = &GetTxOutCmd{} + +// NewGetTxOutCmd creates a new GetTxOutCmd. +func NewGetTxOutCmd(id interface{}, txid string, output int, optArgs ...bool) (*GetTxOutCmd, error) { + var mempool bool + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + mempool = optArgs[0] + } + return &GetTxOutCmd{ + id: id, + Txid: txid, + Output: output, + IncludeMempool: mempool, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetTxOutCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetTxOutCmd) Method() string { + return "gettxout" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetTxOutCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "gettxout", + Id: cmd.id, + Params: []interface{}{ + cmd.Txid, + cmd.Output, + }, + } + + if cmd.IncludeMempool != false { + raw.Params = append(raw.Params, cmd.IncludeMempool) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetTxOutCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 3 || len(r.Params) < 2 { + return ErrWrongNumberOfParams + } + + txid, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter txid must be a string") + } + + output, ok := r.Params[1].(float64) + if !ok { + return errors.New("first parameter output must be a number") + } + + optArgs := make([]bool, 0, 1) + if len(r.Params) == 2 { + mempool, ok := r.Params[2].(bool) + if !ok { + return errors.New("third optional parameter includemempool must be a bool") + } + + optArgs = append(optArgs, mempool) + } + + newCmd, err := NewGetTxOutCmd(r.Id, txid, int(output), optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// GetTxOutSetInfoCmd is a type handling custom marshaling and +// unmarshaling of gettxoutsetinfo JSON RPC commands. +type GetTxOutSetInfoCmd struct { + id interface{} +} + +// Enforce that GetTxOutSetInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetTxOutSetInfoCmd{} + +// NewGetTxOutSetInfoCmd creates a new GetTxOutSetInfoCmd. +func NewGetTxOutSetInfoCmd(id interface{}) (*GetTxOutSetInfoCmd, error) { + return &GetTxOutSetInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetTxOutSetInfoCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetTxOutSetInfoCmd) Method() string { + return "gettxoutsetinfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetTxOutSetInfoCmd) MarshalJSON() ([]byte, error) { + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "gettxoutsetinfo", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetTxOutSetInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetTxOutSetInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// WorkRequest is a request object as defined in +// https://en.bitcoin.it/wiki/Getwork, it is provided as a +// pointer argument to GetWorkCmd. +type WorkRequest struct { + Data string `json:"data"` + Target string `json:"target"` + Algorithm string `json:"algorithm,omitempty"` +} + +// GetWorkCmd is a type handling custom marshaling and +// unmarshaling of getwork JSON RPC commands. +type GetWorkCmd struct { + id interface{} + Request WorkRequest +} + +// Enforce that GetWorkCmd satisifies the Cmd interface. +var _ Cmd = &GetWorkCmd{} + +// NewGetWorkCmd creates a new GetWorkCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewGetWorkCmd(id interface{}, request WorkRequest) (*GetWorkCmd, error) { + return &GetWorkCmd{ + id: id, + Request: request, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetWorkCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetWorkCmd) Method() string { + return "getwork" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetWorkCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getwork", + Id: cmd.id, + Params: []interface{}{ + cmd.Request, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetWorkCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + rmap, ok := r.Params[0].(map[string]interface{}) + if !ok { + return errors.New("first optional parameter template request must be an object") + } + + wrequest := new(WorkRequest) + // data is required + data, ok := rmap["data"] + if !ok { + return errors.New("WorkRequest data must be present") + } + sdata, ok := data.(string) + if !ok { + return errors.New("WorkRequest data must be a string") + } + wrequest.Data = sdata + + // target is required + target, ok := rmap["target"] + if !ok { + return errors.New("WorkRequest target must be present") + } + starget, ok := target.(string) + if !ok { + return errors.New("WorkRequest target must be a string") + } + wrequest.Target = starget + + // algorithm is optional + algo, ok := rmap["algorithm"] + if ok { + salgo, ok := algo.(string) + if !ok { + return errors.New("WorkRequest algorithm must be a string") + } + wrequest.Algorithm = salgo + } + + newCmd, err := NewGetWorkCmd(r.Id, *wrequest) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// HelpCmd is a type handling custom marshaling and +// unmarshaling of help JSON RPC commands. +type HelpCmd struct { + id interface{} + Command string +} + +// Enforce that HelpCmd satisifies the Cmd interface. +var _ Cmd = &HelpCmd{} + +// NewHelpCmd creates a new HelpCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewHelpCmd(id interface{}, optArgs ...string) (*HelpCmd, error) { + + var command string + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + command = optArgs[0] + } + return &HelpCmd{ + id: id, + Command: command, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *HelpCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *HelpCmd) Method() string { + return "help" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *HelpCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "help", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Command != "" { + raw.Params = append(raw.Params, cmd.Command) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *HelpCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 1 { + return ErrWrongNumberOfParams + } + + optArgs := make([]string, 0, 1) + if len(r.Params) == 1 { + command, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter command must be a string") + } + + optArgs = append(optArgs, command) + } + + newCmd, err := NewHelpCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ImportPrivKeyCmd is a type handling custom marshaling and +// unmarshaling of importprivkey JSON RPC commands. +type ImportPrivKeyCmd struct { + id interface{} + PrivKey string + Label string + ReScan bool +} + +// Enforce that ImportPrivKeyCmd satisifies the Cmd interface. +var _ Cmd = &ImportPrivKeyCmd{} + +// NewImportPrivKeyCmd creates a new ImportPrivKeyCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewImportPrivKeyCmd(id interface{}, privkey string, optArgs ...interface{}) (*ImportPrivKeyCmd, error) { + var label string + var rescan bool + var ok bool + + if len(optArgs) > 2 { + return nil, ErrTooManyOptArgs + } + if len(optArgs) > 0 { + label, ok = optArgs[0].(string) + if !ok { + return nil, errors.New("first optional argument label is not a string") + } + } + if len(optArgs) > 1 { + rescan, ok = optArgs[1].(bool) + if !ok { + return nil, errors.New("first optional argument rescan is not a bool") + } + } + return &ImportPrivKeyCmd{ + id: id, + PrivKey: privkey, + Label: label, + ReScan: rescan, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ImportPrivKeyCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ImportPrivKeyCmd) Method() string { + return "importprivkey" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ImportPrivKeyCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "importprivkey", + Id: cmd.id, + Params: []interface{}{ + cmd.PrivKey, + }, + } + + if cmd.Label != "" || cmd.ReScan { + raw.Params = append(raw.Params, cmd.Label) + } + + if cmd.ReScan { + raw.Params = append(raw.Params, cmd.ReScan) + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ImportPrivKeyCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 3 { + return ErrWrongNumberOfParams + } + + privkey, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter privkey must be a string") + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 1 { + label, ok := r.Params[1].(string) + if !ok { + return errors.New("second optional parameter label must be a string") + } + + optArgs = append(optArgs, label) + } + + if len(r.Params) > 2 { + rescan, ok := r.Params[2].(bool) + if !ok { + return errors.New("third optional parameter rescan must be a bool") + } + + optArgs = append(optArgs, rescan) + } + + newCmd, err := NewImportPrivKeyCmd(r.Id, privkey, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ImportWalletCmd is a type handling custom marshaling and +// unmarshaling of importwallet JSON RPC commands. +type ImportWalletCmd struct { + id interface{} + Filename string +} + +// Enforce that ImportWalletCmd satisifies the Cmd interface. +var _ Cmd = &ImportWalletCmd{} + +// NewImportWalletCmd creates a new ImportWalletCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewImportWalletCmd(id interface{}, filename string) (*ImportWalletCmd, error) { + return &ImportWalletCmd{ + id: id, + Filename: filename, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ImportWalletCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ImportWalletCmd) Method() string { + return "importwallet" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ImportWalletCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "importwallet", + Id: cmd.id, + Params: []interface{}{ + cmd.Filename, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ImportWalletCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + filename, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter filename must be a string") + } + + newCmd, err := NewImportWalletCmd(r.Id, filename) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// KeyPoolRefillCmd is a type handling custom marshaling and +// unmarshaling of keypoolrefill JSON RPC commands. +type KeyPoolRefillCmd struct { + id interface{} +} + +// Enforce that KeyPoolRefillCmd satisifies the Cmd interface. +var _ Cmd = &KeyPoolRefillCmd{} + +// NewKeyPoolRefillCmd creates a new KeyPoolRefillCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewKeyPoolRefillCmd(id interface{}) (*KeyPoolRefillCmd, error) { + return &KeyPoolRefillCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *KeyPoolRefillCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *KeyPoolRefillCmd) Method() string { + return "keypoolrefill" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *KeyPoolRefillCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "keypoolrefill", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *KeyPoolRefillCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewKeyPoolRefillCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListAccountsCmd is a type handling custom marshaling and +// unmarshaling of listaccounts JSON RPC commands. +type ListAccountsCmd struct { + id interface{} + MinConf int +} + +// Enforce that ListAccountsCmd satisifies the Cmd interface. +var _ Cmd = &ListAccountsCmd{} + +// NewListAccountsCmd creates a new ListAccountsCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListAccountsCmd(id interface{}, optArgs ...int) (*ListAccountsCmd, error) { + var minconf = 1 + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + minconf = optArgs[0] + } + return &ListAccountsCmd{ + id: id, + MinConf: minconf, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListAccountsCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListAccountsCmd) Method() string { + return "listaccounts" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListAccountsCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listaccounts", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.MinConf != 1 { + raw.Params = append(raw.Params, cmd.MinConf) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListAccountsCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 1 { + return ErrWrongNumberOfParams + } + + optArgs := make([]int, 0, 1) + if len(r.Params) == 1 { + minconf, ok := r.Params[0].(float64) + if !ok { + return errors.New("first parameter minconf must be a number") + } + optArgs = append(optArgs, int(minconf)) + } + + newCmd, err := NewListAccountsCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListAddressGroupingsCmd is a type handling custom marshaling and +// unmarshaling of listaddressgroupings JSON RPC commands. +type ListAddressGroupingsCmd struct { + id interface{} +} + +// Enforce that ListAddressGroupingsCmd satisifies the Cmd interface. +var _ Cmd = &ListAddressGroupingsCmd{} + +// NewListAddressGroupingsCmd creates a new ListAddressGroupingsCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListAddressGroupingsCmd(id interface{}) (*ListAddressGroupingsCmd, error) { + return &ListAddressGroupingsCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListAddressGroupingsCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListAddressGroupingsCmd) Method() string { + return "listaddressgroupings" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListAddressGroupingsCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listaddressgroupings", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListAddressGroupingsCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewListAddressGroupingsCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListLockUnspentCmd is a type handling custom marshaling and +// unmarshaling of listlockunspent JSON RPC commands. +type ListLockUnspentCmd struct { + id interface{} +} + +// Enforce that ListLockUnspentCmd satisifies the Cmd interface. +var _ Cmd = &ListLockUnspentCmd{} + +// NewListLockUnspentCmd creates a new ListLockUnspentCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListLockUnspentCmd(id interface{}) (*ListLockUnspentCmd, error) { + return &ListLockUnspentCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListLockUnspentCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListLockUnspentCmd) Method() string { + return "listlockunspent" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListLockUnspentCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listlockunspent", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListLockUnspentCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewListLockUnspentCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListReceivedByAccountCmd is a type handling custom marshaling and +// unmarshaling of listreceivedbyaccount JSON RPC commands. +type ListReceivedByAccountCmd struct { + id interface{} + MinConf int + IncludeEmpty bool +} + +// Enforce that ListReceivedByAccountCmd satisifies the Cmd interface. +var _ Cmd = &ListReceivedByAccountCmd{} + +// NewListReceivedByAccountCmd creates a new ListReceivedByAccountCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListReceivedByAccountCmd(id interface{}, optArgs ...interface{}) (*ListReceivedByAccountCmd, error) { + minconf := 1 + includeempty := false + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + if len(optArgs) > 0 { + m, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("first optional argument minconf is not an int") + } + minconf = m + } + if len(optArgs) > 1 { + ie, ok := optArgs[1].(bool) + if !ok { + return nil, errors.New("second optional argument includeempty is not a bool") + } + + includeempty = ie + } + return &ListReceivedByAccountCmd{ + id: id, + MinConf: minconf, + IncludeEmpty: includeempty, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListReceivedByAccountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListReceivedByAccountCmd) Method() string { + return "listreceivedbyaccount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListReceivedByAccountCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listreceivedbyaccount", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.MinConf != 1 || cmd.IncludeEmpty != false { + raw.Params = append(raw.Params, cmd.MinConf) + } + + if cmd.IncludeEmpty != false { + raw.Params = append(raw.Params, cmd.IncludeEmpty) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListReceivedByAccountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 0 { + minconf, ok := r.Params[0].(float64) + if !ok { + return errors.New("first optional parameter minconf must be a number") + } + optArgs = append(optArgs, minconf) + } + if len(r.Params) > 1 { + includeempty, ok := r.Params[1].(bool) + if !ok { + return errors.New("second optional parameter includeempt must be a bool") + } + optArgs = append(optArgs, includeempty) + } + + newCmd, err := NewListReceivedByAccountCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListReceivedByAddressCmd is a type handling custom marshaling and +// unmarshaling of listreceivedbyaddress JSON RPC commands. +type ListReceivedByAddressCmd struct { + id interface{} + MinConf int + IncludeEmpty bool +} + +// Enforce that ListReceivedByAddressCmd satisifies the Cmd interface. +var _ Cmd = &ListReceivedByAddressCmd{} + +// NewListReceivedByAddressCmd creates a new ListReceivedByAddressCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListReceivedByAddressCmd(id interface{}, optArgs ...interface{}) (*ListReceivedByAddressCmd, error) { + minconf := 1 + includeempty := false + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + if len(optArgs) > 0 { + m, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("first optional argument minconf is not an int") + } + minconf = m + } + if len(optArgs) > 1 { + ie, ok := optArgs[1].(bool) + if !ok { + return nil, errors.New("second optional argument includeempty is not a bool") + } + + includeempty = ie + } + return &ListReceivedByAddressCmd{ + id: id, + MinConf: minconf, + IncludeEmpty: includeempty, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListReceivedByAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListReceivedByAddressCmd) Method() string { + return "listreceivedbyaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListReceivedByAddressCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listreceivedbyaddress", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.MinConf != 1 || cmd.IncludeEmpty != false { + raw.Params = append(raw.Params, cmd.MinConf) + } + + if cmd.IncludeEmpty != false { + raw.Params = append(raw.Params, cmd.IncludeEmpty) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListReceivedByAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 0 { + minconf, ok := r.Params[0].(float64) + if !ok { + return errors.New("first optional parameter minconf must be a number") + } + optArgs = append(optArgs, minconf) + } + if len(r.Params) > 1 { + includeempty, ok := r.Params[1].(bool) + if !ok { + return errors.New("second optional parameter includeempt must be a bool") + } + optArgs = append(optArgs, includeempty) + } + + newCmd, err := NewListReceivedByAddressCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListSinceBlockCmd is a type handling custom marshaling and +// unmarshaling of listsinceblock JSON RPC commands. +type ListSinceBlockCmd struct { + id interface{} + BlockHash string + TargetConfirmations int +} + +// Enforce that ListSinceBlockCmd satisifies the Cmd interface. +var _ Cmd = &ListSinceBlockCmd{} + +// NewListSinceBlockCmd creates a new ListSinceBlockCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListSinceBlockCmd(id interface{}, optArgs ...interface{}) (*ListSinceBlockCmd, error) { + blockhash := "" + targetconfirmations := 1 + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + if len(optArgs) > 0 { + bh, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("first optional argument blockhash is not a string") + } + blockhash = bh + } + if len(optArgs) > 1 { + tc, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("second optional argument targetconfirmations is not an int") + } + + targetconfirmations = tc + } + return &ListSinceBlockCmd{ + id: id, + BlockHash: blockhash, + TargetConfirmations: targetconfirmations, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListSinceBlockCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListSinceBlockCmd) Method() string { + return "listsinceblock" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListSinceBlockCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listsinceblock", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.BlockHash != "" || cmd.TargetConfirmations != 1 { + raw.Params = append(raw.Params, cmd.BlockHash) + } + + if cmd.TargetConfirmations != 1 { + raw.Params = append(raw.Params, cmd.TargetConfirmations) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListSinceBlockCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 0 { + blockhash, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter blockhash must be a string") + } + optArgs = append(optArgs, blockhash) + } + if len(r.Params) > 1 { + targetconfirmations, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter targetconfirmations must be a number") + } + optArgs = append(optArgs, int(targetconfirmations)) + } + + newCmd, err := NewListSinceBlockCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListTransactionsCmd is a type handling custom marshaling and +// unmarshaling of listtransactions JSON RPC commands. +type ListTransactionsCmd struct { + id interface{} + Account string + Count int + From int +} + +// Enforce that ListTransactionsCmd satisifies the Cmd interface. +var _ Cmd = &ListTransactionsCmd{} + +// NewListTransactionsCmd creates a new ListTransactionsCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListTransactionsCmd(id interface{}, optArgs ...interface{}) (*ListTransactionsCmd, error) { + account := "" + count := 10 + from := 0 + + if len(optArgs) > 3 { + return nil, ErrWrongNumberOfParams + } + if len(optArgs) > 0 { + ac, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("first optional argument account is not a string") + } + account = ac + } + if len(optArgs) > 1 { + cnt, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("second optional argument count is not an int") + } + + count = cnt + } + if len(optArgs) > 2 { + frm, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("third optional argument from is not an int") + } + + from = frm + } + return &ListTransactionsCmd{ + id: id, + Account: account, + Count: count, + From: from, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListTransactionsCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListTransactionsCmd) Method() string { + return "listtransactions" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListTransactionsCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listtransactions", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.Account != "" || cmd.Count != 10 || cmd.From != 0 { + raw.Params = append(raw.Params, cmd.Account) + } + + if cmd.Count != 10 || cmd.From != 0 { + raw.Params = append(raw.Params, cmd.Count) + } + if cmd.From != 0 { + raw.Params = append(raw.Params, cmd.From) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListTransactionsCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 3 { + return ErrWrongNumberOfParams + } + + optArgs := make([]interface{}, 0, 3) + if len(r.Params) > 0 { + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first optional parameter account must be a string") + } + optArgs = append(optArgs, account) + } + if len(r.Params) > 1 { + count, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter count must be a number") + } + optArgs = append(optArgs, int(count)) + } + if len(r.Params) > 2 { + from, ok := r.Params[2].(float64) + if !ok { + return errors.New("third optional parameter from must be a number") + } + optArgs = append(optArgs, int(from)) + } + + newCmd, err := NewListTransactionsCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ListUnspentCmd is a type handling custom marshaling and +// unmarshaling of listunspent JSON RPC commands. +type ListUnspentCmd struct { + id interface{} + MinConf int + MaxConf int +} + +// Enforce that ListUnspentCmd satisifies the Cmd interface. +var _ Cmd = &ListUnspentCmd{} + +// NewListUnspentCmd creates a new ListUnspentCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewListUnspentCmd(id interface{}, optArgs ...int) (*ListUnspentCmd, error) { + minconf := 1 + maxconf := 999999 + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + if len(optArgs) > 0 { + minconf = optArgs[0] + } + if len(optArgs) > 1 { + maxconf = optArgs[1] + } + return &ListUnspentCmd{ + id: id, + MinConf: minconf, + MaxConf: maxconf, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ListUnspentCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ListUnspentCmd) Method() string { + return "listunspent" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ListUnspentCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "listunspent", + Id: cmd.id, + Params: []interface{}{}, + } + + if cmd.MinConf != 1 || cmd.MaxConf != 99999 { + raw.Params = append(raw.Params, cmd.MinConf) + } + + if cmd.MaxConf != 99999 { + raw.Params = append(raw.Params, cmd.MaxConf) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ListUnspentCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]int, 0, 2) + if len(r.Params) > 0 { + minconf, ok := r.Params[0].(float64) + if !ok { + return errors.New("first optional parameter minconf must be a number") + } + optArgs = append(optArgs, int(minconf)) + } + if len(r.Params) > 1 { + maxconf, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter maxconf must be a number") + } + optArgs = append(optArgs, int(maxconf)) + } + + newCmd, err := NewListUnspentCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// LockUnspentCmd is a type handling custom marshaling and +// unmarshaling of lockunspent JSON RPC commands. +type LockUnspentCmd struct { + id interface{} + Unlock bool + Transactions []TransactionInput +} + +// Enforce that LockUnspentCmd satisifies the Cmd interface. +var _ Cmd = &LockUnspentCmd{} + +// NewLockUnspentCmd creates a new LockUnspentCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewLockUnspentCmd(id interface{}, unlock bool, optArgs ...[]TransactionInput) (*LockUnspentCmd, error) { + var transactions []TransactionInput + + if len(optArgs) > 1 { + return nil, ErrWrongNumberOfParams + } + + if len(optArgs) > 0 { + transactions = optArgs[0] + } + + return &LockUnspentCmd{ + id: id, + Unlock: unlock, + Transactions: transactions, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *LockUnspentCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *LockUnspentCmd) Method() string { + return "lockunspent" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *LockUnspentCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "lockunspent", + Id: cmd.id, + Params: []interface{}{ + cmd.Unlock, + }, + } + + if len(cmd.Transactions) > 0 { + raw.Params = append(raw.Params, cmd.Transactions) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *LockUnspentCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 || len(r.Params) < 1 { + return ErrWrongNumberOfParams + } + + unlock, ok := r.Params[0].(bool) + if !ok { + return errors.New("first parameter unlock must be a number") + } + + optArgs := make([][]TransactionInput, 0, 1) + if len(r.Params) > 1 { + iinputs, ok := r.Params[1].([]map[string]interface{}) + if !ok { + return errors.New("second optional parameter transactions must be an array of objects") + } + inputs := make([]TransactionInput, len(iinputs)) + for i, v := range iinputs { + if len(v) != 2 { + return errors.New("input with wrong number of members") + } + txid, ok := v["txid"] + if !ok { + return errors.New("input without txid") + } + inputs[i].Txid, ok = txid.(string) + if !ok { + return errors.New("input txid isn't a string") + } + + vout, ok := v["vout"] + if !ok { + return errors.New("input without vout") + } + fvout, ok := vout.(float64) + if !ok { + return errors.New("input vout not a number") + } + inputs[i].Vout = int(fvout) + } + optArgs = append(optArgs, inputs) + } + + newCmd, err := NewLockUnspentCmd(r.Id, unlock, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// MoveCmd is a type handling custom marshaling and +// unmarshaling of move JSON RPC commands. +type MoveCmd struct { + id interface{} + FromAccount string + ToAccount string + Amount int64 + MinConf int + Comment string +} + +// Enforce that MoveCmd satisifies the Cmd interface. +var _ Cmd = &MoveCmd{} + +// NewMoveCmd creates a new MoveCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewMoveCmd(id interface{}, fromaccount string, toaccount string, amount int64, optArgs ...interface{}) (*MoveCmd, error) { + minconf := 1 + comment := "" + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + + if len(optArgs) > 0 { + m, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("first optional parameter minconf is not a int64") + } + minconf = m + } + if len(optArgs) > 1 { + c, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("second optional parameter comment is not a string") + } + comment = c + } + + return &MoveCmd{ + id: id, + FromAccount: fromaccount, + ToAccount: toaccount, + Amount: amount, + MinConf: minconf, + Comment: comment, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *MoveCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *MoveCmd) Method() string { + return "move" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *MoveCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "move", + Id: cmd.id, + Params: []interface{}{ + cmd.FromAccount, + cmd.ToAccount, + cmd.Amount, + }, + } + + if cmd.MinConf != 1 || cmd.Comment != "" { + raw.Params = append(raw.Params, cmd.MinConf) + } + + if cmd.Comment != "" { + raw.Params = append(raw.Params, cmd.Comment) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *MoveCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 5 || len(r.Params) < 3 { + return ErrWrongNumberOfParams + } + + fromaccount, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter fromaccount must be a string") + } + + toaccount, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter toaccount must be a string") + } + + amount, ok := r.Params[2].(float64) + if !ok { + return errors.New("third parameter toaccount must be a number") + } + + samount, err := JSONToAmount(amount) + if err != nil { + return err + } + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 3 { + minconf, ok := r.Params[3].(float64) + if !ok { + return errors.New("fourth optional parameter minconf must be a number") + } + optArgs = append(optArgs, int(minconf)) + } + if len(r.Params) > 4 { + comment, ok := r.Params[4].(string) + if !ok { + return errors.New("fifth optional parameter comment must be a string") + } + optArgs = append(optArgs, comment) + } + + newCmd, err := NewMoveCmd(r.Id, fromaccount, toaccount, samount, + optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// PingCmd is a type handling custom marshaling and +// unmarshaling of ping JSON RPC commands. +type PingCmd struct { + id interface{} +} + +// Enforce that PingCmd satisifies the Cmd interface. +var _ Cmd = &PingCmd{} + +// NewPingCmd creates a new PingCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewPingCmd(id interface{}) (*PingCmd, error) { + return &PingCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *PingCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *PingCmd) Method() string { + return "ping" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *PingCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "ping", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *PingCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewPingCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SendFromCmd is a type handling custom marshaling and +// unmarshaling of sendfrom JSON RPC commands. +type SendFromCmd struct { + id interface{} + FromAccount string + ToAddress string + Amount int64 + MinConf int + Comment string + CommentTo string +} + +// Enforce that SendFromCmd satisifies the Cmd interface. +var _ Cmd = &SendFromCmd{} + +// NewSendFromCmd creates a new SendFromCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSendFromCmd(id interface{}, fromaccount string, toaddress string, amount int64, optArgs ...interface{}) (*SendFromCmd, error) { + minconf := 1 + comment := "" + commentto := "" + + if len(optArgs) > 3 { + return nil, ErrWrongNumberOfParams + } + + if len(optArgs) > 0 { + m, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("first optional parameter minconf is not a int64") + } + minconf = m + } + if len(optArgs) > 1 { + c, ok := optArgs[1].(string) + if !ok { + return nil, errors.New("second optional parameter comment is not a string") + } + comment = c + } + + if len(optArgs) > 2 { + cto, ok := optArgs[2].(string) + if !ok { + return nil, errors.New("third optional parameter commentto is not a string") + } + commentto = cto + } + + return &SendFromCmd{ + id: id, + FromAccount: fromaccount, + ToAddress: toaddress, + Amount: amount, + MinConf: minconf, + Comment: comment, + CommentTo: commentto, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SendFromCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SendFromCmd) Method() string { + return "sendfrom" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SendFromCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "sendfrom", + Id: cmd.id, + Params: []interface{}{ + cmd.FromAccount, + cmd.ToAddress, + float64(cmd.Amount) / 1e8, //convert to BTC + }, + } + + if cmd.MinConf != 1 || cmd.Comment != "" || cmd.CommentTo != "" { + raw.Params = append(raw.Params, cmd.MinConf) + } + + if cmd.Comment != "" || cmd.CommentTo != "" { + raw.Params = append(raw.Params, cmd.Comment) + } + + if cmd.CommentTo != "" { + raw.Params = append(raw.Params, cmd.CommentTo) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SendFromCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 6 || len(r.Params) < 3 { + return ErrWrongNumberOfParams + } + + fromaccount, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter fromaccount must be a string") + } + + toaccount, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter toaccount must be a string") + } + + amount, ok := r.Params[2].(float64) + if !ok { + return errors.New("third parameter toaccount must be a number") + } + + samount, err := JSONToAmount(amount) + if err != nil { + return err + } + + optArgs := make([]interface{}, 0, 3) + if len(r.Params) > 3 { + minconf, ok := r.Params[3].(float64) + if !ok { + return errors.New("fourth optional parameter minconf must be a number") + } + + optArgs = append(optArgs, int(minconf)) + } + if len(r.Params) > 4 { + comment, ok := r.Params[4].(string) + if !ok { + return errors.New("fifth optional parameter comment must be a string") + } + optArgs = append(optArgs, comment) + } + if len(r.Params) > 5 { + commentto, ok := r.Params[5].(string) + if !ok { + return errors.New("sixth optional parameter commentto must be a string") + } + optArgs = append(optArgs, commentto) + } + + newCmd, err := NewSendFromCmd(r.Id, fromaccount, toaccount, samount, + optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SendManyCmd is a type handling custom marshaling and +// unmarshaling of sendmany JSON RPC commands. +type SendManyCmd struct { + id interface{} + FromAccount string + Amounts map[string]int64 + MinConf int + Comment string +} + +// Enforce that SendManyCmd satisifies the Cmd interface. +var _ Cmd = &SendManyCmd{} + +// NewSendManyCmd creates a new SendManyCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSendManyCmd(id interface{}, fromaccount string, amounts map[string]int64, optArgs ...interface{}) (*SendManyCmd, error) { + minconf := 1 + comment := "" + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + + if len(optArgs) > 0 { + m, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("first optional parameter minconf is not a int64") + } + minconf = m + } + if len(optArgs) > 1 { + c, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("second optional parameter comment is not a string") + } + comment = c + } + + return &SendManyCmd{ + id: id, + FromAccount: fromaccount, + Amounts: amounts, + MinConf: minconf, + Comment: comment, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SendManyCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SendManyCmd) Method() string { + return "sendmany" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SendManyCmd) MarshalJSON() ([]byte, error) { + floatAmount := make(map[string]float64) + + for k, v := range cmd.Amounts { + floatAmount[k] = float64(v) / 1e8 + } + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "sendmany", + Id: cmd.id, + Params: []interface{}{ + cmd.FromAccount, + floatAmount, + }, + } + + if cmd.MinConf != 1 || cmd.Comment != "" { + raw.Params = append(raw.Params, cmd.MinConf) + } + + if cmd.Comment != "" { + raw.Params = append(raw.Params, cmd.Comment) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SendManyCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 6 || len(r.Params) < 3 { + return ErrWrongNumberOfParams + } + + fromaccount, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter fromaccount must be a string") + } + + famounts, ok := r.Params[1].(map[string]float64) + if !ok { + return errors.New("second parameter toaccount must be a string to number map") + } + + amounts := make(map[string]int64) + for k, v := range famounts { + var err error + amounts[k], err = JSONToAmount(v) + if err != nil { + return err + } + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 2 { + minconf, ok := r.Params[2].(float64) + if !ok { + return errors.New("third optional parameter minconf must be a number") + } + + optArgs = append(optArgs, int(minconf)) + } + if len(r.Params) > 3 { + comment, ok := r.Params[3].(string) + if !ok { + return errors.New("fourth optional parameter comment must be a string") + } + optArgs = append(optArgs, comment) + } + + newCmd, err := NewSendManyCmd(r.Id, fromaccount, amounts, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SendRawTransactionCmd is a type handling custom marshaling and +// unmarshaling of sendrawtransaction JSON RPC commands. +type SendRawTransactionCmd struct { + id interface{} + HexTx string +} + +// Enforce that SendRawTransactionCmd satisifies the Cmd interface. +var _ Cmd = &SendRawTransactionCmd{} + +// NewSendRawTransactionCmd creates a new SendRawTransactionCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSendRawTransactionCmd(id interface{}, hextx string) (*SendRawTransactionCmd, error) { + + return &SendRawTransactionCmd{ + id: id, + HexTx: hextx, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SendRawTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SendRawTransactionCmd) Method() string { + return "sendrawtransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SendRawTransactionCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "sendrawtransaction", + Id: cmd.id, + Params: []interface{}{ + cmd.HexTx, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SendRawTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + hextx, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter hextx must be a string") + } + + newCmd, err := NewSendRawTransactionCmd(r.Id, hextx) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SendToAddressCmd is a type handling custom marshaling and +// unmarshaling of sendtoaddress JSON RPC commands. +type SendToAddressCmd struct { + id interface{} + Address string + Amount int64 + Comment string + CommentTo string +} + +// Enforce that SendToAddressCmd satisifies the Cmd interface. +var _ Cmd = &SendToAddressCmd{} + +// NewSendToAddressCmd creates a new SendToAddressCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSendToAddressCmd(id interface{}, address string, amount int64, optArgs ...interface{}) (*SendToAddressCmd, error) { + comment := "" + commentto := "" + + if len(optArgs) > 2 { + return nil, ErrWrongNumberOfParams + } + + if len(optArgs) > 0 { + c, ok := optArgs[0].(string) + if !ok { + return nil, errors.New("first optional parameter comment is not a string") + } + comment = c + } + if len(optArgs) > 1 { + cto, ok := optArgs[1].(string) + if !ok { + return nil, errors.New("second optional parameter commentto is not a string") + } + commentto = cto + } + + return &SendToAddressCmd{ + id: id, + Address: address, + Amount: amount, + Comment: comment, + CommentTo: commentto, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SendToAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SendToAddressCmd) Method() string { + return "sendtoaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SendToAddressCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "sendtoaddress", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + float64(cmd.Amount) / 1e8, //convert to BTC + }, + } + + if cmd.Comment != "" || cmd.CommentTo != "" { + raw.Params = append(raw.Params, cmd.Comment) + } + + if cmd.CommentTo != "" { + raw.Params = append(raw.Params, cmd.CommentTo) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SendToAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 4 || len(r.Params) < 2 { + return ErrWrongNumberOfParams + } + + toaccount, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter toaccount must be a string") + } + + amount, ok := r.Params[1].(float64) + if !ok { + return errors.New("second parameter amount must be a number") + } + + samount, err := JSONToAmount(amount) + if err != nil { + return err + } + + optArgs := make([]interface{}, 0, 2) + if len(r.Params) > 3 { + comment, ok := r.Params[3].(string) + if !ok { + return errors.New("third optional parameter comment must be a string") + } + optArgs = append(optArgs, comment) + } + if len(r.Params) > 4 { + commentto, ok := r.Params[4].(string) + if !ok { + return errors.New("sixth optional parameter commentto must be a string") + } + optArgs = append(optArgs, commentto) + } + + newCmd, err := NewSendToAddressCmd(r.Id, toaccount, samount, + optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SetAccountCmd is a type handling custom marshaling and +// unmarshaling of setaccount JSON RPC commands. +type SetAccountCmd struct { + id interface{} + Address string + Account string +} + +// Enforce that SetAccountCmd satisifies the Cmd interface. +var _ Cmd = &SetAccountCmd{} + +// NewSetAccountCmd creates a new SetAccountCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSetAccountCmd(id interface{}, address string, account string) (*SetAccountCmd, error) { + + return &SetAccountCmd{ + id: id, + Address: address, + Account: account, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SetAccountCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SetAccountCmd) Method() string { + return "setaccount" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SetAccountCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "setaccount", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + cmd.Account, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SetAccountCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 || len(r.Params) < 2 { + return ErrWrongNumberOfParams + } + + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be a string") + } + + account, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter account must be a string") + } + + newCmd, err := NewSetAccountCmd(r.Id, address, account) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SetGenerateCmd is a type handling custom marshaling and +// unmarshaling of setgenerate JSON RPC commands. +type SetGenerateCmd struct { + id interface{} + Generate bool + GenProcLimit int +} + +// Enforce that SetGenerateCmd satisifies the Cmd interface. +var _ Cmd = &SetGenerateCmd{} + +// NewSetGenerateCmd creates a new SetGenerateCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSetGenerateCmd(id interface{}, generate bool, optArgs ...int) (*SetGenerateCmd, error) { + + genproclimit := 0 + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + if len(optArgs) == 1 { + genproclimit = optArgs[0] + } + + return &SetGenerateCmd{ + id: id, + Generate: generate, + GenProcLimit: genproclimit, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SetGenerateCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SetGenerateCmd) Method() string { + return "setgenerate" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SetGenerateCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "setgenerate", + Id: cmd.id, + Params: []interface{}{ + cmd.Generate, + }, + } + + if cmd.GenProcLimit != 0 { + raw.Params = append(raw.Params, cmd.GenProcLimit) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SetGenerateCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 || len(r.Params) < 1 { + return ErrWrongNumberOfParams + } + + generate, ok := r.Params[0].(bool) + if !ok { + return errors.New("first parameter generate must be a bool") + } + + optArgs := make([]int, 0, 1) + if len(r.Params) > 1 { + genproclimit, ok := r.Params[1].(float64) + if !ok { + return errors.New("second parameter genproclimit must be a number") + } + optArgs = append(optArgs, int(genproclimit)) + } + + newCmd, err := NewSetGenerateCmd(r.Id, generate, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SetTxFeeCmd is a type handling custom marshaling and +// unmarshaling of settxfee JSON RPC commands. +type SetTxFeeCmd struct { + id interface{} + Amount int64 +} + +// Enforce that SetTxFeeCmd satisifies the Cmd interface. +var _ Cmd = &SetTxFeeCmd{} + +// NewSetTxFeeCmd creates a new SetTxFeeCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSetTxFeeCmd(id interface{}, amount int64) (*SetTxFeeCmd, error) { + return &SetTxFeeCmd{ + id: id, + Amount: amount, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SetTxFeeCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SetTxFeeCmd) Method() string { + return "settxfee" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SetTxFeeCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "settxfee", + Id: cmd.id, + Params: []interface{}{ + cmd.Amount, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SetTxFeeCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + amount, ok := r.Params[0].(float64) + if !ok { + return errors.New("first parameter amount must be a number") + } + + samount, err := JSONToAmount(amount) + if err != nil { + return err + } + + newCmd, err := NewSetTxFeeCmd(r.Id, samount) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SignMessageCmd is a type handling custom marshaling and +// unmarshaling of signmessage JSON RPC commands. +type SignMessageCmd struct { + id interface{} + Address string + Message string +} + +// Enforce that SignMessageCmd satisifies the Cmd interface. +var _ Cmd = &SignMessageCmd{} + +// NewSignMessageCmd creates a new SignMessageCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSignMessageCmd(id interface{}, address string, message string) (*SignMessageCmd, error) { + return &SignMessageCmd{ + id: id, + Address: address, + Message: message, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SignMessageCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SignMessageCmd) Method() string { + return "signmessage" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SignMessageCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "signmessage", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + cmd.Message, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SignMessageCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 { + return ErrWrongNumberOfParams + } + + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be a string") + } + + message, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter message must be a string") + } + + newCmd, err := NewSignMessageCmd(r.Id, address, message) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +type RawTxInput struct { + Txid string `json:"txid"` + Vout int `json:"vout"` + ScriptPubKey string `json:"scriptPubKey"` +} + +// SignRawTransactionCmd is a type handling custom marshaling and +// unmarshaling of signrawtransaction JSON RPC commands. +type SignRawTransactionCmd struct { + id interface{} + RawTx string + Inputs []RawTxInput + PrivKeys []string + Flags string +} + +// Enforce that SignRawTransactionCmd satisifies the Cmd interface. +var _ Cmd = &SignRawTransactionCmd{} + +// NewSignRawTransactionCmd creates a new SignRawTransactionCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSignRawTransactionCmd(id interface{}, rawTx string, optArgs ...interface{}) (*SignRawTransactionCmd, error) { + var inputs []RawTxInput + var privkeys []string + var flags string + if len(optArgs) > 3 { + return nil, ErrTooManyOptArgs + } + if len(optArgs) > 0 { + ip, ok := optArgs[0].([]RawTxInput) + if !ok { + return nil, errors.New("first optional parameter inputs should be an array of RawTxInput") + } + + inputs = ip + } + if len(optArgs) > 1 { + pk, ok := optArgs[1].([]string) + if !ok { + return nil, errors.New("second optional parameter inputs should be an array of string") + } + + privkeys = pk + } + if len(optArgs) > 2 { + pk, ok := optArgs[2].([]string) + if !ok { + return nil, errors.New("third optional parameter flags should be a string") + } + + privkeys = pk + } + return &SignRawTransactionCmd{ + id: id, + RawTx: rawTx, + Inputs: inputs, + PrivKeys: privkeys, + Flags: flags, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SignRawTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SignRawTransactionCmd) Method() string { + return "signrawtransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SignRawTransactionCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "signrawtransaction", + Id: cmd.id, + Params: []interface{}{ + cmd.RawTx, + }, + } + + if len(cmd.Inputs) > 0 || len(cmd.PrivKeys) > 0 || cmd.Flags != "" { + raw.Params = append(raw.Params, cmd.Inputs) + } + if len(cmd.PrivKeys) > 0 || cmd.Flags != "" { + raw.Params = append(raw.Params, cmd.PrivKeys) + } + if cmd.Flags != "" { + raw.Params = append(raw.Params, cmd.Flags) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SignRawTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 4 || len(r.Params) < 1 { + return ErrWrongNumberOfParams + } + + rawtx, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter rawtx must be a string") + } + + optArgs := make([]interface{}, 0, 3) + if len(r.Params) > 1 { + ip, ok := r.Params[1].([]interface{}) + if !ok { + return errors.New("second optional parameter inputs must be an array") + } + inputs := make([]RawTxInput, len(ip)) + for i, val := range ip { + mip, ok := val.(map[string]interface{}) + if !ok { + return errors.New("second optional parameter inputs must be an array of objects") + } + txid, ok := mip["txid"] + if !ok { + return errors.New("txid missing in input object") + } + + inputs[i].Txid, ok = txid.(string) + if !ok { + return errors.New("txid not a string in input object") + } + + vout, ok := mip["vout"] + if !ok { + return errors.New("vout missing in input object") + } + fvout, ok := vout.(float64) + if !ok { + return errors.New("vout not a number in input object") + } + inputs[i].Vout = int(fvout) + + scriptpubkey, ok := mip["scriptpubkey"] + if !ok { + return errors.New("scriptpubkey missing in input object") + } + + inputs[i].ScriptPubKey, ok = scriptpubkey.(string) + if !ok { + return errors.New("scriptpubkey not a string in input object") + } + + } + optArgs = append(optArgs, inputs) + } + + if len(r.Params) > 2 { + privkeys, ok := r.Params[2].([]string) + if !ok { + return errors.New("third optional parameter privkeys is not an array of strings") + } + + optArgs = append(optArgs, privkeys) + } + if len(r.Params) > 3 { + flags, ok := r.Params[3].([]string) + if !ok { + return errors.New("fourth optional parameter flags is not a string") + } + + optArgs = append(optArgs, flags) + } + + newCmd, err := NewSignRawTransactionCmd(r.Id, rawtx, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// StopCmd is a type handling custom marshaling and +// unmarshaling of stop JSON RPC commands. +type StopCmd struct { + id interface{} +} + +// Enforce that StopCmd satisifies the Cmd interface. +var _ Cmd = &StopCmd{} + +// NewStopCmd creates a new StopCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewStopCmd(id interface{}) (*StopCmd, error) { + + return &StopCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *StopCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *StopCmd) Method() string { + return "stop" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *StopCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "stop", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *StopCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewStopCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// SubmitBlockOptions represents the optional options struct provided with +// a SubmitBlockCmd command. +type SubmitBlockOptions struct { + // must be provided if server provided a workid with template. + WorkId string `json:"workid,omitempty"` +} + +// SubmitBlockCmd is a type handling custom marshaling and +// unmarshaling of submitblock JSON RPC commands. +type SubmitBlockCmd struct { + id interface{} + HexBlock string + Options *SubmitBlockOptions +} + +// Enforce that SubmitBlockCmd satisifies the Cmd interface. +var _ Cmd = &SubmitBlockCmd{} + +// NewSubmitBlockCmd creates a new SubmitBlockCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewSubmitBlockCmd(id interface{}, hexblock string, optArgs ...*SubmitBlockOptions) (*SubmitBlockCmd, error) { + var options *SubmitBlockOptions + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + options = optArgs[0] + } + + return &SubmitBlockCmd{ + id: id, + HexBlock: hexblock, + Options: options, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SubmitBlockCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SubmitBlockCmd) Method() string { + return "submitblock" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SubmitBlockCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "submitblock", + Id: cmd.id, + Params: []interface{}{ + cmd.HexBlock, + }, + } + + if cmd.Options != nil { + raw.Params = append(raw.Params, cmd.Options) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SubmitBlockCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 || len(r.Params) < 1 { + return ErrWrongNumberOfParams + } + + hexblock, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter hexblock must be a string") + } + + optArgs := make([]*SubmitBlockOptions, 0, 1) + if len(r.Params) == 2 { + obj, ok := r.Params[1].(map[string]interface{}) + if !ok { + return errors.New("second optioanl parameter options must be an object") + } + options := new(SubmitBlockOptions) + + // workid is optional + iworkid, ok := obj["workid"] + if ok { + workid, ok := iworkid.(string) + if !ok { + return errors.New("object member workid must be a string") + } + options.WorkId = workid + } + optArgs = append(optArgs, options) + } + + newCmd, err := NewSubmitBlockCmd(r.Id, hexblock, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ValidateAddressCmd is a type handling custom marshaling and +// unmarshaling of validateaddress JSON RPC commands. +type ValidateAddressCmd struct { + id interface{} + Address string +} + +// Enforce that ValidateAddressCmd satisifies the Cmd interface. +var _ Cmd = &ValidateAddressCmd{} + +// NewValidateAddressCmd creates a new ValidateAddressCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewValidateAddressCmd(id interface{}, address string) (*ValidateAddressCmd, error) { + + return &ValidateAddressCmd{ + id: id, + Address: address, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ValidateAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ValidateAddressCmd) Method() string { + return "validateaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ValidateAddressCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "validateaddress", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ValidateAddressCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be a string") + } + + newCmd, err := NewValidateAddressCmd(r.Id, address) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// VerifyChainCmd is a type handling custom marshaling and +// unmarshaling of verifychain JSON RPC commands. +type VerifyChainCmd struct { + id interface{} + CheckLevel int + CheckDepth int +} + +// Enforce that VerifyChainCmd satisifies the Cmd interface. +var _ Cmd = &VerifyChainCmd{} + +// NewVerifyChainCmd creates a new VerifyChainCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewVerifyChainCmd(id interface{}, optArgs ...int) (*VerifyChainCmd, error) { + // bitcoind default, but they do vary it based on cli args. + var checklevel = 3 + var checkdepth = 288 + + if len(optArgs) > 0 { + if len(optArgs) > 2 { + return nil, ErrTooManyOptArgs + } + checklevel = optArgs[0] + + if len(optArgs) > 1 { + checkdepth = optArgs[1] + } + } + + return &VerifyChainCmd{ + id: id, + CheckLevel: checklevel, + CheckDepth: checkdepth, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *VerifyChainCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *VerifyChainCmd) Method() string { + return "verifychain" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *VerifyChainCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "verifychain", + Id: cmd.id, + Params: []interface{}{}, + } + + // XXX(oga) magic numbers + if cmd.CheckLevel != 3 || cmd.CheckDepth != 288 { + raw.Params = append(raw.Params, cmd.CheckLevel) + } + + if cmd.CheckDepth != 288 { + raw.Params = append(raw.Params, cmd.CheckDepth) + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *VerifyChainCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + optArgs := make([]int, 0, 2) + if len(r.Params) > 0 { + checklevel, ok := r.Params[0].(float64) + if !ok { + return errors.New("first optional parameter checklevel must be a number") + } + + optArgs = append(optArgs, int(checklevel)) + } + + if len(r.Params) > 1 { + checkdepth, ok := r.Params[1].(float64) + if !ok { + return errors.New("second optional parameter checkdepth must be a number") + } + + optArgs = append(optArgs, int(checkdepth)) + } + + newCmd, err := NewVerifyChainCmd(r.Id, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// VerifyMessageCmd is a type handling custom marshaling and +// unmarshaling of verifymessage JSON RPC commands. +type VerifyMessageCmd struct { + id interface{} + Address string + Signature string + Message string +} + +// Enforce that VerifyMessageCmd satisifies the Cmd interface. +var _ Cmd = &VerifyMessageCmd{} + +// NewVerifyMessageCmd creates a new VerifyMessageCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewVerifyMessageCmd(id interface{}, address string, signature string, + message string) (*VerifyMessageCmd, error) { + + return &VerifyMessageCmd{ + id: id, + Address: address, + Signature: signature, + Message: message, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *VerifyMessageCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *VerifyMessageCmd) Method() string { + return "verifymessage" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *VerifyMessageCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "verifymessage", + Id: cmd.id, + Params: []interface{}{ + cmd.Address, + cmd.Signature, + cmd.Message, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *VerifyMessageCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 3 { + return ErrWrongNumberOfParams + } + + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be a string") + } + + signature, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter signature must be a string") + } + + message, ok := r.Params[2].(string) + if !ok { + return errors.New("third parameter message must be a string") + } + + newCmd, err := NewVerifyMessageCmd(r.Id, address, signature, message) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// WalletLockCmd is a type handling custom marshaling and +// unmarshaling of walletlock JSON RPC commands. +type WalletLockCmd struct { + id interface{} +} + +// Enforce that WalletLockCmd satisifies the Cmd interface. +var _ Cmd = &WalletLockCmd{} + +// NewWalletLockCmd creates a new WalletLockCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewWalletLockCmd(id interface{}) (*WalletLockCmd, error) { + + return &WalletLockCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *WalletLockCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *WalletLockCmd) Method() string { + return "walletlock" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *WalletLockCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "walletlock", + Id: cmd.id, + Params: []interface{}{}, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *WalletLockCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewWalletLockCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// WalletPassphraseCmd is a type handling custom marshaling and +// unmarshaling of walletpassphrase JSON RPC commands. +type WalletPassphraseCmd struct { + id interface{} + Passphrase string + Timeout int64 +} + +// Enforce that WalletPassphraseCmd satisifies the Cmd interface. +var _ Cmd = &WalletPassphraseCmd{} + +// NewWalletPassphraseCmd creates a new WalletPassphraseCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewWalletPassphraseCmd(id interface{}, passphrase string, timeout int64) (*WalletPassphraseCmd, error) { + + return &WalletPassphraseCmd{ + id: id, + Passphrase: passphrase, + Timeout: timeout, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *WalletPassphraseCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *WalletPassphraseCmd) Method() string { + return "walletpassphrase" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *WalletPassphraseCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "walletpassphrase", + Id: cmd.id, + Params: []interface{}{ + cmd.Passphrase, + cmd.Timeout, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *WalletPassphraseCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 { + return ErrWrongNumberOfParams + } + + passphrase, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter passphrase must be a string") + } + + timeout, ok := r.Params[1].(float64) + if !ok { + return errors.New("second parameter timeout must be a number") + } + + newCmd, err := NewWalletPassphraseCmd(r.Id, passphrase, int64(timeout)) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// WalletPassphraseChangeCmd is a type handling custom marshaling and +// unmarshaling of walletpassphrasechange JSON RPC commands. +type WalletPassphraseChangeCmd struct { + id interface{} + OldPassphrase string + NewPassphrase string +} + +// Enforce that WalletPassphraseChangeCmd satisifies the Cmd interface. +var _ Cmd = &WalletPassphraseChangeCmd{} + +// NewWalletPassphraseChangeCmd creates a new WalletPassphraseChangeCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewWalletPassphraseChangeCmd(id interface{}, oldpassphrase, newpassphrase string) (*WalletPassphraseChangeCmd, error) { + + return &WalletPassphraseChangeCmd{ + id: id, + OldPassphrase: oldpassphrase, + NewPassphrase: newpassphrase, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *WalletPassphraseChangeCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *WalletPassphraseChangeCmd) Method() string { + return "walletpassphrasechange" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *WalletPassphraseChangeCmd) MarshalJSON() ([]byte, error) { + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "walletpassphrasechange", + Id: cmd.id, + Params: []interface{}{ + cmd.OldPassphrase, + cmd.NewPassphrase, + }, + } + + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *WalletPassphraseChangeCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 2 { + return ErrWrongNumberOfParams + } + + oldpassphrase, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter oldpassphrase must be a string") + } + + newpassphrase, ok := r.Params[1].(string) + if !ok { + return errors.New("second parameter newpassphrase must be a string") + } + + newCmd, err := NewWalletPassphraseChangeCmd(r.Id, oldpassphrase, newpassphrase) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} diff --git a/jsoncmd_test.go b/jsoncmd_test.go new file mode 100644 index 00000000..270020fa --- /dev/null +++ b/jsoncmd_test.go @@ -0,0 +1,193 @@ +// Copyright (c) 2013 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// this has to be in the real json subpackage so we can mock up structs +package btcjson + +import ( + "encoding/json" + "github.com/davecgh/go-spew/spew" + "reflect" + "testing" +) + +var jsoncmdtests = []struct { + name string + f func() (Cmd, error) + result Cmd // after marshal and unmarshal +}{ + { + name: "basic addmultisigaddress", + f: func() (Cmd, error) { + return NewAddMultisigAddressCmd(float64(1), 1, + []string{"foo", "bar"}) + }, + result: &AddMultisigAddressCmd{ + id: float64(1), + NRequired: 1, + Keys: []string{"foo", "bar"}, + Account: "", + }, + }, + { + name: "addmultisigaddress + optional", + f: func() (Cmd, error) { + return NewAddMultisigAddressCmd(float64(1), 1, + []string{"foo", "bar"}, "address") + }, + result: &AddMultisigAddressCmd{ + id: float64(1), + NRequired: 1, + Keys: []string{"foo", "bar"}, + Account: "address", + }, + }, + // TODO(oga) Too many arguments to newaddmultisigaddress + { + name: "basic addnode add", + f: func() (Cmd, error) { + return NewAddNodeCmd(float64(1), "address", + "add") + }, + result: &AddNodeCmd{ + id: float64(1), + Addr: "address", + SubCmd: "add", + }, + }, + { + name: "basic addnode remoe", + f: func() (Cmd, error) { + return NewAddNodeCmd(float64(1), "address", + "remove") + }, + result: &AddNodeCmd{ + id: float64(1), + Addr: "address", + SubCmd: "remove", + }, + }, + { + name: "basic addnode onetry", + f: func() (Cmd, error) { + return NewAddNodeCmd(float64(1), "address", + "onetry") + }, + result: &AddNodeCmd{ + id: float64(1), + Addr: "address", + SubCmd: "onetry", + }, + }, + // TODO(oga) try invalid subcmds + { + name: "basic backupwallet", + f: func() (Cmd, error) { + return NewBackupWalletCmd(float64(1), "destination") + }, + result: &BackupWalletCmd{ + id: float64(1), + Destination: "destination", + }, + }, + { + name: "basic createmultisig", + f: func() (Cmd, error) { + return NewCreateMultisigCmd(float64(1), 1, + []string{"key1", "key2", "key3"}) + }, + result: &CreateMultisigCmd{ + id: float64(1), + NRequired: 1, + Keys: []string{"key1", "key2", "key3"}, + }, + }, + { + name: "basic createrawtransaction", + f: func() (Cmd, error) { + return NewCreateRawTransactionCmd(float64(1), + []TransactionInput{ + TransactionInput{Txid: "tx1", Vout: 1}, + TransactionInput{Txid: "tx2", Vout: 3}}, + map[string]int64{"bob": 1, "bill": 2}) + }, + result: &CreateRawTransactionCmd{ + id: float64(1), + Inputs: []TransactionInput{ + TransactionInput{Txid: "tx1", Vout: 1}, + TransactionInput{Txid: "tx2", Vout: 3}, + }, + Amounts: map[string]int64{ + "bob": 1, + "bill": 2, + }, + }, + }, + { + name: "basic ping", + f: func() (Cmd, error) { + return NewPingCmd(float64(1)) + }, + result: &PingCmd{ + id: float64(1), + }, + }, + { + name: "basic getblockcount", + f: func() (Cmd, error) { + return NewGetBlockCountCmd(float64(1)) + }, + result: &GetBlockCountCmd{ + id: float64(1), + }, + }, + { + name: "basic getblock", + f: func() (Cmd, error) { + return NewGetBlockCmd(float64(1), + "somehash") + }, + result: &GetBlockCmd{ + id: float64(1), + Hash: "somehash", + }, + }, +} + +func TestCmds(t *testing.T) { + for _, test := range jsoncmdtests { + c, err := test.f() + if err != nil { + t.Errorf("%s: failed to run func: %v", + test.name, err) + continue + } + + msg, err := json.Marshal(c) + if err != nil { + t.Errorf("%s: failed to marshal cmd: %v", + test.name, err) + continue + } + + c2, err := ParseMarshaledCmd(msg) + if err != nil { + t.Errorf("%s: failed to ummarshal cmd: %v", + test.name, err) + continue + } + + if !reflect.DeepEqual(test.result, c2) { + t.Errorf("%s: unmarshal not as expected. "+ + "got %v wanted %v", test.name, spew.Sdump(c2), + spew.Sdump(test.result)) + } + if !reflect.DeepEqual(c, c2) { + t.Errorf("%s: unmarshal not as we started with. "+ + "got %v wanted %v", test.name, spew.Sdump(c2), + spew.Sdump(c)) + } + + } +} From bac56001459fa92eadc476531e6f567fd3bf4da1 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 17:22:07 +0100 Subject: [PATCH 043/229] basic functionality test for decoderawtransactioncmd --- jsoncmd_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 270020fa..67b93e45 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -124,6 +124,17 @@ var jsoncmdtests = []struct { }, }, }, + { + name: "basic decoderawtransaction", + f: func() (Cmd, error) { + return NewDecodeRawTransactionCmd(float64(1), + "thisisahexidecimaltransaction") + }, + result: &DecodeRawTransactionCmd{ + id: float64(1), + HexTx: "thisisahexidecimaltransaction", + }, + }, { name: "basic ping", f: func() (Cmd, error) { From 77316a003a160108a06e95abd8309cde7a330a5d Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 17:47:11 +0100 Subject: [PATCH 044/229] fix method for getaccountaddress. and test dumpprivkey, dumpwallet, encryptwallet, getaccount and getaccountaddress --- jsoncmd.go | 2 +- jsoncmd_test.go | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index 0fcf1ce9..86198ff7 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1198,7 +1198,7 @@ func (cmd *GetAccountAddressCmd) MarshalJSON() ([]byte, error) { // Fill and marshal a RawCmd. return json.Marshal(RawCmd{ Jsonrpc: "1.0", - Method: "accountaddress", + Method: "getaccountaddress", Id: cmd.id, Params: []interface{}{ cmd.Account, diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 67b93e45..eb462002 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -135,6 +135,61 @@ var jsoncmdtests = []struct { HexTx: "thisisahexidecimaltransaction", }, }, + { + name: "basic dumpprivkey", + f: func() (Cmd, error) { + return NewDumpPrivKeyCmd(float64(1), + "address") + }, + result: &DumpPrivKeyCmd{ + id: float64(1), + Address: "address", + }, + }, + { + name: "basic dumpwallet", + f: func() (Cmd, error) { + return NewDumpWalletCmd(float64(1), + "filename") + }, + result: &DumpWalletCmd{ + id: float64(1), + Filename: "filename", + }, + }, + { + name: "basic encryptwallet", + f: func() (Cmd, error) { + return NewEncryptWalletCmd(float64(1), + "passphrase") + }, + result: &EncryptWalletCmd{ + id: float64(1), + Passphrase: "passphrase", + }, + }, + { + name: "basic getaccount", + f: func() (Cmd, error) { + return NewGetAccountCmd(float64(1), + "address") + }, + result: &GetAccountCmd{ + id: float64(1), + Address: "address", + }, + }, + { + name: "basic getaccountaddress", + f: func() (Cmd, error) { + return NewGetAccountAddressCmd(float64(1), + "account") + }, + result: &GetAccountAddressCmd{ + id: float64(1), + Account: "account", + }, + }, { name: "basic ping", f: func() (Cmd, error) { From b3b8b37855011495127b1949e78f1ea315e3b580 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 18:23:28 +0100 Subject: [PATCH 045/229] test and fix bugs in getaddednodeinfo --- jsoncmd.go | 34 +++++++++++++--------------------- jsoncmd_test.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 86198ff7..de7fd5a5 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1253,7 +1253,7 @@ func NewGetAddedNodeInfoCmd(id interface{}, dns bool, optArgs ...string) (*GetAd if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - node = optArgs[1] + node = optArgs[0] } return &GetAddedNodeInfoCmd{ id: id, @@ -1275,26 +1275,18 @@ func (cmd *GetAddedNodeInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAddedNodeInfoCmd) MarshalJSON() ([]byte, error) { // Fill and marshal a RawCmd. - var raw RawCmd - if cmd.Node == "" { - raw = RawCmd{ - Jsonrpc: "1.0", - Method: "getaddednodeinfo", - Id: cmd.id, - Params: []interface{}{ - cmd.Dns, - }, - } - } else { - raw = RawCmd{ - Jsonrpc: "1.0", - Method: "getaddednodeinfo", - Id: cmd.id, - Params: []interface{}{ - cmd.Dns, - cmd.Node, - }, - } + + raw := RawCmd{ + Jsonrpc: "1.0", + Method: "getaddednodeinfo", + Id: cmd.id, + Params: []interface{}{ + cmd.Dns, + }, + } + + if cmd.Node != "" { + raw.Params = append(raw.Params, cmd.Node) } return json.Marshal(raw) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index eb462002..9434c2de 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -190,6 +190,38 @@ var jsoncmdtests = []struct { Account: "account", }, }, + { + name: "basic getaddednodeinfo true", + f: func() (Cmd, error) { + return NewGetAddedNodeInfoCmd(float64(1), true) + }, + result: &GetAddedNodeInfoCmd{ + id: float64(1), + Dns: true, + }, + }, + { + name: "basic getaddednodeinfo false", + f: func() (Cmd, error) { + return NewGetAddedNodeInfoCmd(float64(1), false) + }, + result: &GetAddedNodeInfoCmd{ + id: float64(1), + Dns: false, + }, + }, + { + name: "basic getaddednodeinfo withnode", + f: func() (Cmd, error) { + return NewGetAddedNodeInfoCmd(float64(1), true, + "thisisanode") + }, + result: &GetAddedNodeInfoCmd{ + id: float64(1), + Dns: true, + Node: "thisisanode", + }, + }, { name: "basic ping", f: func() (Cmd, error) { From fedafbdd498645ef86f823c615db311d93da28a9 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 18:23:53 +0100 Subject: [PATCH 046/229] go fmt --- jsoncmd.go | 8 ++++---- jsoncmd_test.go | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index de7fd5a5..41a8b831 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -375,7 +375,7 @@ func (cmd *AddMultisigAddressCmd) UnmarshalJSON(b []byte) error { return errors.New("second parameter keys must be an array") } keys := make([]string, len(ikeys)) - for i, val := range(ikeys) { + for i, val := range ikeys { keys[i], ok = val.(string) if !ok { return errors.New("second parameter keys must be an array of strings") @@ -618,7 +618,7 @@ func (cmd *CreateMultisigCmd) UnmarshalJSON(b []byte) error { return errors.New("second parameter keys must be an array") } keys := make([]string, len(ikeys)) - for i, val := range(ikeys) { + for i, val := range ikeys { keys[i], ok = val.(string) if !ok { return errors.New("second parameter keys must be an array of strings") @@ -712,7 +712,7 @@ func (cmd *CreateRawTransactionCmd) UnmarshalJSON(b []byte) error { if !ok { return errors.New("first parameter inputs must be an array of objects") } - + if len(v) != 2 { return errors.New("input with wrong number of members") } @@ -1275,7 +1275,7 @@ func (cmd *GetAddedNodeInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAddedNodeInfoCmd) MarshalJSON() ([]byte, error) { // Fill and marshal a RawCmd. - + raw := RawCmd{ Jsonrpc: "1.0", Method: "getaddednodeinfo", diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 9434c2de..27dd40c6 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -131,7 +131,7 @@ var jsoncmdtests = []struct { "thisisahexidecimaltransaction") }, result: &DecodeRawTransactionCmd{ - id: float64(1), + id: float64(1), HexTx: "thisisahexidecimaltransaction", }, }, @@ -142,7 +142,7 @@ var jsoncmdtests = []struct { "address") }, result: &DumpPrivKeyCmd{ - id: float64(1), + id: float64(1), Address: "address", }, }, @@ -153,7 +153,7 @@ var jsoncmdtests = []struct { "filename") }, result: &DumpWalletCmd{ - id: float64(1), + id: float64(1), Filename: "filename", }, }, @@ -164,7 +164,7 @@ var jsoncmdtests = []struct { "passphrase") }, result: &EncryptWalletCmd{ - id: float64(1), + id: float64(1), Passphrase: "passphrase", }, }, @@ -175,7 +175,7 @@ var jsoncmdtests = []struct { "address") }, result: &GetAccountCmd{ - id: float64(1), + id: float64(1), Address: "address", }, }, @@ -186,7 +186,7 @@ var jsoncmdtests = []struct { "account") }, result: &GetAccountAddressCmd{ - id: float64(1), + id: float64(1), Account: "account", }, }, @@ -196,7 +196,7 @@ var jsoncmdtests = []struct { return NewGetAddedNodeInfoCmd(float64(1), true) }, result: &GetAddedNodeInfoCmd{ - id: float64(1), + id: float64(1), Dns: true, }, }, @@ -206,7 +206,7 @@ var jsoncmdtests = []struct { return NewGetAddedNodeInfoCmd(float64(1), false) }, result: &GetAddedNodeInfoCmd{ - id: float64(1), + id: float64(1), Dns: false, }, }, @@ -217,8 +217,8 @@ var jsoncmdtests = []struct { "thisisanode") }, result: &GetAddedNodeInfoCmd{ - id: float64(1), - Dns: true, + id: float64(1), + Dns: true, Node: "thisisanode", }, }, From d1ac7b938410743c34fcbda58258f274b95bd0e1 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 18:32:51 +0100 Subject: [PATCH 047/229] getaddressesbyaccoutn and getbalance test. and one bug in the marshalling code for getbalance --- jsoncmd.go | 6 ++---- jsoncmd_test.go | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 41a8b831..dda08fd5 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1453,9 +1453,7 @@ func (cmd *GetBalanceCmd) MarshalJSON() ([]byte, error) { Jsonrpc: "1.0", Method: "getbalance", Id: cmd.id, - Params: []interface{}{ - cmd.Account, - }, + Params: []interface{}{}, } if cmd.Account != "" || cmd.Minconf != 1 { @@ -1493,7 +1491,7 @@ func (cmd *GetBalanceCmd) UnmarshalJSON(b []byte) error { if len(r.Params) > 1 { minconf, ok := r.Params[1].(float64) if !ok { - return errors.New("first optional parameter minconf must be a number") + return errors.New("second optional parameter minconf must be a number") } optArgs = append(optArgs, int(minconf)) } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 27dd40c6..41ed52a9 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -222,6 +222,59 @@ var jsoncmdtests = []struct { Node: "thisisanode", }, }, + { + name: "basic getaddressesbyaccount", + f: func() (Cmd, error) { + return NewGetAddressesByAccountCmd(float64(1), + "account") + }, + result: &GetAddressesByAccountCmd{ + id: float64(1), + Account: "account", + }, + }, + { + name: "basic getbalance", + f: func() (Cmd, error) { + return NewGetBalanceCmd(float64(1)) + }, + result: &GetBalanceCmd{ + id: float64(1), + Minconf: 1, // the default + }, + }, + { + name: "basic getbalance + account", + f: func() (Cmd, error) { + return NewGetBalanceCmd(float64(1), "account") + }, + result: &GetBalanceCmd{ + id: float64(1), + Account: "account", + Minconf: 1, // the default + }, + }, + { + name: "basic getbalance + minconf", + f: func() (Cmd, error) { + return NewGetBalanceCmd(float64(1), "", 2) + }, + result: &GetBalanceCmd{ + id: float64(1), + Minconf: 2, + }, + }, + { + name: "basic getbalance + account + minconf", + f: func() (Cmd, error) { + return NewGetBalanceCmd(float64(1), "account", 2) + }, + result: &GetBalanceCmd{ + id: float64(1), + Account: "account", + Minconf: 2, + }, + }, { name: "basic ping", f: func() (Cmd, error) { From ebc4c17162231a9097732f0a68ff87b86f95eefb Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 18:36:27 +0100 Subject: [PATCH 048/229] Add basic test for getbestblockhash. And move the getblock/getblockcount so they are in order. --- jsoncmd_test.go | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 41ed52a9..0e7d9c63 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -276,20 +276,11 @@ var jsoncmdtests = []struct { }, }, { - name: "basic ping", + name: "basic getbestblockhash", f: func() (Cmd, error) { - return NewPingCmd(float64(1)) + return NewGetBestBlockHashCmd(float64(1)) }, - result: &PingCmd{ - id: float64(1), - }, - }, - { - name: "basic getblockcount", - f: func() (Cmd, error) { - return NewGetBlockCountCmd(float64(1)) - }, - result: &GetBlockCountCmd{ + result: &GetBestBlockHashCmd{ id: float64(1), }, }, @@ -304,6 +295,24 @@ var jsoncmdtests = []struct { Hash: "somehash", }, }, + { + name: "basic getblockcount", + f: func() (Cmd, error) { + return NewGetBlockCountCmd(float64(1)) + }, + result: &GetBlockCountCmd{ + id: float64(1), + }, + }, + { + name: "basic ping", + f: func() (Cmd, error) { + return NewPingCmd(float64(1)) + }, + result: &PingCmd{ + id: float64(1), + }, + }, } func TestCmds(t *testing.T) { From 020444906be64188fc3fa00093dd3a1760e05a3d Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 19:00:33 +0100 Subject: [PATCH 049/229] Getblockhash and getblock template Fix some type wranging in unmarshal for getblocktemplate --- jsoncmd.go | 15 ++++++++++--- jsoncmd_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index dda08fd5..9cd2d0f7 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1853,11 +1853,20 @@ func (cmd *GetBlockTemplateCmd) UnmarshalJSON(b []byte) error { capabilities, ok := rmap["capabilities"] if ok { - scap, ok := capabilities.([]string) + icap, ok := capabilities.([]interface{}) if !ok { - return errors.New("TemplateRequest mode must be a string array") + return errors.New("TemplateRequest mode must be an array") } - trequest.Capabilities = scap + + cap := make([]string, len(icap)) + for i, val := range icap { + cap[i], ok = val.(string) + if !ok { + return errors.New("TemplateRequest mode must be an aray of strings") + } + } + + trequest.Capabilities = cap } optArgs = append(optArgs, trequest) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 0e7d9c63..4163644c 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -304,6 +304,62 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic getblockhash", + f: func() (Cmd, error) { + return NewGetBlockHashCmd(float64(1), 1234) + }, + result: &GetBlockHashCmd{ + id: float64(1), + Index: 1234, + }, + }, + { + name: "basic getblocktemplate", + f: func() (Cmd, error) { + return NewGetBlockTemplateCmd(float64(1)) + }, + result: &GetBlockTemplateCmd{ + id: float64(1), + }, + }, + { + name: "basic getblocktemplate + request", + f: func() (Cmd, error) { + return NewGetBlockTemplateCmd(float64(1), + &TemplateRequest{Mode:"mode", + Capabilities: []string{"one", "two", "three"}}) + }, + result: &GetBlockTemplateCmd{ + id: float64(1), + Request: &TemplateRequest{ + Mode:"mode", + Capabilities: []string{ + "one", + "two", + "three", + }, + }, + }, + }, + { + name: "basic getblocktemplate + request no mode", + f: func() (Cmd, error) { + return NewGetBlockTemplateCmd(float64(1), + &TemplateRequest{ + Capabilities: []string{"one", "two", "three"}}) + }, + result: &GetBlockTemplateCmd{ + id: float64(1), + Request: &TemplateRequest{ + Capabilities: []string{ + "one", + "two", + "three", + }, + }, + }, + }, { name: "basic ping", f: func() (Cmd, error) { From 00382bed8d19e1de95b4cf69705a0e244cc7e7cf Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 25 Oct 2013 13:07:45 -0400 Subject: [PATCH 050/229] Adding to tests. Fix typo in a test name. Update coverage report. --- jsoncmd_test.go | 51 +++++- test_coverage.txt | 384 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 421 insertions(+), 14 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 4163644c..a2c55df3 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -57,7 +57,7 @@ var jsoncmdtests = []struct { }, }, { - name: "basic addnode remoe", + name: "basic addnode remove", f: func() (Cmd, error) { return NewAddNodeCmd(float64(1), "address", "remove") @@ -369,6 +369,55 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic verifymessage", + f: func() (Cmd, error) { + return NewVerifyMessageCmd(float64(1), + "someaddress", + "somesig", + "a message") + }, + result: &VerifyMessageCmd{ + id: float64(1), + Address: "someaddress", + Signature: "somesig", + Message: "a message", + }, + }, + { + name: "basic walletlock", + f: func() (Cmd, error) { + return NewWalletLockCmd(float64(1)) + }, + result: &WalletLockCmd{ + id: float64(1), + }, + }, + { + name: "basic walletpassphrase", + f: func() (Cmd, error) { + return NewWalletPassphraseCmd(float64(1), + "phrase1", + 10) + }, + result: &WalletPassphraseCmd{ + id: float64(1), + Passphrase: "phrase1", + Timeout: 10, + }, + }, + { + name: "basic walletpassphrasechange", + f: func() (Cmd, error) { + return NewWalletPassphraseChangeCmd(float64(1), + "phrase1", "phrase2") + }, + result: &WalletPassphraseChangeCmd{ + id: float64(1), + OldPassphrase: "phrase1", + NewPassphrase: "phrase2", + }, + }, } func TestCmds(t *testing.T) { diff --git a/test_coverage.txt b/test_coverage.txt index c72b7f48..4b188abe 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,15 +1,373 @@ -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (64/64) -github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 99.39% (327/329) -github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson ------------------- 97.08% (466/480) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) +github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) +github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) +github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) +github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 37.80% (31/82) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 0.00% (0/53) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 0.00% (0/38) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 0.00% (0/36) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 0.00% (0/34) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 0.00% (0/33) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 0.00% (0/30) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 0.00% (0/26) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 0.00% (0/24) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 0.00% (0/22) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 0.00% (0/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 0.00% (0/19) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 0.00% (0/14) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 0.00% (0/9) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 0.00% (0/9) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 34.16% (878/2570) From 0daf04f9bdef034bf56bf7b13edecbcbb297a00f Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 19:42:25 +0100 Subject: [PATCH 051/229] More get commands. --- jsoncmd_test.go | 63 ++++++++ test_coverage.txt | 362 +++++++++++++++++++++++----------------------- 2 files changed, 244 insertions(+), 181 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index a2c55df3..c7499685 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -360,6 +360,69 @@ var jsoncmdtests = []struct { }, }, }, + { + name: "basic getconectioncount", + f: func() (Cmd, error) { + return NewGetConnectionCountCmd(float64(1)) + }, + result: &GetConnectionCountCmd{ + id: float64(1), + }, + }, + { + name: "basic getdifficulty", + f: func() (Cmd, error) { + return NewGetDifficultyCmd(float64(1)) + }, + result: &GetDifficultyCmd{ + id: float64(1), + }, + }, + { + name: "basic getgeneratecmd", + f: func() (Cmd, error) { + return NewGetGenerateCmd(float64(1)) + }, + result: &GetGenerateCmd{ + id: float64(1), + }, + }, + { + name: "basic gethashespersec", + f: func() (Cmd, error) { + return NewGetHashesPerSecCmd(float64(1)) + }, + result: &GetHashesPerSecCmd{ + id: float64(1), + }, + }, + { + name: "basic getinfo", + f: func() (Cmd, error) { + return NewGetInfoCmd(float64(1)) + }, + result: &GetInfoCmd{ + id: float64(1), + }, + }, + { + name: "basic getinfo", + f: func() (Cmd, error) { + return NewGetInfoCmd(float64(1)) + }, + result: &GetInfoCmd{ + id: float64(1), + }, + }, + { + name: "basic getnettotals", + f: func() (Cmd, error) { + return NewGetNetTotalsCmd(float64(1)) + }, + result: &GetNetTotalsCmd{ + id: float64(1), + }, + }, { name: "basic ping", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index 4b188abe..c2a3412a 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -47,6 +47,18 @@ github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) @@ -63,20 +75,26 @@ github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73 github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) @@ -84,290 +102,272 @@ github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 37.80% (31/82) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 45.12% (37/82) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 0.00% (0/53) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 0.00% (0/38) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 0.00% (0/36) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 0.00% (0/34) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 0.00% (0/30) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 0.00% (0/26) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 0.00% (0/24) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 0.00% (0/22) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 0.00% (0/19) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 0.00% (0/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 0.00% (0/19) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 0.00% (0/14) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 0.00% (0/9) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 34.16% (878/2570) +github.com/conformal/btcjson --------------------------------------- 36.50% (938/2570) From 711f229487ba2e84276d8130a04c8f51be5d5321 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 19:50:39 +0100 Subject: [PATCH 052/229] add getmininginfo to switch and move to alphabetical order. more tests. --- jsoncmd.go | 123 +++++++++++++++++++++++++----------------------- jsoncmd_test.go | 56 +++++++++++++++++++--- 2 files changed, 112 insertions(+), 67 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 9cd2d0f7..9af4793d 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -134,6 +134,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "getinfo": cmd = new(GetInfoCmd) + case "getmininginfo": + cmd = new(GetMiningInfoCmd) + case "getnettotals": cmd = new(GetNetTotalsCmd) @@ -2181,6 +2184,66 @@ func (cmd *GetInfoCmd) UnmarshalJSON(b []byte) error { return nil } +// GetMiningInfoCmd is a type handling custom marshaling and +// unmarshaling of getmininginfo JSON RPC commands. +type GetMiningInfoCmd struct { + id interface{} +} + +// Enforce that GetMiningInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetMiningInfoCmd{} + +// NewGetMiningInfoCmd creates a new GetMiningInfoCmd. +func NewGetMiningInfoCmd(id interface{}) (*GetMiningInfoCmd, error) { + return &GetMiningInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetMiningInfoCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetMiningInfoCmd) Method() string { + return "getmininginfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetMiningInfoCmd) MarshalJSON() ([]byte, error) { + + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: "getmininginfo", + Id: cmd.id, + Params: []interface{}{}, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetMiningInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetMiningInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // GetNetTotalsCmd is a type handling custom marshaling and // unmarshaling of getnettotals JSON RPC commands. type GetNetTotalsCmd struct { @@ -2347,66 +2410,6 @@ func (cmd *GetNetworkHashPSCmd) UnmarshalJSON(b []byte) error { return nil } -// GetMiningInfoCmd is a type handling custom marshaling and -// unmarshaling of getmininginfo JSON RPC commands. -type GetMiningInfoCmd struct { - id interface{} -} - -// Enforce that GetMiningInfoCmd satisifies the Cmd interface. -var _ Cmd = &GetMiningInfoCmd{} - -// NewGetMiningInfoCmd creates a new GetMiningInfoCmd. -func NewGetMiningInfoCmd(id interface{}) (*GetMiningInfoCmd, error) { - return &GetMiningInfoCmd{ - id: id, - }, nil -} - -// Id satisfies the Cmd interface by returning the id of the command. -func (cmd *GetMiningInfoCmd) Id() interface{} { - return cmd.id -} - -// Method satisfies the Cmd interface by returning the json method. -func (cmd *GetMiningInfoCmd) Method() string { - return "getmininginfo" -} - -// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. -func (cmd *GetMiningInfoCmd) MarshalJSON() ([]byte, error) { - - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getmininginfo", - Id: cmd.id, - Params: []interface{}{}, - }) -} - -// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of -// the Cmd interface. -func (cmd *GetMiningInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd - var r RawCmd - if err := json.Unmarshal(b, &r); err != nil { - return err - } - - if len(r.Params) != 0 { - return ErrWrongNumberOfParams - } - - newCmd, err := NewGetMiningInfoCmd(r.Id) - if err != nil { - return err - } - - *cmd = *newCmd - return nil -} - // GetNewAddressCmd is a type handling custom marshaling and // unmarshaling of getnewaddress JSON RPC commands. type GetNewAddressCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index c7499685..3b033737 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -310,7 +310,7 @@ var jsoncmdtests = []struct { return NewGetBlockHashCmd(float64(1), 1234) }, result: &GetBlockHashCmd{ - id: float64(1), + id: float64(1), Index: 1234, }, }, @@ -327,13 +327,13 @@ var jsoncmdtests = []struct { name: "basic getblocktemplate + request", f: func() (Cmd, error) { return NewGetBlockTemplateCmd(float64(1), - &TemplateRequest{Mode:"mode", - Capabilities: []string{"one", "two", "three"}}) + &TemplateRequest{Mode: "mode", + Capabilities: []string{"one", "two", "three"}}) }, result: &GetBlockTemplateCmd{ id: float64(1), - Request: &TemplateRequest{ - Mode:"mode", + Request: &TemplateRequest{ + Mode: "mode", Capabilities: []string{ "one", "two", @@ -347,11 +347,11 @@ var jsoncmdtests = []struct { f: func() (Cmd, error) { return NewGetBlockTemplateCmd(float64(1), &TemplateRequest{ - Capabilities: []string{"one", "two", "three"}}) + Capabilities: []string{"one", "two", "three"}}) }, result: &GetBlockTemplateCmd{ id: float64(1), - Request: &TemplateRequest{ + Request: &TemplateRequest{ Capabilities: []string{ "one", "two", @@ -423,6 +423,48 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic getnetworkhashps", + f: func() (Cmd, error) { + return NewGetNetworkHashPSCmd(float64(1)) + }, + result: &GetNetworkHashPSCmd{ + id: float64(1), + Blocks: 120, + Height: -1, + }, + }, + { + name: "basic getnetworkhashps + blocks", + f: func() (Cmd, error) { + return NewGetNetworkHashPSCmd(float64(1), 5000) + }, + result: &GetNetworkHashPSCmd{ + id: float64(1), + Blocks: 5000, + Height: -1, + }, + }, + { + name: "basic getnetworkhashps + blocks + height", + f: func() (Cmd, error) { + return NewGetNetworkHashPSCmd(float64(1), 5000, 1000) + }, + result: &GetNetworkHashPSCmd{ + id: float64(1), + Blocks: 5000, + Height: 1000, + }, + }, + { + name: "basic getmininginfo", + f: func() (Cmd, error) { + return NewGetMiningInfoCmd(float64(1)) + }, + result: &GetMiningInfoCmd{ + id: float64(1), + }, + }, { name: "basic ping", f: func() (Cmd, error) { From e396121192c60d7b1c515e60633194ca7c862bd2 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 25 Oct 2013 20:02:13 +0100 Subject: [PATCH 053/229] More info commands. --- jsoncmd_test.go | 25 +++- test_coverage.txt | 360 +++++++++++++++++++++++----------------------- 2 files changed, 202 insertions(+), 183 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 3b033737..7ebd9d1d 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -414,6 +414,15 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic getmininginfo", + f: func() (Cmd, error) { + return NewGetMiningInfoCmd(float64(1)) + }, + result: &GetMiningInfoCmd{ + id: float64(1), + }, + }, { name: "basic getnettotals", f: func() (Cmd, error) { @@ -457,11 +466,21 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getmininginfo", + name: "basic getnewaddress", f: func() (Cmd, error) { - return NewGetMiningInfoCmd(float64(1)) + return NewGetNewAddressCmd(float64(1), "address") }, - result: &GetMiningInfoCmd{ + result: &GetNewAddressCmd{ + id: float64(1), + Address: "address", + }, + }, + { + name: "basic getpeerinfo", + f: func() (Cmd, error) { + return NewGetPeerInfoCmd(float64(1)) + }, + result: &GetPeerInfoCmd{ id: float64(1), }, }, diff --git a/test_coverage.txt b/test_coverage.txt index c2a3412a..b999ae5d 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -5,19 +5,21 @@ github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -57,52 +59,62 @@ github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 45.12% (37/82) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 49.40% (41/83) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 0.00% (0/53) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 0.00% (0/38) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 0.00% (0/36) @@ -114,260 +126,248 @@ github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00 github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 0.00% (0/26) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 0.00% (0/24) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 0.00% (0/22) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 0.00% (0/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 0.00% (0/19) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 0.00% (0/14) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 0.00% (0/9) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 0.00% (0/8) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 36.50% (938/2570) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 39.32% (1011/2571) From c4be414921bcf67f6351f66db87fcb49001babea Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Tue, 29 Oct 2013 22:33:27 +0000 Subject: [PATCH 054/229] Make ParseMarshaledCmd return a known error if the type isn't known. --- jsoncmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index 9af4793d..b7540174 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -281,7 +281,7 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { } if cmd == nil { - return nil, errors.New("unimplemented") + return nil, ErrMethodNotFound } // If we get here we have a cmd that can unmarshal itself. From 334a1c1f20a2916863e8571bd49962e485ff3d81 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 29 Oct 2013 22:53:19 -0400 Subject: [PATCH 055/229] Return basic Cmd from ParseMarshaledCmd when possible. This changes the behavior of ParseMarshaledCmd to always return a non-nil Cmd whenever unmarshaling a valid JSON-RPC message succeeds. This is needed for RPC server code to reply back with detailed errors to clients using the Method and Id methods of the Cmd interface. --- jsoncmd.go | 70 ++++++++++++++++++++++++++++++++++++++++++++++--- jsoncmd_test.go | 4 +-- 2 files changed, 68 insertions(+), 6 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index b7540174..12f3c47c 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -50,6 +50,13 @@ func RegisterCustomCmd(method string, parser RawCmdParser) { // ParseMarshaledCmd parses a raw command and unmarshals as a Cmd. // Code that reads and handles commands should switch on the type and // type assert as the particular commands supported by the program. +// +// In all cases where b is a valid JSON-RPC message, and unmarshalling +// succeeds, a non-nil Cmd will always be returned. This even +// includes error cases where parsing the message into a concrete Cmd +// type fails. This behavior allows RPC server code to reply back with +// a detailed error using the Id and Method functions of the Cmd +// interface. func ParseMarshaledCmd(b []byte) (Cmd, error) { var r RawCmd if err := json.Unmarshal(b, &r); err != nil { @@ -281,15 +288,70 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { } if cmd == nil { - return nil, ErrMethodNotFound + cmd = newUnparsableCmd(r.Id, r.Method) + return cmd, ErrMethodNotFound } // If we get here we have a cmd that can unmarshal itself. if err := cmd.UnmarshalJSON(b); err != nil { - return nil, err - } else { - return cmd, nil + cmd = newUnparsableCmd(r.Id, r.Method) + return cmd, err } + return cmd, nil +} + +// unparsableCmd is a type representing a valid unmarshalled JSON-RPC +// request, but is used for cases where parsing the RPC request into a +// concrete Cmd type failed, either due to an unknown method, or trying +// to parse incorrect arguments for a known method. +type unparsableCmd struct { + id interface{} + method string +} + +// Enforce that unparsableCmd satisifies the Cmd interface. +var _ Cmd = &unparsableCmd{} + +func newUnparsableCmd(id interface{}, method string) *unparsableCmd { + return &unparsableCmd{ + id: id, + method: method, + } +} + +// Id satisifies the Cmd interface by returning the id of the command. +func (cmd *unparsableCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *unparsableCmd) Method() string { + return cmd.method +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *unparsableCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + raw := RawCmd{ + Jsonrpc: "1.0", + Method: cmd.method, + Id: cmd.id, + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *unparsableCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + cmd.id = r.Id + cmd.method = r.Method + return nil } // AddMultisigAddressCmd is a type handling custom marshaling and diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 7ebd9d1d..ffbabb42 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -471,14 +471,14 @@ var jsoncmdtests = []struct { return NewGetNewAddressCmd(float64(1), "address") }, result: &GetNewAddressCmd{ - id: float64(1), + id: float64(1), Address: "address", }, }, { name: "basic getpeerinfo", f: func() (Cmd, error) { - return NewGetPeerInfoCmd(float64(1)) + return NewGetPeerInfoCmd(float64(1)) }, result: &GetPeerInfoCmd{ id: float64(1), From 07de6ea013897b13995533889d99b17d52c574df Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 25 Oct 2013 15:41:23 -0400 Subject: [PATCH 056/229] Add additional tests for jsoncmd code. Test stop, signrawtransaction, setaccount, sendtoaddress, and a few others. Fix off by one error in the optional arguments for sendtoaddress. Rename occurances of Minconf to MinConf for constitancy. --- jsoncmd.go | 54 +++--- jsoncmd_test.go | 216 ++++++++++++++++++++- test_coverage.txt | 465 +++++++++++++++++++++++----------------------- 3 files changed, 479 insertions(+), 256 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 12f3c47c..3f0bfe84 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1464,7 +1464,7 @@ func (cmd *GetAddressesByAccountCmd) UnmarshalJSON(b []byte) error { type GetBalanceCmd struct { id interface{} Account string - Minconf int + MinConf int } // Enforce that GetBalanceCmd satisifies the Cmd interface. @@ -1498,7 +1498,7 @@ func NewGetBalanceCmd(id interface{}, optArgs ...interface{}) (*GetBalanceCmd, e return &GetBalanceCmd{ id: id, Account: account, - Minconf: minconf, + MinConf: minconf, }, nil } @@ -1521,11 +1521,11 @@ func (cmd *GetBalanceCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{}, } - if cmd.Account != "" || cmd.Minconf != 1 { + if cmd.Account != "" || cmd.MinConf != 1 { raw.Params = append(raw.Params, cmd.Account) } - if cmd.Minconf != 1 { - raw.Params = append(raw.Params, cmd.Minconf) + if cmd.MinConf != 1 { + raw.Params = append(raw.Params, cmd.MinConf) } // Fill and marshal a RawCmd. @@ -2858,7 +2858,7 @@ func (cmd *GetRawTransactionCmd) UnmarshalJSON(b []byte) error { type GetReceivedByAccountCmd struct { id interface{} Account string - Minconf int + MinConf int } // Enforce that GetReceivedByAccountCmd satisifies the Cmd interface. @@ -2890,7 +2890,7 @@ func NewGetReceivedByAccountCmd(id interface{}, optArgs ...interface{}) (*GetRec return &GetReceivedByAccountCmd{ id: id, Account: account, - Minconf: minconf, + MinConf: minconf, }, nil } @@ -2914,12 +2914,12 @@ func (cmd *GetReceivedByAccountCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{}, } - if cmd.Account != "" || cmd.Minconf != 1 { + if cmd.Account != "" || cmd.MinConf != 1 { raw.Params = append(raw.Params, cmd.Account) } - if cmd.Minconf != 1 { - raw.Params = append(raw.Params, cmd.Minconf) + if cmd.MinConf != 1 { + raw.Params = append(raw.Params, cmd.MinConf) } return json.Marshal(raw) } @@ -2970,7 +2970,7 @@ func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { type GetReceivedByAddressCmd struct { id interface{} Address string - Minconf int + MinConf int } // Enforce that GetReceivedByAddressCmd satisifies the Cmd interface. @@ -3002,7 +3002,7 @@ func NewGetReceivedByAddressCmd(id interface{}, optArgs ...interface{}) (*GetRec return &GetReceivedByAddressCmd{ id: id, Address: address, - Minconf: minconf, + MinConf: minconf, }, nil } @@ -3026,12 +3026,12 @@ func (cmd *GetReceivedByAddressCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{}, } - if cmd.Address != "" || cmd.Minconf != 1 { + if cmd.Address != "" || cmd.MinConf != 1 { raw.Params = append(raw.Params, cmd.Address) } - if cmd.Minconf != 1 { - raw.Params = append(raw.Params, cmd.Minconf) + if cmd.MinConf != 1 { + raw.Params = append(raw.Params, cmd.MinConf) } return json.Marshal(raw) } @@ -5329,17 +5329,16 @@ func (cmd *SendToAddressCmd) UnmarshalJSON(b []byte) error { if err != nil { return err } - optArgs := make([]interface{}, 0, 2) - if len(r.Params) > 3 { - comment, ok := r.Params[3].(string) + if len(r.Params) > 2 { + comment, ok := r.Params[2].(string) if !ok { return errors.New("third optional parameter comment must be a string") } optArgs = append(optArgs, comment) } - if len(r.Params) > 4 { - commentto, ok := r.Params[4].(string) + if len(r.Params) > 3 { + commentto, ok := r.Params[3].(string) if !ok { return errors.New("sixth optional parameter commentto must be a string") } @@ -5686,6 +5685,7 @@ type RawTxInput struct { Txid string `json:"txid"` Vout int `json:"vout"` ScriptPubKey string `json:"scriptPubKey"` + RedeemScript string `json:"redeemScript"` } // SignRawTransactionCmd is a type handling custom marshaling and @@ -5727,12 +5727,12 @@ func NewSignRawTransactionCmd(id interface{}, rawTx string, optArgs ...interface privkeys = pk } if len(optArgs) > 2 { - pk, ok := optArgs[2].([]string) + fl, ok := optArgs[2].(string) if !ok { return nil, errors.New("third optional parameter flags should be a string") } - privkeys = pk + flags = fl } return &SignRawTransactionCmd{ id: id, @@ -5837,6 +5837,16 @@ func (cmd *SignRawTransactionCmd) UnmarshalJSON(b []byte) error { return errors.New("scriptpubkey not a string in input object") } + redeemScript, ok := mip["redeemScript"] + if !ok { + return errors.New("redeemScript missing in input object") + } + + inputs[i].RedeemScript, ok = redeemScript.(string) + if !ok { + return errors.New("redeemScript not a string in input object") + } + } optArgs = append(optArgs, inputs) } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index ffbabb42..891ec0f3 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -240,7 +240,7 @@ var jsoncmdtests = []struct { }, result: &GetBalanceCmd{ id: float64(1), - Minconf: 1, // the default + MinConf: 1, // the default }, }, { @@ -251,7 +251,7 @@ var jsoncmdtests = []struct { result: &GetBalanceCmd{ id: float64(1), Account: "account", - Minconf: 1, // the default + MinConf: 1, // the default }, }, { @@ -261,7 +261,7 @@ var jsoncmdtests = []struct { }, result: &GetBalanceCmd{ id: float64(1), - Minconf: 2, + MinConf: 2, }, }, { @@ -272,7 +272,7 @@ var jsoncmdtests = []struct { result: &GetBalanceCmd{ id: float64(1), Account: "account", - Minconf: 2, + MinConf: 2, }, }, { @@ -493,6 +493,214 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic sendfrom", + f: func() (Cmd, error) { + return NewSendFromCmd(float64(1), + "account", + "address", + 12, + 1) + }, + result: &SendFromCmd{ + id: float64(1), + FromAccount: "account", + ToAddress: "address", + Amount: 12, + MinConf: 1, // the default + }, + }, + { + name: "basic sendrawtransaction", + f: func() (Cmd, error) { + return NewSendRawTransactionCmd(float64(1), + "hexstringofatx") + }, + result: &SendRawTransactionCmd{ + id: float64(1), + HexTx: "hexstringofatx", + }, + }, + { + name: "basic sendtoaddress", + f: func() (Cmd, error) { + return NewSendToAddressCmd(float64(1), + "somebtcaddress", + 1) + }, + result: &SendToAddressCmd{ + id: float64(1), + Address: "somebtcaddress", + Amount: 1, + }, + }, + { + name: "basic sendtoaddress plus optional", + f: func() (Cmd, error) { + return NewSendToAddressCmd(float64(1), + "somebtcaddress", + 1, + "a comment", + "comment to") + }, + result: &SendToAddressCmd{ + id: float64(1), + Address: "somebtcaddress", + Amount: 1, + Comment: "a comment", + CommentTo: "comment to", + }, + }, + { + name: "basic setaccount", + f: func() (Cmd, error) { + return NewSetAccountCmd(float64(1), + "somebtcaddress", + "account name") + }, + result: &SetAccountCmd{ + id: float64(1), + Address: "somebtcaddress", + Account: "account name", + }, + }, + { + name: "basic setgenerate", + f: func() (Cmd, error) { + return NewSetGenerateCmd(float64(1), true) + }, + result: &SetGenerateCmd{ + id: float64(1), + Generate: true, + }, + }, + { + name: "basic setgenerate + optional", + f: func() (Cmd, error) { + return NewSetGenerateCmd(float64(1), true, 10) + }, + result: &SetGenerateCmd{ + id: float64(1), + Generate: true, + GenProcLimit: 10, + }, + }, + /* { + name: "basic settxfee", + f: func() (Cmd, error) { + return NewSetTxFeeCmd(float64(1), 10) + }, + result: &SetTxFeeCmd{ + id: float64(1), + Amount: 100000000, + }, + },*/ + { + name: "basic signrawtransaction", + f: func() (Cmd, error) { + return NewSignRawTransactionCmd(float64(1), + "sometxstring") + }, + result: &SignRawTransactionCmd{ + id: float64(1), + RawTx: "sometxstring", + }, + }, + /* { + name: "basic signrawtransaction with optional", + f: func() (Cmd, error) { + return NewSignRawTransactionCmd(float64(1), + "sometxstring", + []RawTxInput{ + RawTxInput{ + Txid: "test", + Vout: 1, + ScriptPubKey: "test", + RedeemScript: "test", + }, + }, + []string{"aprivatekey", "privkey2"}, + "flags") + }, + result: &SignRawTransactionCmd{ + id: float64(1), + RawTx: "sometxstring", + Inputs: []RawTxInput{ + RawTxInput{ + Txid: "test", + Vout: 1, + ScriptPubKey: "test", + RedeemScript: "test", + }, + }, + PrivKeys: []string{"aprivatekey", "privkey2"}, + Flags: "flags", + }, + },*/ + { + name: "basic stop", + f: func() (Cmd, error) { + return NewStopCmd(float64(1)) + }, + result: &StopCmd{ + id: float64(1), + }, + }, + { + name: "basic submitblock", + f: func() (Cmd, error) { + return NewSubmitBlockCmd(float64(1), + "lotsofhex") + }, + result: &SubmitBlockCmd{ + id: float64(1), + HexBlock: "lotsofhex", + }, + }, + // { + // name: "submitblock with optional object", + // f: func() (Cmd, error) { + // return NewSubmitBlockCmd(float64(1), + // "lotsofhex", "otherstuff") + // }, + // result: &SubmitBlockCmd{ + // id: float64(1), + // HexBlock: "lotsofhex", + // }, + // }, + { + name: "basic validateaddress", + f: func() (Cmd, error) { + return NewValidateAddressCmd(float64(1), + "somebtcaddress") + }, + result: &ValidateAddressCmd{ + id: float64(1), + Address: "somebtcaddress", + }, + }, + { + name: "basic verifychain", + f: func() (Cmd, error) { + return NewVerifyChainCmd(float64(1)) + }, + result: &VerifyChainCmd{ + id: float64(1), + CheckLevel: 3, + CheckDepth: 288, + }, + }, + { + name: "basic verifychain + optional", + f: func() (Cmd, error) { + return NewVerifyChainCmd(float64(1), 4, 1) + }, + result: &VerifyChainCmd{ + id: float64(1), + CheckLevel: 4, + CheckDepth: 1, + }, + }, { name: "basic verifymessage", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index b999ae5d..5f467a83 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,24 +2,31 @@ github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -42,8 +49,8 @@ github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) @@ -65,309 +72,307 @@ github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 60.00% (51/85) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 49.40% (41/83) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 0.00% (0/53) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 0.00% (0/38) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 52.38% (11/21) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 50.00% (19/38) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 50.00% (3/6) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 42.31% (11/26) +github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 0.00% (0/36) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 0.00% (0/34) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 0.00% (0/33) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 0.00% (0/30) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 0.00% (0/26) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 0.00% (0/24) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 0.00% (0/22) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 0.00% (0/19) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 0.00% (0/19) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 0.00% (0/14) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 39.32% (1011/2571) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 47.88% (1240/2590) From e1dd773e7c8d964ced5bf8b6acc64adacab4b845 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 30 Oct 2013 09:58:57 -0400 Subject: [PATCH 057/229] Improve test coverage and fix some bugs found by tests. Fix move need to convert amount to btc from satoshi Fix settxfee need to convert amount to btc from satoshi Fix for optional arg off by one in move. Fix for gettxout in optional args along with typo in error message. And lots of new tests. --- jsoncmd.go | 11 +- jsoncmd_test.go | 214 ++++++++++++++++++++++++- test_coverage.txt | 398 +++++++++++++++++++++++----------------------- 3 files changed, 415 insertions(+), 208 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 3f0bfe84..8a64daff 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3226,11 +3226,10 @@ func (cmd *GetTxOutCmd) UnmarshalJSON(b []byte) error { output, ok := r.Params[1].(float64) if !ok { - return errors.New("first parameter output must be a number") + return errors.New("second parameter output must be a number") } - optArgs := make([]bool, 0, 1) - if len(r.Params) == 2 { + if len(r.Params) == 3 { mempool, ok := r.Params[2].(bool) if !ok { return errors.New("third optional parameter includemempool must be a bool") @@ -4673,7 +4672,7 @@ func NewMoveCmd(id interface{}, fromaccount string, toaccount string, amount int minconf = m } if len(optArgs) > 1 { - c, ok := optArgs[0].(string) + c, ok := optArgs[1].(string) if !ok { return nil, errors.New("second optional parameter comment is not a string") } @@ -4709,7 +4708,7 @@ func (cmd *MoveCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{ cmd.FromAccount, cmd.ToAccount, - cmd.Amount, + float64(cmd.Amount) / 1e8, //convert to BTC }, } @@ -5564,7 +5563,7 @@ func (cmd *SetTxFeeCmd) MarshalJSON() ([]byte, error) { Method: "settxfee", Id: cmd.id, Params: []interface{}{ - cmd.Amount, + float64(cmd.Amount) / 1e8, //convert to BTC }, } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 891ec0f3..dd9fd9dd 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -484,6 +484,193 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic gettxout", + f: func() (Cmd, error) { + return NewGetTxOutCmd(float64(1), + "sometx", + 10) + }, + result: &GetTxOutCmd{ + id: float64(1), + Txid: "sometx", + Output: 10, + }, + }, + { + name: "basic gettxout + optional", + f: func() (Cmd, error) { + return NewGetTxOutCmd(float64(1), + "sometx", + 10, + false) + }, + result: &GetTxOutCmd{ + id: float64(1), + Txid: "sometx", + Output: 10, + IncludeMempool: false, + }, + }, + { + name: "basic gettxsetoutinfo", + f: func() (Cmd, error) { + return NewGetTxOutSetInfoCmd(float64(1)) + }, + result: &GetTxOutSetInfoCmd{ + id: float64(1), + }, + }, + { + name: "basic getwork", + f: func() (Cmd, error) { + return NewGetWorkCmd(float64(1), + WorkRequest{ + Data: "some data", + Target: "our target", + Algorithm: "algo", + }) + }, + result: &GetWorkCmd{ + id: float64(1), + Request: WorkRequest{ + Data: "some data", + Target: "our target", + Algorithm: "algo", + }, + }, + }, + { + name: "basic help", + f: func() (Cmd, error) { + return NewHelpCmd(float64(1)) + }, + result: &HelpCmd{ + id: float64(1), + }, + }, + { + name: "basic help + optional cmd", + f: func() (Cmd, error) { + return NewHelpCmd(float64(1), + "getinfo") + }, + result: &HelpCmd{ + id: float64(1), + Command: "getinfo", + }, + }, + { + name: "basic importprivkey", + f: func() (Cmd, error) { + return NewImportPrivKeyCmd(float64(1), + "somereallongprivatekey") + }, + result: &ImportPrivKeyCmd{ + id: float64(1), + PrivKey: "somereallongprivatekey", + }, + }, + { + name: "basic importprivkey + opts", + f: func() (Cmd, error) { + return NewImportPrivKeyCmd(float64(1), + "somereallongprivatekey", + "some text", + false) + }, + result: &ImportPrivKeyCmd{ + id: float64(1), + PrivKey: "somereallongprivatekey", + Label: "some text", + ReScan: false, + }, + }, + { + name: "basic importwallet", + f: func() (Cmd, error) { + return NewImportWalletCmd(float64(1), + "walletfilename.dat") + }, + result: &ImportWalletCmd{ + id: float64(1), + Filename: "walletfilename.dat", + }, + }, + { + name: "basic keypoolrefill", + f: func() (Cmd, error) { + return NewKeyPoolRefillCmd(float64(1)) + }, + result: &KeyPoolRefillCmd{ + id: float64(1), + }, + }, + { + name: "basic listaccounts", + f: func() (Cmd, error) { + return NewListAccountsCmd(float64(1), 1) + }, + result: &ListAccountsCmd{ + id: float64(1), + MinConf: 1, + }, + }, + { + name: "basic listaddressgroupings", + f: func() (Cmd, error) { + return NewListAddressGroupingsCmd(float64(1)) + }, + result: &ListAddressGroupingsCmd{ + id: float64(1), + }, + }, + { + name: "basic lockunspent", + f: func() (Cmd, error) { + return NewLockUnspentCmd(float64(1), true) + }, + result: &LockUnspentCmd{ + id: float64(1), + Unlock: true, + }, + }, + { + name: "basic move", + f: func() (Cmd, error) { + return NewMoveCmd(float64(1), + "account1", + "account2", + 12, + 1) + }, + result: &MoveCmd{ + id: float64(1), + FromAccount: "account1", + ToAccount: "account2", + Amount: 12, + MinConf: 1, // the default + }, + }, + { + name: "basic move + optionals", + f: func() (Cmd, error) { + return NewMoveCmd(float64(1), + "account1", + "account2", + 12, + 1, + "some comment") + }, + result: &MoveCmd{ + id: float64(1), + FromAccount: "account1", + ToAccount: "account2", + Amount: 12, + MinConf: 1, // the default + Comment: "some comment", + }, + }, { name: "basic ping", f: func() (Cmd, error) { @@ -510,6 +697,27 @@ var jsoncmdtests = []struct { MinConf: 1, // the default }, }, + { + name: "basic sendfrom + options", + f: func() (Cmd, error) { + return NewSendFromCmd(float64(1), + "account", + "address", + 12, + 1, + "a comment", + "comment to") + }, + result: &SendFromCmd{ + id: float64(1), + FromAccount: "account", + ToAddress: "address", + Amount: 12, + MinConf: 1, // the default + Comment: "a comment", + CommentTo: "comment to", + }, + }, { name: "basic sendrawtransaction", f: func() (Cmd, error) { @@ -585,16 +793,16 @@ var jsoncmdtests = []struct { GenProcLimit: 10, }, }, - /* { + { name: "basic settxfee", f: func() (Cmd, error) { return NewSetTxFeeCmd(float64(1), 10) }, result: &SetTxFeeCmd{ id: float64(1), - Amount: 100000000, + Amount: 10, }, - },*/ + }, { name: "basic signrawtransaction", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index 5f467a83..1c0df6a9 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,31 +2,40 @@ github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -73,8 +82,14 @@ github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% ( github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) @@ -82,252 +97,136 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) +github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 74.12% (63/85) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) +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 ImportPrivKeyCmd.UnmarshalJSON 62.50% (15/24) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 60.00% (51/85) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 52.38% (11/21) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 50.00% (19/38) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 50.00% (3/6) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 42.31% (11/26) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 0.00% (0/36) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 0.00% (0/34) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 0.00% (0/24) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 0.00% (0/22) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 0.00% (0/19) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 0.00% (0/14) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) @@ -341,38 +240,139 @@ github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 47.88% (1240/2590) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 58.07% (1504/2590) From 3f33e419a9bc67da4a06d49a042fb85e2d8c873f Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 31 Oct 2013 09:31:32 -0400 Subject: [PATCH 058/229] Improve test coverage and fix bug found by tests. Spell receive the same way all the time so things work. --- jsoncmd.go | 6 +- jsoncmd_test.go | 90 ++++++++++++ test_coverage.txt | 354 +++++++++++++++++++++++----------------------- 3 files changed, 270 insertions(+), 180 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 8a64daff..d3d0650b 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2966,7 +2966,7 @@ func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { } // GetReceivedByAddressCmd is a type handling custom marshaling and -// unmarshaling of getrecievedbyaddress JSON RPC commands. +// unmarshaling of getreceivedbyaddress JSON RPC commands. type GetReceivedByAddressCmd struct { id interface{} Address string @@ -3013,7 +3013,7 @@ func (cmd *GetReceivedByAddressCmd) Id() interface{} { // Method satisfies the Cmd interface by returning the json method. func (cmd *GetReceivedByAddressCmd) Method() string { - return "getrecievedbyaddress" + return "getrecivedbyaddress" } // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. @@ -3021,7 +3021,7 @@ func (cmd *GetReceivedByAddressCmd) MarshalJSON() ([]byte, error) { raw := RawCmd{ Jsonrpc: "1.0", - Method: "getrecievedbyaddress", + Method: "getreceivedbyaddress", Id: cmd.id, Params: []interface{}{}, } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index dd9fd9dd..6c74198b 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -484,6 +484,96 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic getrawmchangeaddress", + f: func() (Cmd, error) { + return NewGetRawChangeAddressCmd(float64(1)) + }, + result: &GetRawChangeAddressCmd{ + id: float64(1), + }, + }, + { + name: "basic getrawmchangeaddress + account", + f: func() (Cmd, error) { + return NewGetRawChangeAddressCmd(float64(1), + "accountname") + }, + result: &GetRawChangeAddressCmd{ + id: float64(1), + Account: "accountname", + }, + }, + { + name: "basic getrawmempool", + f: func() (Cmd, error) { + return NewGetRawMempoolCmd(float64(1)) + }, + result: &GetRawMempoolCmd{ + id: float64(1), + }, + }, + { + name: "basic getrawtransaction", + f: func() (Cmd, error) { + return NewGetRawTransactionCmd(float64(1), + "sometxid") + }, + result: &GetRawTransactionCmd{ + id: float64(1), + Txid: "sometxid", + }, + }, + { + name: "basic getrawtransaction + verbose", + f: func() (Cmd, error) { + return NewGetRawTransactionCmd(float64(1), + "sometxid", + true) + }, + result: &GetRawTransactionCmd{ + id: float64(1), + Txid: "sometxid", + Verbose: true, + }, + }, + { + name: "basic getreceivedbyaccount", + f: func() (Cmd, error) { + return NewGetReceivedByAccountCmd(float64(1), + "abtcaccount", + 1) + }, + result: &GetReceivedByAccountCmd{ + id: float64(1), + Account: "abtcaccount", + MinConf: 1, + }, + }, + { + name: "basic getreceivedbyaddress", + f: func() (Cmd, error) { + return NewGetReceivedByAddressCmd(float64(1), + "abtcaddress", + 1) + }, + result: &GetReceivedByAddressCmd{ + id: float64(1), + Address: "abtcaddress", + MinConf: 1, + }, + }, + { + name: "basic gettransaction", + f: func() (Cmd, error) { + return NewGetTransactionCmd(float64(1), + "atxid") + }, + result: &GetTransactionCmd{ + id: float64(1), + Txid: "atxid", + }, + }, { name: "basic gettxout", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index 1c0df6a9..829afc04 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,36 +6,39 @@ github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -81,7 +84,10 @@ github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) @@ -97,34 +103,42 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 81.18% (69/85) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 74.12% (63/85) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) @@ -133,45 +147,49 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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 ImportPrivKeyCmd.UnmarshalJSON 62.50% (15/24) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) @@ -183,50 +201,137 @@ github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% ( github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 0.00% (0/19) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 0.00% (0/16) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) @@ -240,139 +345,34 @@ github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 58.07% (1504/2590) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 63.13% (1635/2590) From 815a0b0a84b3a6174c3086728f57f733beefc106 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 31 Oct 2013 16:37:14 -0400 Subject: [PATCH 059/229] Improve test coverage. --- jsoncmd_test.go | 35 +++++--- test_coverage.txt | 198 +++++++++++++++++++++++----------------------- 2 files changed, 123 insertions(+), 110 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 6c74198b..f8206c16 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -135,6 +135,17 @@ var jsoncmdtests = []struct { HexTx: "thisisahexidecimaltransaction", }, }, + { + name: "basic decodescript", + f: func() (Cmd, error) { + return NewDecodeScriptCmd(float64(1), + "a bunch of hex") + }, + result: &DecodeScriptCmd{ + id: float64(1), + HexScript: "a bunch of hex", + }, + }, { name: "basic dumpprivkey", f: func() (Cmd, error) { @@ -955,17 +966,19 @@ var jsoncmdtests = []struct { HexBlock: "lotsofhex", }, }, - // { - // name: "submitblock with optional object", - // f: func() (Cmd, error) { - // return NewSubmitBlockCmd(float64(1), - // "lotsofhex", "otherstuff") - // }, - // result: &SubmitBlockCmd{ - // id: float64(1), - // HexBlock: "lotsofhex", - // }, - // }, + { + name: "submitblock with optional object", + f: func() (Cmd, error) { + return NewSubmitBlockCmd(float64(1), + "lotsofhex", + &SubmitBlockOptions{WorkId: "otherstuff"}) + }, + result: &SubmitBlockCmd{ + id: float64(1), + HexBlock: "lotsofhex", + Options: &SubmitBlockOptions{WorkId: "otherstuff"}, + }, + }, { name: "basic validateaddress", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index 829afc04..39690465 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -3,42 +3,43 @@ github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) -github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -49,6 +50,8 @@ github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1 github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) @@ -103,40 +106,41 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 81.18% (69/85) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 82.35% (70/85) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) @@ -147,120 +151,115 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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 ImportPrivKeyCmd.UnmarshalJSON 62.50% (15/24) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 50.00% (3/6) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 42.31% (11/26) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 0.00% (0/13) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) @@ -273,8 +272,8 @@ github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) @@ -284,22 +283,22 @@ github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) @@ -307,31 +306,31 @@ github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1 github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) @@ -349,30 +348,31 @@ github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 63.13% (1635/2590) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 64.05% (1659/2590) From 56a62309ae43a6120c411a71a72247c83b6fe2ba Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Tue, 5 Nov 2013 22:35:06 +0000 Subject: [PATCH 060/229] Add some error messages to be used by btcd. ok jcv --- jsonerr.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jsonerr.go b/jsonerr.go index 4b8935c7..d0ec83ca 100644 --- a/jsonerr.go +++ b/jsonerr.go @@ -145,3 +145,15 @@ var ( Message: "Unable to decode hex string", } ) + +// Errors that are specific to btcd. +var ( + ErrNoWallet = Error{ + Code: -1, + Message: "This implementation does not implement wallet commands", + } + ErrUnimplemented = Error{ + Code: -1, + Message: "Command unimplemented", + } +) From d3dea375c6b2def201bb7070cb577bbeeb7ad6d6 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 12 Nov 2013 11:24:33 -0500 Subject: [PATCH 061/229] Fix SendManyCmd unmarshaling. This change fixes an incorrect parameter length check, as well as correcting the type assertions for the address to amount pairs. --- jsoncmd.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index d3d0650b..276ec907 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -5101,7 +5101,7 @@ func (cmd *SendManyCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) > 6 || len(r.Params) < 3 { + if len(r.Params) > 4 || len(r.Params) < 2 { return ErrWrongNumberOfParams } @@ -5110,15 +5110,19 @@ func (cmd *SendManyCmd) UnmarshalJSON(b []byte) error { return errors.New("first parameter fromaccount must be a string") } - famounts, ok := r.Params[1].(map[string]float64) + iamounts, ok := r.Params[1].(map[string]interface{}) if !ok { - return errors.New("second parameter toaccount must be a string to number map") + return errors.New("second parameter toaccount must be a JSON object") } amounts := make(map[string]int64) - for k, v := range famounts { + for k, v := range iamounts { + famount, ok := v.(float64) + if !ok { + return errors.New("second parameter toaccount must be a string to number map") + } var err error - amounts[k], err = JSONToAmount(v) + amounts[k], err = JSONToAmount(famount) if err != nil { return err } From f689789be8035e7cba003c3b8a7361882632e694 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 12 Nov 2013 12:36:57 -0500 Subject: [PATCH 062/229] Fix parameter for GetNewAddressCmd. The first parameter for a getnewaddress command is the account, not an address, so name it properly in the GetNewAddressCmd struct. --- jsoncmd.go | 12 ++++++------ jsoncmd_test.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 276ec907..be067c2e 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2476,7 +2476,7 @@ func (cmd *GetNetworkHashPSCmd) UnmarshalJSON(b []byte) error { // unmarshaling of getnewaddress JSON RPC commands. type GetNewAddressCmd struct { id interface{} - Address string + Account string } // Enforce that GetNewAddressCmd satisifies the Cmd interface. @@ -2484,17 +2484,17 @@ var _ Cmd = &GetNewAddressCmd{} // NewGetNewAddressCmd creates a new GetNewAddressCmd. func NewGetNewAddressCmd(id interface{}, optArgs ...string) (*GetNewAddressCmd, error) { - var address string + var account string if len(optArgs) > 0 { if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - address = optArgs[0] + account = optArgs[0] } return &GetNewAddressCmd{ id: id, - Address: address, + Account: account, }, nil } @@ -2518,8 +2518,8 @@ func (cmd *GetNewAddressCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{}, } - if cmd.Address != "" { - raw.Params = append(raw.Params, cmd.Address) + if cmd.Account != "" { + raw.Params = append(raw.Params, cmd.Account) } return json.Marshal(raw) } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index f8206c16..48d97a9a 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -479,11 +479,11 @@ var jsoncmdtests = []struct { { name: "basic getnewaddress", f: func() (Cmd, error) { - return NewGetNewAddressCmd(float64(1), "address") + return NewGetNewAddressCmd(float64(1), "account") }, result: &GetNewAddressCmd{ id: float64(1), - Address: "address", + Account: "account", }, }, { From d341468b872d76b16996ad8eac33dd821348fb39 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 5 Nov 2013 16:51:37 -0500 Subject: [PATCH 063/229] Add a test that was missed. --- jsoncmd_test.go | 13 +++ test_coverage.txt | 220 +++++++++++++++++++++++----------------------- 2 files changed, 123 insertions(+), 110 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 48d97a9a..8301710f 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -904,6 +904,19 @@ var jsoncmdtests = []struct { Amount: 10, }, }, + { + name: "basic signmessage", + f: func() (Cmd, error) { + return NewSignMessageCmd(float64(1), + "btcaddress", + "a message") + }, + result: &SignMessageCmd{ + id: float64(1), + Address: "btcaddress", + Message: "a message", + }, + }, { name: "basic signrawtransaction", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index 39690465..c3de240e 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -3,43 +3,44 @@ github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -99,6 +100,7 @@ github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1 github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) @@ -106,44 +108,44 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 83.53% (71/85) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 82.35% (70/85) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -151,50 +153,51 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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 ImportPrivKeyCmd.UnmarshalJSON 62.50% (15/24) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) @@ -204,31 +207,28 @@ github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% ( github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 0.00% (0/16) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) @@ -238,99 +238,98 @@ github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) @@ -348,31 +347,32 @@ github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 64.05% (1659/2590) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 64.63% (1674/2590) From 94e74e7cc732e8e7726908beda750866b17b04ae Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 7 Nov 2013 14:11:50 -0500 Subject: [PATCH 064/229] Increase test coverage for Cmd. --- jsoncmd.go | 2 +- jsoncmd_test.go | 41 ++++++ test_coverage.txt | 354 +++++++++++++++++++++++----------------------- 3 files changed, 219 insertions(+), 178 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index be067c2e..5e8d44b4 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4595,7 +4595,7 @@ func (cmd *LockUnspentCmd) UnmarshalJSON(b []byte) error { unlock, ok := r.Params[0].(bool) if !ok { - return errors.New("first parameter unlock must be a number") + return errors.New("first parameter unlock must be a bool") } optArgs := make([][]TransactionInput, 0, 1) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 8301710f..8d09fd83 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -726,6 +726,47 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic listlockunspent", + f: func() (Cmd, error) { + return NewListLockUnspentCmd(float64(1)) + }, + result: &ListLockUnspentCmd{ + id: float64(1), + }, + }, + { + name: "basic listreceivedbyaccount", + f: func() (Cmd, error) { + return NewListReceivedByAccountCmd(float64(1)) + }, + result: &ListReceivedByAccountCmd{ + id: float64(1), + MinConf: 1, + }, + }, + { + name: "basic listunspent", + f: func() (Cmd, error) { + return NewListUnspentCmd(float64(1)) + }, + result: &ListUnspentCmd{ + id: float64(1), + MinConf: 1, + MaxConf: 999999, + }, + }, + { + name: "basic listunspent + opts", + f: func() (Cmd, error) { + return NewListUnspentCmd(float64(1), 0, 6) + }, + result: &ListUnspentCmd{ + id: float64(1), + MinConf: 0, + MaxConf: 6, + }, + }, { name: "basic lockunspent", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index c3de240e..7fffc964 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -5,42 +5,44 @@ github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) @@ -97,6 +99,7 @@ github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) @@ -110,42 +113,44 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 83.53% (71/85) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.06% (74/85) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -153,226 +158,221 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 62.50% (15/24) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 47.62% (10/21) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 40.00% (6/15) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/33) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/36) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 0.00% (0/10) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 64.63% (1674/2590) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 66.99% (1737/2593) From d20f958c92e1444d83215c3cf98d6eef41898dcb Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Tue, 12 Nov 2013 01:41:33 +0000 Subject: [PATCH 065/229] Make parameters to VerifyChainCmd int32. One is a blockheight (int32 pretty much by protocol definition, it breaks at 1e8 in a long time) and the other is between 0 and 5. --- jsoncmd.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 5e8d44b4..006f61c2 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -6128,8 +6128,8 @@ func (cmd *ValidateAddressCmd) UnmarshalJSON(b []byte) error { // unmarshaling of verifychain JSON RPC commands. type VerifyChainCmd struct { id interface{} - CheckLevel int - CheckDepth int + CheckLevel int32 + CheckDepth int32 } // Enforce that VerifyChainCmd satisifies the Cmd interface. @@ -6137,10 +6137,10 @@ var _ Cmd = &VerifyChainCmd{} // NewVerifyChainCmd creates a new VerifyChainCmd. Optionally a // pointer to a TemplateRequest may be provided. -func NewVerifyChainCmd(id interface{}, optArgs ...int) (*VerifyChainCmd, error) { +func NewVerifyChainCmd(id interface{}, optArgs ...int32) (*VerifyChainCmd, error) { // bitcoind default, but they do vary it based on cli args. - var checklevel = 3 - var checkdepth = 288 + var checklevel int32 = 3 + var checkdepth int32 = 288 if len(optArgs) > 0 { if len(optArgs) > 2 { @@ -6204,14 +6204,14 @@ func (cmd *VerifyChainCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - optArgs := make([]int, 0, 2) + optArgs := make([]int32, 0, 2) if len(r.Params) > 0 { checklevel, ok := r.Params[0].(float64) if !ok { return errors.New("first optional parameter checklevel must be a number") } - optArgs = append(optArgs, int(checklevel)) + optArgs = append(optArgs, int32(checklevel)) } if len(r.Params) > 1 { @@ -6220,7 +6220,7 @@ func (cmd *VerifyChainCmd) UnmarshalJSON(b []byte) error { return errors.New("second optional parameter checkdepth must be a number") } - optArgs = append(optArgs, int(checkdepth)) + optArgs = append(optArgs, int32(checkdepth)) } newCmd, err := NewVerifyChainCmd(r.Id, optArgs...) From 9dbf75029f1e317fcc2702808d40cec929c4df2b Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 18 Nov 2013 09:13:02 -0500 Subject: [PATCH 066/229] ReScan -> Rescan --- jsoncmd.go | 10 +++++----- jsoncmd_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 006f61c2..0f91688d 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3510,7 +3510,7 @@ type ImportPrivKeyCmd struct { id interface{} PrivKey string Label string - ReScan bool + Rescan bool } // Enforce that ImportPrivKeyCmd satisifies the Cmd interface. @@ -3542,7 +3542,7 @@ func NewImportPrivKeyCmd(id interface{}, privkey string, optArgs ...interface{}) id: id, PrivKey: privkey, Label: label, - ReScan: rescan, + Rescan: rescan, }, nil } @@ -3567,12 +3567,12 @@ func (cmd *ImportPrivKeyCmd) MarshalJSON() ([]byte, error) { }, } - if cmd.Label != "" || cmd.ReScan { + if cmd.Label != "" || cmd.Rescan { raw.Params = append(raw.Params, cmd.Label) } - if cmd.ReScan { - raw.Params = append(raw.Params, cmd.ReScan) + if cmd.Rescan { + raw.Params = append(raw.Params, cmd.Rescan) } return json.Marshal(raw) } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 8d09fd83..c206a604 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -684,7 +684,7 @@ var jsoncmdtests = []struct { id: float64(1), PrivKey: "somereallongprivatekey", Label: "some text", - ReScan: false, + Rescan: false, }, }, { From 606262514b013203220f4ae409689448da7feceb Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 18 Nov 2013 13:23:05 -0500 Subject: [PATCH 067/229] Improve error messages. Attempt to determine if error when sending a command is due to auth issue and give more useful error in that case. --- jsonapi.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 5ab57f2c..13e6e889 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -7,6 +7,7 @@ package btcjson import ( "encoding/json" "fmt" + "strings" ) // Message contains a message to be sent to the bitcoin client. @@ -741,7 +742,11 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { var objmap map[string]json.RawMessage err = json.Unmarshal(message, &objmap) if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) + if strings.Contains(string(message), "401 Unauthorized.") { + err = fmt.Errorf("Authentication error.") + } else { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + } return result, err } // Take care of the parts that are the same for all replies. From e43c79c74dd0df962a3e165cd8174284dd3708e9 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Tue, 19 Nov 2013 00:09:56 +0000 Subject: [PATCH 068/229] add TlsRpcCommand and TlsRawRpcCommand. These act the same as the !tls versions of this code but they take a PEM encoded certificate chain to be used to verify certificates (ca verified certs could use /etc/ssl/certs.pem) and a parameter to skip cert verification and will use https internally. --- internal_test.go | 2 +- jsonapi.go | 37 +++++++++++++++++++++++++++++++++++-- jsonfxns.go | 22 ++++++++++++++++++++-- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/internal_test.go b/internal_test.go index 12b8ad01..e5eefd05 100644 --- a/internal_test.go +++ b/internal_test.go @@ -51,7 +51,7 @@ func TestJsonRpcSend(t *testing.T) { password := "something" server := "invalid" var message []byte - _, err := jsonRpcSend(user, password, server, message) + _, err := jsonRpcSend(user, password, server, message, false, nil, false) if err == nil { t.Errorf("Should fail when it cannot connect.") } diff --git a/jsonapi.go b/jsonapi.go index 13e6e889..9ecd5b01 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -872,16 +872,32 @@ func JSONGetMethod(message []byte) (string, error) { return method, err } +// TlsRpcCommand takes a message generated from one of the routines above +// along with the login/server information and any relavent PEM encoded +// certificates chains. It sends the command via https and returns a go struct +// with the result. +func TlsRpcCommand(user string, password string, server string, message []byte, + certificates []byte, skipverify bool) (Reply, error) { + return rpcCommand(user, password, server, message, true, certificates, + skipverify) +} + // RpcCommand takes a message generated from one of the routines above // along with the login/server info, sends it, and gets a reply, returning // a go struct with the result. func RpcCommand(user string, password string, server string, message []byte) (Reply, error) { + return rpcCommand(user, password, server, message, false, nil, false) +} + +func rpcCommand(user string, password string, server string, message []byte, + https bool, certificates []byte, skipverify bool) (Reply, error) { var result Reply method, err := JSONGetMethod(message) if err != nil { return result, err } - body, err := RpcRawCommand(user, password, server, message) + body, err := rpcRawCommand(user, password, server, message, https, + certificates, skipverify) if err != nil { err := fmt.Errorf("Error getting json reply: %v", err) return result, err @@ -894,10 +910,26 @@ func RpcCommand(user string, password string, server string, message []byte) (Re return result, err } +// TlsRpcRawCommand takes a message generated from one of the routines above +// along with the login,server info and PEM encoded certificate chains for the +// server sends it, and gets a reply, returning +// the raw []byte response for use with ReadResultCmd. +func TlsRpcRawCommand(user string, password string, server string, + message []byte, certificates []byte, skipverify bool) ([]byte, error) { + return rpcRawCommand(user, password, server, message, true, + certificates, skipverify) +} + // RpcRawCommand takes a message generated from one of the routines above // along with the login/server info, sends it, and gets a reply, returning // the raw []byte response for use with ReadResultCmd. func RpcRawCommand(user string, password string, server string, message []byte) ([]byte, error) { + return rpcRawCommand(user, password, server, message, false, nil, false) +} + +// rpcRawCommand is a helper function for the above two functions. +func rpcRawCommand(user string, password string, server string, + message []byte, https bool, certificates []byte, skipverify bool) ([]byte, error) { var result []byte var msg interface{} err := json.Unmarshal(message, &msg) @@ -905,7 +937,8 @@ func RpcRawCommand(user string, password string, server string, message []byte) err := fmt.Errorf("Error, message does not appear to be valid json: %v", err) return result, err } - resp, err := jsonRpcSend(user, password, server, message) + resp, err := jsonRpcSend(user, password, server, message, https, + certificates, skipverify) if err != nil { err := fmt.Errorf("Error sending json message: " + err.Error()) return result, err diff --git a/jsonfxns.go b/jsonfxns.go index cc323879..f4479cf8 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -6,6 +6,9 @@ package btcjson import ( "bytes" + _ "crypto/sha512" + "crypto/tls" + "crypto/x509" "encoding/json" "fmt" "io" @@ -32,9 +35,24 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { // and ip/port and then send the supplied message. This uses net/http rather // than net/rpc/jsonrpc since that one doesn't support http connections and is // therefore useless. -func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) { +func jsonRpcSend(user string, password string, server string, message []byte, + https bool, certificates []byte, skipverify bool) (*http.Response, error) { + client := &http.Client{} + protocol := "http" + if https { + pool := x509.NewCertPool() + pool.AppendCertsFromPEM(certificates) + + config := &tls.Config{ + InsecureSkipVerify: skipverify, + RootCAs: pool, + } + transport := &http.Transport{TLSClientConfig: config} + client.Transport = transport + protocol = "https" + } credentials := user + ":" + password - resp, err := http.Post("http://"+credentials+"@"+server, + resp, err := client.Post(protocol+"://"+credentials+"@"+server, "application/json", bytes.NewBuffer(message)) if err != nil { // We do not want to log the username/password in the errors. From 8d9b8fcf82500c0d6332025321ebf5229e1705e8 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 19 Nov 2013 15:26:47 -0500 Subject: [PATCH 069/229] Make importprivkey rescan optarg default to true. --- jsoncmd.go | 6 +++--- jsoncmd_test.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 0f91688d..1bb85c45 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3520,7 +3520,7 @@ var _ Cmd = &ImportPrivKeyCmd{} // pointer to a TemplateRequest may be provided. func NewImportPrivKeyCmd(id interface{}, privkey string, optArgs ...interface{}) (*ImportPrivKeyCmd, error) { var label string - var rescan bool + rescan := true var ok bool if len(optArgs) > 2 { @@ -3567,11 +3567,11 @@ func (cmd *ImportPrivKeyCmd) MarshalJSON() ([]byte, error) { }, } - if cmd.Label != "" || cmd.Rescan { + if cmd.Label != "" || !cmd.Rescan { raw.Params = append(raw.Params, cmd.Label) } - if cmd.Rescan { + if !cmd.Rescan { raw.Params = append(raw.Params, cmd.Rescan) } return json.Marshal(raw) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index c206a604..f5465c33 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -670,6 +670,7 @@ var jsoncmdtests = []struct { result: &ImportPrivKeyCmd{ id: float64(1), PrivKey: "somereallongprivatekey", + Rescan: true, }, }, { From fa2bf4423e889807878e5c9f2b43a15feec230b1 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 20 Nov 2013 11:08:20 -0500 Subject: [PATCH 070/229] Add additional tests for importprivkey. --- jsoncmd.go | 2 +- jsoncmd_test.go | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 1bb85c45..2119663a 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3586,7 +3586,7 @@ func (cmd *ImportPrivKeyCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) > 3 { + if len(r.Params) == 0 || len(r.Params) > 3 { return ErrWrongNumberOfParams } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index f5465c33..09656208 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -674,7 +674,21 @@ var jsoncmdtests = []struct { }, }, { - name: "basic importprivkey + opts", + name: "basic importprivkey + 1 opt", + f: func() (Cmd, error) { + return NewImportPrivKeyCmd(float64(1), + "somereallongprivatekey", + "some text") + }, + result: &ImportPrivKeyCmd{ + id: float64(1), + PrivKey: "somereallongprivatekey", + Label: "some text", + Rescan: true, + }, + }, + { + name: "basic importprivkey + 2 opts", f: func() (Cmd, error) { return NewImportPrivKeyCmd(float64(1), "somereallongprivatekey", From 7397dd68964bc8e7e5dd502f9969d6dfdc367dc6 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 22 Nov 2013 08:48:02 -0500 Subject: [PATCH 071/229] Rename reqSig to reqSigs Match bitcoin json name better. Closes #9 --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 9ecd5b01..0429493d 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -106,7 +106,7 @@ type Vout struct { ScriptPubKey struct { Asm string `json:"asm"` Hex string `json:"hex"` - ReqSig int `json:"reqSig"` + ReqSigs int `json:"reqSigs"` Type string `json:"type"` Addresses []string `json:"addresses"` } `json:"scriptPubKey"` From a645c36f4558fc0316d9af00d89fc8b787a48170 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 22 Nov 2013 10:01:41 -0600 Subject: [PATCH 072/229] Add new extension command named debuglevel. ok @jcvernaleo. --- jsoncmd.go | 72 +++++++++ jsoncmd_test.go | 10 ++ test_coverage.txt | 387 ++++++++++++++++++++++++---------------------- 3 files changed, 280 insertions(+), 189 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 2119663a..3fa7d3eb 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -81,6 +81,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "createrawtransaction": cmd = new(CreateRawTransactionCmd) + case "debuglevel": + cmd = new(DebugLevelCmd) + case "decoderawtransaction": cmd = new(DecodeRawTransactionCmd) @@ -828,6 +831,75 @@ func (cmd *CreateRawTransactionCmd) UnmarshalJSON(b []byte) error { return nil } +// DebugLevelCmd is a type handling custom marshaling and unmarshaling of +// debuglevel JSON RPC commands. This command is not a standard Bitcoin +// command. It is an extension for btcd. +type DebugLevelCmd struct { + id interface{} + LevelSpec string +} + +// Enforce that DebugLevelCmd satisifies the Cmd interface. +var _ Cmd = &DebugLevelCmd{} + +// NewDebugLevelCmd creates a new DebugLevelCmd. This command is not a standard +// Bitcoin command. It is an extension for btcd. +func NewDebugLevelCmd(id interface{}, levelSpec string) (*DebugLevelCmd, error) { + return &DebugLevelCmd{ + id: id, + LevelSpec: levelSpec, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *DebugLevelCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *DebugLevelCmd) Method() string { + return "debuglevel" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *DebugLevelCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + return json.Marshal(RawCmd{ + Jsonrpc: "1.0", + Method: cmd.Method(), + Id: cmd.id, + Params: []interface{}{ + cmd.LevelSpec, + }, + }) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *DebugLevelCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + levelSpec, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter levelspec must be a string") + } + + newCmd, err := NewDebugLevelCmd(r.Id, levelSpec) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // DecodeRawTransactionCmd is a type handling custom marshaling and // unmarshaling of decoderawtransaction JSON RPC commands. type DecodeRawTransactionCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 09656208..5f59ce2f 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -124,6 +124,16 @@ var jsoncmdtests = []struct { }, }, }, + { + name: "basic debuglevel", + f: func() (Cmd, error) { + return NewDebugLevelCmd(float64(1), "debug") + }, + result: &DebugLevelCmd{ + id: float64(1), + LevelSpec: "debug", + }, + }, { name: "basic decoderawtransaction", f: func() (Cmd, error) { diff --git a/test_coverage.txt b/test_coverage.txt index 7fffc964..4fab3663 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,72 +1,90 @@ -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 100.00% (63/63) github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) @@ -75,82 +93,68 @@ github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 98.46% (64/65) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.06% (74/85) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.21% (75/86) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -158,57 +162,58 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) -github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) +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 ImportPrivKeyCmd.UnmarshalJSON 62.50% (15/24) +github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) -github.com/conformal/btcjson/jsonapi.go RpcCommand 61.54% (8/13) +github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 53.33% (8/15) +github.com/conformal/btcjson/jsonapi.go rpcRawCommand 53.33% (8/15) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 47.62% (10/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 40.00% (6/15) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) @@ -216,163 +221,167 @@ github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% ( github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/36) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 66.99% (1737/2593) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 66.98% (1759/2626) From 79fe2e594b5ddadab411841d1db38ab8b3355762 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 22 Nov 2013 12:22:07 -0500 Subject: [PATCH 073/229] Fix a typo. --- jsoncmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index 3fa7d3eb..fd7b9e02 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1169,7 +1169,7 @@ func (cmd *DumpWalletCmd) UnmarshalJSON(b []byte) error { } // EncryptWalletCmd is a type handling custom marshaling and -// unmarshaling of ecryptwallet JSON RPC commands. +// unmarshaling of encryptwallet JSON RPC commands. type EncryptWalletCmd struct { id interface{} Passphrase string From 368d6c0779cc64add2e366862248c808ca0d34b4 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 26 Nov 2013 16:08:31 -0500 Subject: [PATCH 074/229] Fix optarg handling for listtransactions and add tests. --- jsoncmd.go | 4 ++-- jsoncmd_test.go | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index fd7b9e02..2d221345 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4391,7 +4391,7 @@ func NewListTransactionsCmd(id interface{}, optArgs ...interface{}) (*ListTransa account = ac } if len(optArgs) > 1 { - cnt, ok := optArgs[0].(int) + cnt, ok := optArgs[1].(int) if !ok { return nil, errors.New("second optional argument count is not an int") } @@ -4399,7 +4399,7 @@ func NewListTransactionsCmd(id interface{}, optArgs ...interface{}) (*ListTransa count = cnt } if len(optArgs) > 2 { - frm, ok := optArgs[0].(int) + frm, ok := optArgs[2].(int) if !ok { return nil, errors.New("third optional argument from is not an int") } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 5f59ce2f..6c2951c1 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -770,6 +770,54 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic listtransactions", + f: func() (Cmd, error) { + return NewListTransactionsCmd(float64(1)) + }, + result: &ListTransactionsCmd{ + id: float64(1), + Account: "", + Count: 10, + From: 0, + }, + }, + { + name: "listtransactions 1 optarg", + f: func() (Cmd, error) { + return NewListTransactionsCmd(float64(1), "abcde") + }, + result: &ListTransactionsCmd{ + id: float64(1), + Account: "abcde", + Count: 10, + From: 0, + }, + }, + { + name: "listtransactions 2 optargs", + f: func() (Cmd, error) { + return NewListTransactionsCmd(float64(1), "abcde", 123) + }, + result: &ListTransactionsCmd{ + id: float64(1), + Account: "abcde", + Count: 123, + From: 0, + }, + }, + { + name: "listtransactions 3 optargs", + f: func() (Cmd, error) { + return NewListTransactionsCmd(float64(1), "abcde", 123, 456) + }, + result: &ListTransactionsCmd{ + id: float64(1), + Account: "abcde", + Count: 123, + From: 456, + }, + }, { name: "basic listunspent", f: func() (Cmd, error) { From 97a4ab6a4724ad531a56d1582c23752e4bfda0c3 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 26 Nov 2013 16:12:54 -0500 Subject: [PATCH 075/229] Update test coverage file. --- test_coverage.txt | 308 +++++++++++++++++++++++----------------------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index 4fab3663..cd19497c 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,54 +1,90 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) @@ -56,105 +92,72 @@ github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% ( github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 98.46% (64/65) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.21% (75/86) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.37% (76/86) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -180,36 +183,36 @@ github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00 github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) @@ -220,37 +223,37 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21 github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/36) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 0.00% (0/26) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 0.00% (0/8) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) @@ -322,66 +325,63 @@ github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 66.98% (1759/2626) +github.com/conformal/btcjson --------------------------------------- 68.74% (1805/2626) From 708dce8d99dd3a8d3586d29487d8da6f757b4e6b Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 27 Nov 2013 19:27:46 -0500 Subject: [PATCH 076/229] Fix sendmany optarg parsing and add tests. --- jsoncmd.go | 2 +- jsoncmd_test.go | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index 2d221345..30e1df9c 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -5110,7 +5110,7 @@ func NewSendManyCmd(id interface{}, fromaccount string, amounts map[string]int64 minconf = m } if len(optArgs) > 1 { - c, ok := optArgs[0].(string) + c, ok := optArgs[1].(string) if !ok { return nil, errors.New("second optional parameter comment is not a string") } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 6c2951c1..9fb011e2 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -933,6 +933,55 @@ var jsoncmdtests = []struct { CommentTo: "comment to", }, }, + { + name: "basic sendmany", + f: func() (Cmd, error) { + pairs := map[string]int64{ + "address A": 1000, + "address B": 2000, + "address C": 3000, + } + return NewSendManyCmd(float64(1), + "account", + pairs) + }, + result: &SendManyCmd{ + id: float64(1), + FromAccount: "account", + Amounts: map[string]int64{ + "address A": 1000, + "address B": 2000, + "address C": 3000, + }, + MinConf: 1, // the default + }, + }, + { + name: "sendmany + options", + f: func() (Cmd, error) { + pairs := map[string]int64{ + "address A": 1000, + "address B": 2000, + "address C": 3000, + } + return NewSendManyCmd(float64(1), + "account", + pairs, + 10, + "comment") + }, + result: &SendManyCmd{ + id: float64(1), + FromAccount: "account", + Amounts: map[string]int64{ + "address A": 1000, + "address B": 2000, + "address C": 3000, + }, + MinConf: 10, + Comment: "comment", + }, + }, { name: "basic sendrawtransaction", f: func() (Cmd, error) { From 6325bd9df2a871ac3bbccad8b8739cc8eaa2c205 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 27 Nov 2013 19:30:13 -0500 Subject: [PATCH 077/229] Update test coverage file. --- test_coverage.txt | 360 +++++++++++++++++++++++----------------------- 1 file changed, 180 insertions(+), 180 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index cd19497c..4faa9e83 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,90 +1,58 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) @@ -92,69 +60,104 @@ github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% ( github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 98.46% (64/65) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.53% (77/86) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.37% (76/86) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) @@ -183,28 +186,28 @@ github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00 github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) @@ -222,166 +225,163 @@ github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 40.00% (6 github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 0.00% (0/36) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 0.00% (0/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 68.74% (1805/2626) +github.com/conformal/btcjson --------------------------------------- 70.60% (1854/2626) From 91a19dda8544d4756b03abd42a3b4a044d44f598 Mon Sep 17 00:00:00 2001 From: Francis Lam Date: Sun, 8 Dec 2013 14:51:18 -0500 Subject: [PATCH 078/229] Fixed TxRawResult/Vin structure and added GetBlockCmd verbose flags Changed TxRawResult to omitempty block info for mempool tx as well as moved Txid to Vin.TxId from Vin.ScriptSig.Txid (both match bitcoind output) Added support for new bitcoind [verbose=true] and added non-standard optional verboseTx to return TxRawResults intead Txids --- jsonapi.go | 42 ++++++++++++++++--------------- jsoncmd.go | 73 +++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 86 insertions(+), 29 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 0429493d..a5c0c594 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -47,19 +47,21 @@ type InfoResult struct { // BlockResult models the data from the getblock command. type BlockResult struct { - Hash string `json:"hash"` - Confirmations uint64 `json:"confirmations"` - Size int `json:"size"` - Height int64 `json:"height"` - Version uint32 `json:"version"` - MerkleRoot string `json:"merkleroot"` - Tx []string `json:"tx"` - Time int64 `json:"time"` - Nonce uint32 `json:"nonce"` - Bits string `json:"bits"` - Difficulty float64 `json:"difficulty"` - PreviousHash string `json:"previousblockhash"` - NextHash string `json:"nextblockhash"` + Hex string `json:"hex,omitempty"` + Hash string `json:"hash"` + Confirmations uint64 `json:"confirmations"` + Size int `json:"size"` + Height int64 `json:"height"` + Version uint32 `json:"version"` + MerkleRoot string `json:"merkleroot"` + Tx []string `json:"tx,omitempty"` + RawTx []TxRawResult `json:"rawtx,omitempty"` + Time int64 `json:"time"` + Nonce uint32 `json:"nonce"` + Bits string `json:"bits"` + Difficulty float64 `json:"difficulty"` + PreviousHash string `json:"previousblockhash"` + NextHash string `json:"nextblockhash"` } // TxRawResult models the data from the getrawtransaction command. @@ -70,10 +72,10 @@ type TxRawResult struct { LockTime uint32 `json:"locktime"` Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` - BlockHash string `json:"blockhash"` - Confirmations uint64 `json:"confirmations"` - Time int64 `json:"time"` - Blocktime int64 `json:"blocktime"` + BlockHash string `json:"blockhash,omitempty"` + Confirmations uint64 `json:"confirmations,omitempty"` + Time int64 `json:"time,omitempty"` + Blocktime int64 `json:"blocktime,omitempty"` } // TxRawDecodeResult models the data from the decoderawtransaction command. @@ -89,11 +91,11 @@ type TxRawDecodeResult struct { // getrawtransaction and decoderawtransaction use the same structure. type Vin struct { Coinbase string `json:"coinbase,omitempty"` + Txid string `json:"txid,omitempty"` Vout int `json:"vout,omitempty"` ScriptSig struct { - Txid string `json:"txid"` - Asm string `json:"asm"` - Hex string `json:"hex"` + Asm string `json:"asm"` + Hex string `json:"hex"` } `json:"scriptSig,omitempty"` Sequence float64 `json:"sequence"` } diff --git a/jsoncmd.go b/jsoncmd.go index 30e1df9c..b0968f28 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1705,18 +1705,40 @@ func (cmd *GetBestBlockHashCmd) UnmarshalJSON(b []byte) error { // GetBlockCmd is a type handling custom marshaling and // unmarshaling of getblock JSON RPC commands. type GetBlockCmd struct { - id interface{} - Hash string + id interface{} + Hash string + Verbose bool + VerboseTx bool } // Enforce that GetBlockCmd satisifies the Cmd interface. var _ Cmd = &GetBlockCmd{} // NewGetBlockCmd creates a new GetBlockCmd. -func NewGetBlockCmd(id interface{}, hash string) (*GetBlockCmd, error) { +func NewGetBlockCmd(id interface{}, hash string, optArgs ...bool) (*GetBlockCmd, error) { + // default verbose is set to true to match old behavior + verbose, verboseTx := true, false + + optArgsLen := len(optArgs) + if optArgsLen > 0 { + if optArgsLen > 2 { + return nil, ErrTooManyOptArgs + } + verbose = optArgs[0] + if optArgsLen > 1 { + verboseTx = optArgs[1] + + if !verbose && verboseTx { + return nil, ErrInvalidParams + } + } + } + return &GetBlockCmd{ - id: id, - Hash: hash, + id: id, + Hash: hash, + Verbose: verbose, + VerboseTx: verboseTx, }, nil } @@ -1734,14 +1756,28 @@ func (cmd *GetBlockCmd) Method() string { func (cmd *GetBlockCmd) MarshalJSON() ([]byte, error) { // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ + raw := RawCmd{ Jsonrpc: "1.0", Method: "getblock", Id: cmd.id, Params: []interface{}{ cmd.Hash, }, - }) + } + + if !cmd.Verbose { + // set optional verbose argument to false + raw.Params = append(raw.Params, false) + } else { + if cmd.VerboseTx { + // set optional verbose argument to true + raw.Params = append(raw.Params, true) + // set optional verboseTx argument to true + raw.Params = append(raw.Params, true) + } + } + + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1753,15 +1789,34 @@ func (cmd *GetBlockCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) != 1 { + if len(r.Params) > 3 || len(r.Params) < 1 { return ErrWrongNumberOfParams } + hash, ok := r.Params[0].(string) if !ok { return errors.New("first parameter hash must be a string") } - newCmd, err := NewGetBlockCmd(r.Id, hash) + optArgs := make([]bool, 0, 1) + if len(r.Params) > 1 { + verbose, ok := r.Params[1].(bool) + if !ok { + return errors.New("second optional parameter verbose must be a bool") + } + + optArgs = append(optArgs, verbose) + } + if len(r.Params) == 3 { + verboseTx, ok := r.Params[2].(bool) + if !ok { + return errors.New("third optional parameter verboseTx must be a bool") + } + + optArgs = append(optArgs, verboseTx) + } + + newCmd, err := NewGetBlockCmd(r.Id, hash, optArgs...) if err != nil { return err } From 8a132ffde8917b291cf62b4ebd8473667cb8f042 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 10 Dec 2013 16:30:47 -0600 Subject: [PATCH 079/229] Add support for TravisCI. Also add TravisCI build status badge to README.md. --- .travis.yml | 3 +++ README.md | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..ae71c02f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: go +go: release +install: go get -d -t -v ./... diff --git a/README.md b/README.md index 88a574dd..daccfd15 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ btcjson ======= +[![Build Status](https://travis-ci.org/conformal/btcjson.png?branch=master)] +(https://travis-ci.org/conformal/btcjson) + Package btcjson implements the bitcoin JSON-RPC API. There is a test suite which is aiming to reach 100% code coverage. See `test_coverage.txt` for the current coverage (using gocov). On a From 621f9006bfae62e7a5f01a30ca53c44ff4a74134 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 10 Dec 2013 17:13:42 -0600 Subject: [PATCH 080/229] Correct tests for recent getblock updates. --- jsoncmd_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 9fb011e2..a3410714 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -312,8 +312,9 @@ var jsoncmdtests = []struct { "somehash") }, result: &GetBlockCmd{ - id: float64(1), - Hash: "somehash", + id: float64(1), + Hash: "somehash", + Verbose: true, }, }, { From 4d0cbb776bc783779a8895de369afc81a0f207e6 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 11 Dec 2013 13:42:29 -0500 Subject: [PATCH 081/229] Make id omitemtpy to match spec better. --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index a5c0c594..d56c531c 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -13,7 +13,7 @@ import ( // Message contains a message to be sent to the bitcoin client. type Message struct { Jsonrpc string `json:"jsonrpc"` - Id interface{} `json:"id"` + Id interface{} `json:"id,omitempty"` Method string `json:"method"` Params interface{} `json:"params"` } From 1f52db626dd6b1df6103c6b11cf6e73b72cbe536 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 11 Dec 2013 13:43:18 -0500 Subject: [PATCH 082/229] Update test coverage. --- test_coverage.txt | 244 +++++++++++++++++++++++----------------------- 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index 4faa9e83..0eeaf008 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -5,50 +5,50 @@ github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) @@ -71,6 +71,7 @@ github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) @@ -80,87 +81,84 @@ github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 98.46% (64/65) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.53% (77/86) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -186,28 +184,27 @@ github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00 github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) @@ -218,59 +215,40 @@ github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) 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/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 47.62% (10/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 40.00% (6/15) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) @@ -279,109 +257,131 @@ github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1 github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 70.60% (1854/2626) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 70.22% (1863/2653) From 4cb318ac025dc2e9b859f453fc2bc9984bd71d19 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 11 Dec 2013 08:44:26 +0000 Subject: [PATCH 083/229] Handle optional verbose parameter to getrawmempool. This does remove the `nicer' type handle for getrawmempool for now since it is no longer so simple. ok jcv. --- jsonapi.go | 2 +- jsonapi_test.go | 2 -- jsoncmd.go | 37 ++++++++++++++++++++++++++++++------- jsoncmd_test.go | 19 +++++++++++++++++++ 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index d56c531c..e64bd7f6 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -793,7 +793,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } - case "getaddressesbyaccount", "getrawmempool": + case "getaddressesbyaccount": var res []string err = json.Unmarshal(objmap["result"], &res) if err == nil { diff --git a/jsonapi_test.go b/jsonapi_test.go index dc35de58..319b78e2 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -346,8 +346,6 @@ 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}, - {"getrawmempool", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"getrawmempool", []byte(`{"error":null,"id":1,"result":["test"]}`), 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}, diff --git a/jsoncmd.go b/jsoncmd.go index b0968f28..2dd3cf0f 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2831,15 +2831,24 @@ func (cmd *GetRawChangeAddressCmd) UnmarshalJSON(b []byte) error { // unmarshaling of getrawmempool JSON RPC commands. type GetRawMempoolCmd struct { id interface{} + Verbose bool } // Enforce that GetRawMempoolCmd satisifies the Cmd interface. var _ Cmd = &GetRawMempoolCmd{} // NewGetRawMempoolCmd creates a new GetRawMempoolCmd. -func NewGetRawMempoolCmd(id interface{}) (*GetRawMempoolCmd, error) { +func NewGetRawMempoolCmd(id interface{}, optArgs ...bool) (*GetRawMempoolCmd, error) { + verbose := false + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + verbose = optArgs[0] + } return &GetRawMempoolCmd{ id: id, + Verbose: verbose, }, nil } @@ -2855,14 +2864,18 @@ func (cmd *GetRawMempoolCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetRawMempoolCmd) MarshalJSON() ([]byte, error) { - - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ + raw := RawCmd{ Jsonrpc: "1.0", Method: "getrawmempool", Id: cmd.id, Params: []interface{}{}, - }) + } + + if cmd.Verbose { + raw.Params = append(raw.Params, cmd.Verbose) + } + + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2874,11 +2887,21 @@ func (cmd *GetRawMempoolCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) != 0 { + if len(r.Params) > 1 { return ErrWrongNumberOfParams } - newCmd, err := NewGetRawMempoolCmd(r.Id) + optArgs := make([]bool, 0, 1) + if len(r.Params) == 1 { + verbose, ok := r.Params[0].(bool) + if !ok { + return errors.New("first optional parameter verbose must be a bool") + } + + optArgs = append(optArgs, verbose) + } + + newCmd, err := NewGetRawMempoolCmd(r.Id, optArgs...) if err != nil { return err } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index a3410714..2c20e4b7 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -535,6 +535,25 @@ var jsoncmdtests = []struct { id: float64(1), }, }, + { + name: "basic getrawmempool noverbose", + f: func() (Cmd, error) { + return NewGetRawMempoolCmd(float64(1), false) + }, + result: &GetRawMempoolCmd{ + id: float64(1), + }, + }, + { + name: "basic getrawmempool verbose", + f: func() (Cmd, error) { + return NewGetRawMempoolCmd(float64(1), true) + }, + result: &GetRawMempoolCmd{ + id: float64(1), + Verbose: true, + }, + }, { name: "basic getrawtransaction", f: func() (Cmd, error) { From e0e4c8bdb67b20a0d99bdfe29984937d4e1fab52 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 26 Dec 2013 10:16:23 -0600 Subject: [PATCH 084/229] Allow getblock result to be string or BlockResult. The getblock command has recently added a verbose flag which alters the output. The previous code added a new field "Hex" to the BlockResult, but this is not consistent with the origin getblock RPC call which returns a string when verbose is false and the BlockResult JSON object when it is true. This commit corrects that by first removing the Hex field from the BlockResult and second allowing the result for getblock to be either form. --- jsonapi.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index e64bd7f6..d32c454d 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -45,9 +45,10 @@ type InfoResult struct { Errors string `json:"errors,omitempty"` } -// BlockResult models the data from the getblock command. +// BlockResult models the data from the getblock command when the verbose flag +// is set. When the verbose flag is not set, getblock return a hex-encoded +// string. type BlockResult struct { - Hex string `json:"hex,omitempty"` Hash string `json:"hash"` Confirmations uint64 `json:"confirmations"` Size int `json:"size"` @@ -776,10 +777,21 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } case "getblock": - var res BlockResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res + // getblock can either return a JSON object or a hex-encoded + // string depending on the verbose flag. Choose the right form + // accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res BlockResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } } case "getrawtransaction": var res TxRawResult From 1855c19562490e95a92ac74e90fe899ef30cd2ad Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 26 Dec 2013 21:25:40 -0600 Subject: [PATCH 085/229] Allow getrawtransaction result to be string. The getrawtransaction command has recently added a verbose flag which alters the output. The previous code made use of the "Hex" field of the TxRawResult to return the information, but this is not consistent with the original getrawtransaction RPC call which returns a string when verbose is false and the TxRawResult JSON object when it is true. This commit corrects that by allowing the result for getrawtransaction to be either form. --- jsonapi.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index d32c454d..62a1da51 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -794,10 +794,21 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } case "getrawtransaction": - var res TxRawResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res + // getrawtransaction can either return a JSON object or a + // hex-encoded string depending on the verbose flag. Choose the + // right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res TxRawResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } } case "decoderawtransaction": var res TxRawDecodeResult From 509bf830b103c4de6537fa9e9f05115145c78611 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 27 Dec 2013 11:27:52 -0600 Subject: [PATCH 086/229] Correct Vin ScriptSig to properly omit when empty. In order for a field which is a struct to be omitted from JSON marshal/unmarshal, it must be a pointer so the json package can tell when it's empty (when it's nil). --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 62a1da51..b850c151 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -94,7 +94,7 @@ type Vin struct { Coinbase string `json:"coinbase,omitempty"` Txid string `json:"txid,omitempty"` Vout int `json:"vout,omitempty"` - ScriptSig struct { + ScriptSig *struct { Asm string `json:"asm"` Hex string `json:"hex"` } `json:"scriptSig,omitempty"` From d3b76da91993c226e9e05c3a63d455a2997c0006 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 27 Dec 2013 12:20:31 -0600 Subject: [PATCH 087/229] Make ScriptSig anonymous struct an exported type. The previous commit modified the Vin ScriptSig field to be a pointer to an anonymous struct so it could be properly omitted. However, the callers need to be able to create a new object to assign to the field, so this commit makes the previous anonymous struct an exported type named ScriptSig. --- jsonapi.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index b850c151..a88304c6 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -88,17 +88,22 @@ type TxRawDecodeResult struct { Vout []Vout `json:"vout"` } +// ScriptSig models a signature script. It is defined seperately since it only +// applies to non-coinbase. Therefore the field in the Vin structure needs +// to be a pointer. +type ScriptSig struct { + Asm string `json:"asm"` + Hex string `json:"hex"` +} + // Vin models parts of the tx data. It is defined seperately since both // getrawtransaction and decoderawtransaction use the same structure. type Vin struct { - Coinbase string `json:"coinbase,omitempty"` - Txid string `json:"txid,omitempty"` - Vout int `json:"vout,omitempty"` - ScriptSig *struct { - Asm string `json:"asm"` - Hex string `json:"hex"` - } `json:"scriptSig,omitempty"` - Sequence float64 `json:"sequence"` + Coinbase string `json:"coinbase,omitempty"` + Txid string `json:"txid,omitempty"` + Vout int `json:"vout,omitempty"` + ScriptSig *ScriptSig `json:"scriptSig,omitempty"` + Sequence float64 `json:"sequence"` } // Vout models parts of the tx data. It is defined seperately since both From 11d39125dee8da4551814129d304bfcf6a971c16 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 27 Dec 2013 12:38:11 -0600 Subject: [PATCH 088/229] The sequence num of a tx input is a uint32. --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index a88304c6..41b2fb9b 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -103,7 +103,7 @@ type Vin struct { Txid string `json:"txid,omitempty"` Vout int `json:"vout,omitempty"` ScriptSig *ScriptSig `json:"scriptSig,omitempty"` - Sequence float64 `json:"sequence"` + Sequence uint32 `json:"sequence"` } // Vout models parts of the tx data. It is defined seperately since both From c0236b5a2fdaadd28fa2589e9f44e60d01724de0 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 30 Dec 2013 18:42:21 -0600 Subject: [PATCH 089/229] Change LockTime in TxRawDecodeResult to uint32. --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 41b2fb9b..3d9b0730 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -83,7 +83,7 @@ type TxRawResult struct { type TxRawDecodeResult struct { Txid string `json:"txid"` Version uint32 `json:"version"` - Locktime int `json:"locktime"` + Locktime uint32 `json:"locktime"` Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` } From 5d91e16e7c71b36d595a6d6a582e29fd3fcfacef Mon Sep 17 00:00:00 2001 From: Francis Lam Date: Mon, 30 Dec 2013 20:00:54 -0500 Subject: [PATCH 090/229] Added MarshalJSON to Vin and changed Vout.ScriptPubKey Added MarshalJSON method to Vin which properly omits the Vout field from coinbase Vin's by using anonymous structs with the proper subsets of fields outputted by bitcoind Changed Vout.ScriptPubKey to add omitempty for ReqSigs and Addresses: both fields are not shown when there is an error identifying to scriptType or parsing addresses in bitcoind --- jsonapi.go | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 3d9b0730..9184835c 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -99,13 +99,43 @@ type ScriptSig struct { // Vin models parts of the tx data. It is defined seperately since both // getrawtransaction and decoderawtransaction use the same structure. type Vin struct { - Coinbase string `json:"coinbase,omitempty"` - Txid string `json:"txid,omitempty"` - Vout int `json:"vout,omitempty"` - ScriptSig *ScriptSig `json:"scriptSig,omitempty"` + Coinbase string `json:"coinbase"` + Txid string `json:"txid"` + Vout int `json:"vout"` + ScriptSig *ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` } +func (v *Vin) IsCoinBase() bool { + return len(v.Coinbase) > 0 +} + +func (v *Vin) MarshalJSON() ([]byte, error) { + if v.IsCoinBase() { + coinbaseStruct := struct { + Coinbase string `json:"coinbase"` + Sequence uint32 `json:"sequence"` + }{ + Coinbase: v.Coinbase, + Sequence: v.Sequence, + } + return json.Marshal(coinbaseStruct) + } + + txStruct := struct { + Txid string `json:"txid"` + Vout int `json:"vout"` + ScriptSig *ScriptSig `json:"scriptSig"` + Sequence uint32 `json:"sequence"` + }{ + Txid: v.Txid, + Vout: v.Vout, + ScriptSig: v.ScriptSig, + Sequence: v.Sequence, + } + return json.Marshal(txStruct) +} + // Vout models parts of the tx data. It is defined seperately since both // getrawtransaction and decoderawtransaction use the same structure. type Vout struct { @@ -114,9 +144,9 @@ type Vout struct { ScriptPubKey struct { Asm string `json:"asm"` Hex string `json:"hex"` - ReqSigs int `json:"reqSigs"` + ReqSigs int `json:"reqSigs,omitempty"` Type string `json:"type"` - Addresses []string `json:"addresses"` + Addresses []string `json:"addresses,omitempty"` } `json:"scriptPubKey"` } From 8d7354f45b87bc0538cc2ff1652b180361f6d230 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 3 Jan 2014 10:22:07 -0600 Subject: [PATCH 091/229] Gofmt. --- jsoncmd.go | 6 +++--- jsoncmd_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 2dd3cf0f..af55cc93 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2830,7 +2830,7 @@ func (cmd *GetRawChangeAddressCmd) UnmarshalJSON(b []byte) error { // GetRawMempoolCmd is a type handling custom marshaling and // unmarshaling of getrawmempool JSON RPC commands. type GetRawMempoolCmd struct { - id interface{} + id interface{} Verbose bool } @@ -2847,7 +2847,7 @@ func NewGetRawMempoolCmd(id interface{}, optArgs ...bool) (*GetRawMempoolCmd, er verbose = optArgs[0] } return &GetRawMempoolCmd{ - id: id, + id: id, Verbose: verbose, }, nil } @@ -2892,7 +2892,7 @@ func (cmd *GetRawMempoolCmd) UnmarshalJSON(b []byte) error { } optArgs := make([]bool, 0, 1) - if len(r.Params) == 1 { + if len(r.Params) == 1 { verbose, ok := r.Params[0].(bool) if !ok { return errors.New("first optional parameter verbose must be a bool") diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 2c20e4b7..db1d4246 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -550,7 +550,7 @@ var jsoncmdtests = []struct { return NewGetRawMempoolCmd(float64(1), true) }, result: &GetRawMempoolCmd{ - id: float64(1), + id: float64(1), Verbose: true, }, }, From 84cb4c7130dde83eb05eea93be9c9f61ea71fd65 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 3 Jan 2014 10:22:37 -0600 Subject: [PATCH 092/229] Export new function ConvertCreateRawTxParams. The inputs to the createrawtransaction command are JSON strings, however the NewCreateRawTransactionCmd function takes concrete types. Thus, callers which deal with the raw JSON need a method to perform the validation and conversion. This logic is the same as what needs to happen when unmashalling a full JSON-RPC command, so this commit factors that logic out into a separate function and exports it. --- jsoncmd.go | 112 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index af55cc93..44406612 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -709,6 +709,65 @@ type TransactionInput struct { Vout int `json:"vout"` } +// ConvertCreateRawTxParams validates and converts the passed parameters from +// raw interfaces into concrete structs. This is a separate function since +// the createrawtransaction command parameters are caller-crafted JSON as +// opposed to machine generated JSON as is the case for most commands. +func ConvertCreateRawTxParams(inputs, amounts interface{}) ([]TransactionInput, map[string]int64, error) { + iinputs, ok := inputs.([]interface{}) + if !ok { + return nil, nil, errors.New("first parameter inputs must be an array") + } + rinputs := make([]TransactionInput, len(iinputs)) + for i, iv := range iinputs { + v, ok := iv.(map[string]interface{}) + if !ok { + return nil, nil, errors.New("first parameter inputs must be an array of objects") + } + + if len(v) != 2 { + return nil, nil, errors.New("input with wrong number of members") + } + txid, ok := v["txid"] + if !ok { + return nil, nil, errors.New("input without txid") + } + rinputs[i].Txid, ok = txid.(string) + if !ok { + return nil, nil, errors.New("input txid isn't a string") + } + + vout, ok := v["vout"] + if !ok { + return nil, nil, errors.New("input without vout") + } + fvout, ok := vout.(float64) + if !ok { + return nil, nil, errors.New("input vout not a number") + } + rinputs[i].Vout = int(fvout) + } + famounts, ok := amounts.(map[string]interface{}) + if !ok { + return nil, nil, errors.New("second parameter keys must be a map") + } + + ramounts := make(map[string]int64) + for k, v := range famounts { + fv, ok := v.(float64) + if !ok { + return nil, nil, errors.New("second parameter keys must be a number map") + } + var err error + ramounts[k], err = JSONToAmount(fv) + if err != nil { + return nil, nil, err + } + } + + return rinputs, ramounts, nil +} + // CreateRawTransactionCmd is a type handling custom marshaling and // unmarshaling of createrawtransaction JSON RPC commands. type CreateRawTransactionCmd struct { @@ -770,56 +829,11 @@ func (cmd *CreateRawTransactionCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 2 { return ErrWrongNumberOfParams } - iinputs, ok := r.Params[0].([]interface{}) - if !ok { - return errors.New("first parameter inputs must be an array") - } - inputs := make([]TransactionInput, len(iinputs)) - for i, iv := range iinputs { - v, ok := iv.(map[string]interface{}) - if !ok { - return errors.New("first parameter inputs must be an array of objects") - } - if len(v) != 2 { - return errors.New("input with wrong number of members") - } - txid, ok := v["txid"] - if !ok { - return errors.New("input without txid") - } - inputs[i].Txid, ok = txid.(string) - if !ok { - return errors.New("input txid isn't a string") - } - - vout, ok := v["vout"] - if !ok { - return errors.New("input without vout") - } - fvout, ok := vout.(float64) - if !ok { - return errors.New("input vout not a number") - } - inputs[i].Vout = int(fvout) - } - cmd.Inputs = inputs - famounts, ok := r.Params[1].(map[string]interface{}) - if !ok { - return errors.New("second parameter keys must be a map") - } - - amounts := make(map[string]int64) - for k, v := range famounts { - fv, ok := v.(float64) - if !ok { - return errors.New("second parameter keys must be a number map") - } - var err error - amounts[k], err = JSONToAmount(fv) - if err != nil { - return err - } + inputs, amounts, err := ConvertCreateRawTxParams(r.Params[0], + r.Params[1]) + if err != nil { + return err } newCmd, err := NewCreateRawTransactionCmd(r.Id, inputs, amounts) From 2944ccb86bcbb80a4c7acad13a519cb3915a6586 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 3 Jan 2014 12:02:41 -0500 Subject: [PATCH 093/229] Update coverage report. --- test_coverage.txt | 443 +++++++++++++++++++++++----------------------- 1 file changed, 223 insertions(+), 220 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index 0eeaf008..8e5e0428 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -5,154 +5,155 @@ github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 98.46% (64/65) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.53% (77/86) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) @@ -163,56 +164,56 @@ github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/3 github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) +github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 71.74% (33/46) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) @@ -225,24 +226,115 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 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/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) @@ -251,137 +343,48 @@ github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 70.22% (1863/2653) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 69.96% (1879/2686) From 258e9ef4c6d50e79dc74eaf6010496f7910e896d Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 3 Jan 2014 17:50:17 -0500 Subject: [PATCH 094/229] Add test for the Cmd.Id() functions. --- jsoncmd_test.go | 419 ++++++++++++++++++------------------ test_coverage.txt | 528 +++++++++++++++++++++++----------------------- 2 files changed, 477 insertions(+), 470 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index db1d4246..ffd1c09a 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -12,6 +12,8 @@ import ( "testing" ) +var testId = float64(1) + var jsoncmdtests = []struct { name string f func() (Cmd, error) @@ -20,11 +22,11 @@ var jsoncmdtests = []struct { { name: "basic addmultisigaddress", f: func() (Cmd, error) { - return NewAddMultisigAddressCmd(float64(1), 1, + return NewAddMultisigAddressCmd(testId, 1, []string{"foo", "bar"}) }, result: &AddMultisigAddressCmd{ - id: float64(1), + id: testId, NRequired: 1, Keys: []string{"foo", "bar"}, Account: "", @@ -33,11 +35,11 @@ var jsoncmdtests = []struct { { name: "addmultisigaddress + optional", f: func() (Cmd, error) { - return NewAddMultisigAddressCmd(float64(1), 1, + return NewAddMultisigAddressCmd(testId, 1, []string{"foo", "bar"}, "address") }, result: &AddMultisigAddressCmd{ - id: float64(1), + id: testId, NRequired: 1, Keys: []string{"foo", "bar"}, Account: "address", @@ -47,11 +49,11 @@ var jsoncmdtests = []struct { { name: "basic addnode add", f: func() (Cmd, error) { - return NewAddNodeCmd(float64(1), "address", + return NewAddNodeCmd(testId, "address", "add") }, result: &AddNodeCmd{ - id: float64(1), + id: testId, Addr: "address", SubCmd: "add", }, @@ -59,11 +61,11 @@ var jsoncmdtests = []struct { { name: "basic addnode remove", f: func() (Cmd, error) { - return NewAddNodeCmd(float64(1), "address", + return NewAddNodeCmd(testId, "address", "remove") }, result: &AddNodeCmd{ - id: float64(1), + id: testId, Addr: "address", SubCmd: "remove", }, @@ -71,11 +73,11 @@ var jsoncmdtests = []struct { { name: "basic addnode onetry", f: func() (Cmd, error) { - return NewAddNodeCmd(float64(1), "address", + return NewAddNodeCmd(testId, "address", "onetry") }, result: &AddNodeCmd{ - id: float64(1), + id: testId, Addr: "address", SubCmd: "onetry", }, @@ -84,21 +86,21 @@ var jsoncmdtests = []struct { { name: "basic backupwallet", f: func() (Cmd, error) { - return NewBackupWalletCmd(float64(1), "destination") + return NewBackupWalletCmd(testId, "destination") }, result: &BackupWalletCmd{ - id: float64(1), + id: testId, Destination: "destination", }, }, { name: "basic createmultisig", f: func() (Cmd, error) { - return NewCreateMultisigCmd(float64(1), 1, + return NewCreateMultisigCmd(testId, 1, []string{"key1", "key2", "key3"}) }, result: &CreateMultisigCmd{ - id: float64(1), + id: testId, NRequired: 1, Keys: []string{"key1", "key2", "key3"}, }, @@ -106,14 +108,14 @@ var jsoncmdtests = []struct { { name: "basic createrawtransaction", f: func() (Cmd, error) { - return NewCreateRawTransactionCmd(float64(1), + return NewCreateRawTransactionCmd(testId, []TransactionInput{ TransactionInput{Txid: "tx1", Vout: 1}, TransactionInput{Txid: "tx2", Vout: 3}}, map[string]int64{"bob": 1, "bill": 2}) }, result: &CreateRawTransactionCmd{ - id: float64(1), + id: testId, Inputs: []TransactionInput{ TransactionInput{Txid: "tx1", Vout: 1}, TransactionInput{Txid: "tx2", Vout: 3}, @@ -127,118 +129,118 @@ var jsoncmdtests = []struct { { name: "basic debuglevel", f: func() (Cmd, error) { - return NewDebugLevelCmd(float64(1), "debug") + return NewDebugLevelCmd(testId, "debug") }, result: &DebugLevelCmd{ - id: float64(1), + id: testId, LevelSpec: "debug", }, }, { name: "basic decoderawtransaction", f: func() (Cmd, error) { - return NewDecodeRawTransactionCmd(float64(1), + return NewDecodeRawTransactionCmd(testId, "thisisahexidecimaltransaction") }, result: &DecodeRawTransactionCmd{ - id: float64(1), + id: testId, HexTx: "thisisahexidecimaltransaction", }, }, { name: "basic decodescript", f: func() (Cmd, error) { - return NewDecodeScriptCmd(float64(1), + return NewDecodeScriptCmd(testId, "a bunch of hex") }, result: &DecodeScriptCmd{ - id: float64(1), + id: testId, HexScript: "a bunch of hex", }, }, { name: "basic dumpprivkey", f: func() (Cmd, error) { - return NewDumpPrivKeyCmd(float64(1), + return NewDumpPrivKeyCmd(testId, "address") }, result: &DumpPrivKeyCmd{ - id: float64(1), + id: testId, Address: "address", }, }, { name: "basic dumpwallet", f: func() (Cmd, error) { - return NewDumpWalletCmd(float64(1), + return NewDumpWalletCmd(testId, "filename") }, result: &DumpWalletCmd{ - id: float64(1), + id: testId, Filename: "filename", }, }, { name: "basic encryptwallet", f: func() (Cmd, error) { - return NewEncryptWalletCmd(float64(1), + return NewEncryptWalletCmd(testId, "passphrase") }, result: &EncryptWalletCmd{ - id: float64(1), + id: testId, Passphrase: "passphrase", }, }, { name: "basic getaccount", f: func() (Cmd, error) { - return NewGetAccountCmd(float64(1), + return NewGetAccountCmd(testId, "address") }, result: &GetAccountCmd{ - id: float64(1), + id: testId, Address: "address", }, }, { name: "basic getaccountaddress", f: func() (Cmd, error) { - return NewGetAccountAddressCmd(float64(1), + return NewGetAccountAddressCmd(testId, "account") }, result: &GetAccountAddressCmd{ - id: float64(1), + id: testId, Account: "account", }, }, { name: "basic getaddednodeinfo true", f: func() (Cmd, error) { - return NewGetAddedNodeInfoCmd(float64(1), true) + return NewGetAddedNodeInfoCmd(testId, true) }, result: &GetAddedNodeInfoCmd{ - id: float64(1), + id: testId, Dns: true, }, }, { name: "basic getaddednodeinfo false", f: func() (Cmd, error) { - return NewGetAddedNodeInfoCmd(float64(1), false) + return NewGetAddedNodeInfoCmd(testId, false) }, result: &GetAddedNodeInfoCmd{ - id: float64(1), + id: testId, Dns: false, }, }, { name: "basic getaddednodeinfo withnode", f: func() (Cmd, error) { - return NewGetAddedNodeInfoCmd(float64(1), true, + return NewGetAddedNodeInfoCmd(testId, true, "thisisanode") }, result: &GetAddedNodeInfoCmd{ - id: float64(1), + id: testId, Dns: true, Node: "thisisanode", }, @@ -246,31 +248,31 @@ var jsoncmdtests = []struct { { name: "basic getaddressesbyaccount", f: func() (Cmd, error) { - return NewGetAddressesByAccountCmd(float64(1), + return NewGetAddressesByAccountCmd(testId, "account") }, result: &GetAddressesByAccountCmd{ - id: float64(1), + id: testId, Account: "account", }, }, { name: "basic getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(float64(1)) + return NewGetBalanceCmd(testId) }, result: &GetBalanceCmd{ - id: float64(1), + id: testId, MinConf: 1, // the default }, }, { name: "basic getbalance + account", f: func() (Cmd, error) { - return NewGetBalanceCmd(float64(1), "account") + return NewGetBalanceCmd(testId, "account") }, result: &GetBalanceCmd{ - id: float64(1), + id: testId, Account: "account", MinConf: 1, // the default }, @@ -278,20 +280,20 @@ var jsoncmdtests = []struct { { name: "basic getbalance + minconf", f: func() (Cmd, error) { - return NewGetBalanceCmd(float64(1), "", 2) + return NewGetBalanceCmd(testId, "", 2) }, result: &GetBalanceCmd{ - id: float64(1), + id: testId, MinConf: 2, }, }, { name: "basic getbalance + account + minconf", f: func() (Cmd, error) { - return NewGetBalanceCmd(float64(1), "account", 2) + return NewGetBalanceCmd(testId, "account", 2) }, result: &GetBalanceCmd{ - id: float64(1), + id: testId, Account: "account", MinConf: 2, }, @@ -299,20 +301,20 @@ var jsoncmdtests = []struct { { name: "basic getbestblockhash", f: func() (Cmd, error) { - return NewGetBestBlockHashCmd(float64(1)) + return NewGetBestBlockHashCmd(testId) }, result: &GetBestBlockHashCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getblock", f: func() (Cmd, error) { - return NewGetBlockCmd(float64(1), + return NewGetBlockCmd(testId, "somehash") }, result: &GetBlockCmd{ - id: float64(1), + id: testId, Hash: "somehash", Verbose: true, }, @@ -320,40 +322,40 @@ var jsoncmdtests = []struct { { name: "basic getblockcount", f: func() (Cmd, error) { - return NewGetBlockCountCmd(float64(1)) + return NewGetBlockCountCmd(testId) }, result: &GetBlockCountCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getblockhash", f: func() (Cmd, error) { - return NewGetBlockHashCmd(float64(1), 1234) + return NewGetBlockHashCmd(testId, 1234) }, result: &GetBlockHashCmd{ - id: float64(1), + id: testId, Index: 1234, }, }, { name: "basic getblocktemplate", f: func() (Cmd, error) { - return NewGetBlockTemplateCmd(float64(1)) + return NewGetBlockTemplateCmd(testId) }, result: &GetBlockTemplateCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getblocktemplate + request", f: func() (Cmd, error) { - return NewGetBlockTemplateCmd(float64(1), + return NewGetBlockTemplateCmd(testId, &TemplateRequest{Mode: "mode", Capabilities: []string{"one", "two", "three"}}) }, result: &GetBlockTemplateCmd{ - id: float64(1), + id: testId, Request: &TemplateRequest{ Mode: "mode", Capabilities: []string{ @@ -367,12 +369,12 @@ var jsoncmdtests = []struct { { name: "basic getblocktemplate + request no mode", f: func() (Cmd, error) { - return NewGetBlockTemplateCmd(float64(1), + return NewGetBlockTemplateCmd(testId, &TemplateRequest{ Capabilities: []string{"one", "two", "three"}}) }, result: &GetBlockTemplateCmd{ - id: float64(1), + id: testId, Request: &TemplateRequest{ Capabilities: []string{ "one", @@ -385,82 +387,82 @@ var jsoncmdtests = []struct { { name: "basic getconectioncount", f: func() (Cmd, error) { - return NewGetConnectionCountCmd(float64(1)) + return NewGetConnectionCountCmd(testId) }, result: &GetConnectionCountCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getdifficulty", f: func() (Cmd, error) { - return NewGetDifficultyCmd(float64(1)) + return NewGetDifficultyCmd(testId) }, result: &GetDifficultyCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getgeneratecmd", f: func() (Cmd, error) { - return NewGetGenerateCmd(float64(1)) + return NewGetGenerateCmd(testId) }, result: &GetGenerateCmd{ - id: float64(1), + id: testId, }, }, { name: "basic gethashespersec", f: func() (Cmd, error) { - return NewGetHashesPerSecCmd(float64(1)) + return NewGetHashesPerSecCmd(testId) }, result: &GetHashesPerSecCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getinfo", f: func() (Cmd, error) { - return NewGetInfoCmd(float64(1)) + return NewGetInfoCmd(testId) }, result: &GetInfoCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getinfo", f: func() (Cmd, error) { - return NewGetInfoCmd(float64(1)) + return NewGetInfoCmd(testId) }, result: &GetInfoCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getmininginfo", f: func() (Cmd, error) { - return NewGetMiningInfoCmd(float64(1)) + return NewGetMiningInfoCmd(testId) }, result: &GetMiningInfoCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getnettotals", f: func() (Cmd, error) { - return NewGetNetTotalsCmd(float64(1)) + return NewGetNetTotalsCmd(testId) }, result: &GetNetTotalsCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getnetworkhashps", f: func() (Cmd, error) { - return NewGetNetworkHashPSCmd(float64(1)) + return NewGetNetworkHashPSCmd(testId) }, result: &GetNetworkHashPSCmd{ - id: float64(1), + id: testId, Blocks: 120, Height: -1, }, @@ -468,10 +470,10 @@ var jsoncmdtests = []struct { { name: "basic getnetworkhashps + blocks", f: func() (Cmd, error) { - return NewGetNetworkHashPSCmd(float64(1), 5000) + return NewGetNetworkHashPSCmd(testId, 5000) }, result: &GetNetworkHashPSCmd{ - id: float64(1), + id: testId, Blocks: 5000, Height: -1, }, @@ -479,10 +481,10 @@ var jsoncmdtests = []struct { { name: "basic getnetworkhashps + blocks + height", f: func() (Cmd, error) { - return NewGetNetworkHashPSCmd(float64(1), 5000, 1000) + return NewGetNetworkHashPSCmd(testId, 5000, 1000) }, result: &GetNetworkHashPSCmd{ - id: float64(1), + id: testId, Blocks: 5000, Height: 1000, }, @@ -490,90 +492,90 @@ var jsoncmdtests = []struct { { name: "basic getnewaddress", f: func() (Cmd, error) { - return NewGetNewAddressCmd(float64(1), "account") + return NewGetNewAddressCmd(testId, "account") }, result: &GetNewAddressCmd{ - id: float64(1), + id: testId, Account: "account", }, }, { name: "basic getpeerinfo", f: func() (Cmd, error) { - return NewGetPeerInfoCmd(float64(1)) + return NewGetPeerInfoCmd(testId) }, result: &GetPeerInfoCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getrawmchangeaddress", f: func() (Cmd, error) { - return NewGetRawChangeAddressCmd(float64(1)) + return NewGetRawChangeAddressCmd(testId) }, result: &GetRawChangeAddressCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getrawmchangeaddress + account", f: func() (Cmd, error) { - return NewGetRawChangeAddressCmd(float64(1), + return NewGetRawChangeAddressCmd(testId, "accountname") }, result: &GetRawChangeAddressCmd{ - id: float64(1), + id: testId, Account: "accountname", }, }, { name: "basic getrawmempool", f: func() (Cmd, error) { - return NewGetRawMempoolCmd(float64(1)) + return NewGetRawMempoolCmd(testId) }, result: &GetRawMempoolCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getrawmempool noverbose", f: func() (Cmd, error) { - return NewGetRawMempoolCmd(float64(1), false) + return NewGetRawMempoolCmd(testId, false) }, result: &GetRawMempoolCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getrawmempool verbose", f: func() (Cmd, error) { - return NewGetRawMempoolCmd(float64(1), true) + return NewGetRawMempoolCmd(testId, true) }, result: &GetRawMempoolCmd{ - id: float64(1), + id: testId, Verbose: true, }, }, { name: "basic getrawtransaction", f: func() (Cmd, error) { - return NewGetRawTransactionCmd(float64(1), + return NewGetRawTransactionCmd(testId, "sometxid") }, result: &GetRawTransactionCmd{ - id: float64(1), + id: testId, Txid: "sometxid", }, }, { name: "basic getrawtransaction + verbose", f: func() (Cmd, error) { - return NewGetRawTransactionCmd(float64(1), + return NewGetRawTransactionCmd(testId, "sometxid", true) }, result: &GetRawTransactionCmd{ - id: float64(1), + id: testId, Txid: "sometxid", Verbose: true, }, @@ -581,12 +583,12 @@ var jsoncmdtests = []struct { { name: "basic getreceivedbyaccount", f: func() (Cmd, error) { - return NewGetReceivedByAccountCmd(float64(1), + return NewGetReceivedByAccountCmd(testId, "abtcaccount", 1) }, result: &GetReceivedByAccountCmd{ - id: float64(1), + id: testId, Account: "abtcaccount", MinConf: 1, }, @@ -594,12 +596,12 @@ var jsoncmdtests = []struct { { name: "basic getreceivedbyaddress", f: func() (Cmd, error) { - return NewGetReceivedByAddressCmd(float64(1), + return NewGetReceivedByAddressCmd(testId, "abtcaddress", 1) }, result: &GetReceivedByAddressCmd{ - id: float64(1), + id: testId, Address: "abtcaddress", MinConf: 1, }, @@ -607,23 +609,23 @@ var jsoncmdtests = []struct { { name: "basic gettransaction", f: func() (Cmd, error) { - return NewGetTransactionCmd(float64(1), + return NewGetTransactionCmd(testId, "atxid") }, result: &GetTransactionCmd{ - id: float64(1), + id: testId, Txid: "atxid", }, }, { name: "basic gettxout", f: func() (Cmd, error) { - return NewGetTxOutCmd(float64(1), + return NewGetTxOutCmd(testId, "sometx", 10) }, result: &GetTxOutCmd{ - id: float64(1), + id: testId, Txid: "sometx", Output: 10, }, @@ -631,13 +633,13 @@ var jsoncmdtests = []struct { { name: "basic gettxout + optional", f: func() (Cmd, error) { - return NewGetTxOutCmd(float64(1), + return NewGetTxOutCmd(testId, "sometx", 10, false) }, result: &GetTxOutCmd{ - id: float64(1), + id: testId, Txid: "sometx", Output: 10, IncludeMempool: false, @@ -646,16 +648,16 @@ var jsoncmdtests = []struct { { name: "basic gettxsetoutinfo", f: func() (Cmd, error) { - return NewGetTxOutSetInfoCmd(float64(1)) + return NewGetTxOutSetInfoCmd(testId) }, result: &GetTxOutSetInfoCmd{ - id: float64(1), + id: testId, }, }, { name: "basic getwork", f: func() (Cmd, error) { - return NewGetWorkCmd(float64(1), + return NewGetWorkCmd(testId, WorkRequest{ Data: "some data", Target: "our target", @@ -663,7 +665,7 @@ var jsoncmdtests = []struct { }) }, result: &GetWorkCmd{ - id: float64(1), + id: testId, Request: WorkRequest{ Data: "some data", Target: "our target", @@ -674,31 +676,31 @@ var jsoncmdtests = []struct { { name: "basic help", f: func() (Cmd, error) { - return NewHelpCmd(float64(1)) + return NewHelpCmd(testId) }, result: &HelpCmd{ - id: float64(1), + id: testId, }, }, { name: "basic help + optional cmd", f: func() (Cmd, error) { - return NewHelpCmd(float64(1), + return NewHelpCmd(testId, "getinfo") }, result: &HelpCmd{ - id: float64(1), + id: testId, Command: "getinfo", }, }, { name: "basic importprivkey", f: func() (Cmd, error) { - return NewImportPrivKeyCmd(float64(1), + return NewImportPrivKeyCmd(testId, "somereallongprivatekey") }, result: &ImportPrivKeyCmd{ - id: float64(1), + id: testId, PrivKey: "somereallongprivatekey", Rescan: true, }, @@ -706,12 +708,12 @@ var jsoncmdtests = []struct { { name: "basic importprivkey + 1 opt", f: func() (Cmd, error) { - return NewImportPrivKeyCmd(float64(1), + return NewImportPrivKeyCmd(testId, "somereallongprivatekey", "some text") }, result: &ImportPrivKeyCmd{ - id: float64(1), + id: testId, PrivKey: "somereallongprivatekey", Label: "some text", Rescan: true, @@ -720,13 +722,13 @@ var jsoncmdtests = []struct { { name: "basic importprivkey + 2 opts", f: func() (Cmd, error) { - return NewImportPrivKeyCmd(float64(1), + return NewImportPrivKeyCmd(testId, "somereallongprivatekey", "some text", false) }, result: &ImportPrivKeyCmd{ - id: float64(1), + id: testId, PrivKey: "somereallongprivatekey", Label: "some text", Rescan: false, @@ -735,68 +737,68 @@ var jsoncmdtests = []struct { { name: "basic importwallet", f: func() (Cmd, error) { - return NewImportWalletCmd(float64(1), + return NewImportWalletCmd(testId, "walletfilename.dat") }, result: &ImportWalletCmd{ - id: float64(1), + id: testId, Filename: "walletfilename.dat", }, }, { name: "basic keypoolrefill", f: func() (Cmd, error) { - return NewKeyPoolRefillCmd(float64(1)) + return NewKeyPoolRefillCmd(testId) }, result: &KeyPoolRefillCmd{ - id: float64(1), + id: testId, }, }, { name: "basic listaccounts", f: func() (Cmd, error) { - return NewListAccountsCmd(float64(1), 1) + return NewListAccountsCmd(testId, 1) }, result: &ListAccountsCmd{ - id: float64(1), + id: testId, MinConf: 1, }, }, { name: "basic listaddressgroupings", f: func() (Cmd, error) { - return NewListAddressGroupingsCmd(float64(1)) + return NewListAddressGroupingsCmd(testId) }, result: &ListAddressGroupingsCmd{ - id: float64(1), + id: testId, }, }, { name: "basic listlockunspent", f: func() (Cmd, error) { - return NewListLockUnspentCmd(float64(1)) + return NewListLockUnspentCmd(testId) }, result: &ListLockUnspentCmd{ - id: float64(1), + id: testId, }, }, { name: "basic listreceivedbyaccount", f: func() (Cmd, error) { - return NewListReceivedByAccountCmd(float64(1)) + return NewListReceivedByAccountCmd(testId) }, result: &ListReceivedByAccountCmd{ - id: float64(1), + id: testId, MinConf: 1, }, }, { name: "basic listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(float64(1)) + return NewListTransactionsCmd(testId) }, result: &ListTransactionsCmd{ - id: float64(1), + id: testId, Account: "", Count: 10, From: 0, @@ -805,10 +807,10 @@ var jsoncmdtests = []struct { { name: "listtransactions 1 optarg", f: func() (Cmd, error) { - return NewListTransactionsCmd(float64(1), "abcde") + return NewListTransactionsCmd(testId, "abcde") }, result: &ListTransactionsCmd{ - id: float64(1), + id: testId, Account: "abcde", Count: 10, From: 0, @@ -817,10 +819,10 @@ var jsoncmdtests = []struct { { name: "listtransactions 2 optargs", f: func() (Cmd, error) { - return NewListTransactionsCmd(float64(1), "abcde", 123) + return NewListTransactionsCmd(testId, "abcde", 123) }, result: &ListTransactionsCmd{ - id: float64(1), + id: testId, Account: "abcde", Count: 123, From: 0, @@ -829,10 +831,10 @@ var jsoncmdtests = []struct { { name: "listtransactions 3 optargs", f: func() (Cmd, error) { - return NewListTransactionsCmd(float64(1), "abcde", 123, 456) + return NewListTransactionsCmd(testId, "abcde", 123, 456) }, result: &ListTransactionsCmd{ - id: float64(1), + id: testId, Account: "abcde", Count: 123, From: 456, @@ -841,10 +843,10 @@ var jsoncmdtests = []struct { { name: "basic listunspent", f: func() (Cmd, error) { - return NewListUnspentCmd(float64(1)) + return NewListUnspentCmd(testId) }, result: &ListUnspentCmd{ - id: float64(1), + id: testId, MinConf: 1, MaxConf: 999999, }, @@ -852,10 +854,10 @@ var jsoncmdtests = []struct { { name: "basic listunspent + opts", f: func() (Cmd, error) { - return NewListUnspentCmd(float64(1), 0, 6) + return NewListUnspentCmd(testId, 0, 6) }, result: &ListUnspentCmd{ - id: float64(1), + id: testId, MinConf: 0, MaxConf: 6, }, @@ -863,24 +865,24 @@ var jsoncmdtests = []struct { { name: "basic lockunspent", f: func() (Cmd, error) { - return NewLockUnspentCmd(float64(1), true) + return NewLockUnspentCmd(testId, true) }, result: &LockUnspentCmd{ - id: float64(1), + id: testId, Unlock: true, }, }, { name: "basic move", f: func() (Cmd, error) { - return NewMoveCmd(float64(1), + return NewMoveCmd(testId, "account1", "account2", 12, 1) }, result: &MoveCmd{ - id: float64(1), + id: testId, FromAccount: "account1", ToAccount: "account2", Amount: 12, @@ -890,7 +892,7 @@ var jsoncmdtests = []struct { { name: "basic move + optionals", f: func() (Cmd, error) { - return NewMoveCmd(float64(1), + return NewMoveCmd(testId, "account1", "account2", 12, @@ -898,7 +900,7 @@ var jsoncmdtests = []struct { "some comment") }, result: &MoveCmd{ - id: float64(1), + id: testId, FromAccount: "account1", ToAccount: "account2", Amount: 12, @@ -909,23 +911,23 @@ var jsoncmdtests = []struct { { name: "basic ping", f: func() (Cmd, error) { - return NewPingCmd(float64(1)) + return NewPingCmd(testId) }, result: &PingCmd{ - id: float64(1), + id: testId, }, }, { name: "basic sendfrom", f: func() (Cmd, error) { - return NewSendFromCmd(float64(1), + return NewSendFromCmd(testId, "account", "address", 12, 1) }, result: &SendFromCmd{ - id: float64(1), + id: testId, FromAccount: "account", ToAddress: "address", Amount: 12, @@ -935,7 +937,7 @@ var jsoncmdtests = []struct { { name: "basic sendfrom + options", f: func() (Cmd, error) { - return NewSendFromCmd(float64(1), + return NewSendFromCmd(testId, "account", "address", 12, @@ -944,7 +946,7 @@ var jsoncmdtests = []struct { "comment to") }, result: &SendFromCmd{ - id: float64(1), + id: testId, FromAccount: "account", ToAddress: "address", Amount: 12, @@ -961,12 +963,12 @@ var jsoncmdtests = []struct { "address B": 2000, "address C": 3000, } - return NewSendManyCmd(float64(1), + return NewSendManyCmd(testId, "account", pairs) }, result: &SendManyCmd{ - id: float64(1), + id: testId, FromAccount: "account", Amounts: map[string]int64{ "address A": 1000, @@ -984,14 +986,14 @@ var jsoncmdtests = []struct { "address B": 2000, "address C": 3000, } - return NewSendManyCmd(float64(1), + return NewSendManyCmd(testId, "account", pairs, 10, "comment") }, result: &SendManyCmd{ - id: float64(1), + id: testId, FromAccount: "account", Amounts: map[string]int64{ "address A": 1000, @@ -1005,23 +1007,23 @@ var jsoncmdtests = []struct { { name: "basic sendrawtransaction", f: func() (Cmd, error) { - return NewSendRawTransactionCmd(float64(1), + return NewSendRawTransactionCmd(testId, "hexstringofatx") }, result: &SendRawTransactionCmd{ - id: float64(1), + id: testId, HexTx: "hexstringofatx", }, }, { name: "basic sendtoaddress", f: func() (Cmd, error) { - return NewSendToAddressCmd(float64(1), + return NewSendToAddressCmd(testId, "somebtcaddress", 1) }, result: &SendToAddressCmd{ - id: float64(1), + id: testId, Address: "somebtcaddress", Amount: 1, }, @@ -1029,14 +1031,14 @@ var jsoncmdtests = []struct { { name: "basic sendtoaddress plus optional", f: func() (Cmd, error) { - return NewSendToAddressCmd(float64(1), + return NewSendToAddressCmd(testId, "somebtcaddress", 1, "a comment", "comment to") }, result: &SendToAddressCmd{ - id: float64(1), + id: testId, Address: "somebtcaddress", Amount: 1, Comment: "a comment", @@ -1046,12 +1048,12 @@ var jsoncmdtests = []struct { { name: "basic setaccount", f: func() (Cmd, error) { - return NewSetAccountCmd(float64(1), + return NewSetAccountCmd(testId, "somebtcaddress", "account name") }, result: &SetAccountCmd{ - id: float64(1), + id: testId, Address: "somebtcaddress", Account: "account name", }, @@ -1059,20 +1061,20 @@ var jsoncmdtests = []struct { { name: "basic setgenerate", f: func() (Cmd, error) { - return NewSetGenerateCmd(float64(1), true) + return NewSetGenerateCmd(testId, true) }, result: &SetGenerateCmd{ - id: float64(1), + id: testId, Generate: true, }, }, { name: "basic setgenerate + optional", f: func() (Cmd, error) { - return NewSetGenerateCmd(float64(1), true, 10) + return NewSetGenerateCmd(testId, true, 10) }, result: &SetGenerateCmd{ - id: float64(1), + id: testId, Generate: true, GenProcLimit: 10, }, @@ -1080,22 +1082,22 @@ var jsoncmdtests = []struct { { name: "basic settxfee", f: func() (Cmd, error) { - return NewSetTxFeeCmd(float64(1), 10) + return NewSetTxFeeCmd(testId, 10) }, result: &SetTxFeeCmd{ - id: float64(1), + id: testId, Amount: 10, }, }, { name: "basic signmessage", f: func() (Cmd, error) { - return NewSignMessageCmd(float64(1), + return NewSignMessageCmd(testId, "btcaddress", "a message") }, result: &SignMessageCmd{ - id: float64(1), + id: testId, Address: "btcaddress", Message: "a message", }, @@ -1103,18 +1105,18 @@ var jsoncmdtests = []struct { { name: "basic signrawtransaction", f: func() (Cmd, error) { - return NewSignRawTransactionCmd(float64(1), + return NewSignRawTransactionCmd(testId, "sometxstring") }, result: &SignRawTransactionCmd{ - id: float64(1), + id: testId, RawTx: "sometxstring", }, }, /* { name: "basic signrawtransaction with optional", f: func() (Cmd, error) { - return NewSignRawTransactionCmd(float64(1), + return NewSignRawTransactionCmd(testId, "sometxstring", []RawTxInput{ RawTxInput{ @@ -1128,7 +1130,7 @@ var jsoncmdtests = []struct { "flags") }, result: &SignRawTransactionCmd{ - id: float64(1), + id: testId, RawTx: "sometxstring", Inputs: []RawTxInput{ RawTxInput{ @@ -1145,32 +1147,32 @@ var jsoncmdtests = []struct { { name: "basic stop", f: func() (Cmd, error) { - return NewStopCmd(float64(1)) + return NewStopCmd(testId) }, result: &StopCmd{ - id: float64(1), + id: testId, }, }, { name: "basic submitblock", f: func() (Cmd, error) { - return NewSubmitBlockCmd(float64(1), + return NewSubmitBlockCmd(testId, "lotsofhex") }, result: &SubmitBlockCmd{ - id: float64(1), + id: testId, HexBlock: "lotsofhex", }, }, { name: "submitblock with optional object", f: func() (Cmd, error) { - return NewSubmitBlockCmd(float64(1), + return NewSubmitBlockCmd(testId, "lotsofhex", &SubmitBlockOptions{WorkId: "otherstuff"}) }, result: &SubmitBlockCmd{ - id: float64(1), + id: testId, HexBlock: "lotsofhex", Options: &SubmitBlockOptions{WorkId: "otherstuff"}, }, @@ -1178,21 +1180,21 @@ var jsoncmdtests = []struct { { name: "basic validateaddress", f: func() (Cmd, error) { - return NewValidateAddressCmd(float64(1), + return NewValidateAddressCmd(testId, "somebtcaddress") }, result: &ValidateAddressCmd{ - id: float64(1), + id: testId, Address: "somebtcaddress", }, }, { name: "basic verifychain", f: func() (Cmd, error) { - return NewVerifyChainCmd(float64(1)) + return NewVerifyChainCmd(testId) }, result: &VerifyChainCmd{ - id: float64(1), + id: testId, CheckLevel: 3, CheckDepth: 288, }, @@ -1200,10 +1202,10 @@ var jsoncmdtests = []struct { { name: "basic verifychain + optional", f: func() (Cmd, error) { - return NewVerifyChainCmd(float64(1), 4, 1) + return NewVerifyChainCmd(testId, 4, 1) }, result: &VerifyChainCmd{ - id: float64(1), + id: testId, CheckLevel: 4, CheckDepth: 1, }, @@ -1211,13 +1213,13 @@ var jsoncmdtests = []struct { { name: "basic verifymessage", f: func() (Cmd, error) { - return NewVerifyMessageCmd(float64(1), + return NewVerifyMessageCmd(testId, "someaddress", "somesig", "a message") }, result: &VerifyMessageCmd{ - id: float64(1), + id: testId, Address: "someaddress", Signature: "somesig", Message: "a message", @@ -1226,21 +1228,21 @@ var jsoncmdtests = []struct { { name: "basic walletlock", f: func() (Cmd, error) { - return NewWalletLockCmd(float64(1)) + return NewWalletLockCmd(testId) }, result: &WalletLockCmd{ - id: float64(1), + id: testId, }, }, { name: "basic walletpassphrase", f: func() (Cmd, error) { - return NewWalletPassphraseCmd(float64(1), + return NewWalletPassphraseCmd(testId, "phrase1", 10) }, result: &WalletPassphraseCmd{ - id: float64(1), + id: testId, Passphrase: "phrase1", Timeout: 10, }, @@ -1248,11 +1250,11 @@ var jsoncmdtests = []struct { { name: "basic walletpassphrasechange", f: func() (Cmd, error) { - return NewWalletPassphraseChangeCmd(float64(1), + return NewWalletPassphraseChangeCmd(testId, "phrase1", "phrase2") }, result: &WalletPassphraseChangeCmd{ - id: float64(1), + id: testId, OldPassphrase: "phrase1", NewPassphrase: "phrase2", }, @@ -1282,6 +1284,11 @@ func TestCmds(t *testing.T) { continue } + id, ok := (c.Id()).(float64) + if !ok || id != testId { + t.Errorf("%s: id not returned properly", test.name) + } + if !reflect.DeepEqual(test.result, c2) { t.Errorf("%s: unmarshal not as expected. "+ "got %v wanted %v", test.name, spew.Sdump(c2), diff --git a/test_coverage.txt b/test_coverage.txt index 8e5e0428..02a5122c 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,164 +2,234 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.53% (77/86) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -169,46 +239,46 @@ github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.2 github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) -github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) +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/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) @@ -226,165 +296,95 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 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/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 69.96% (1879/2686) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 72.56% (1949/2686) From f78d054700f5f14c5dd369f17af454bf0f4b9d37 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 3 Jan 2014 17:52:39 -0600 Subject: [PATCH 095/229] Add struct for DecodeScriptResult. --- jsonapi.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index 9184835c..91ec2373 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -65,6 +65,14 @@ type BlockResult struct { NextHash string `json:"nextblockhash"` } +// DecodeScriptResult models the data returned from the decodescript command. +type DecodeScriptResult struct { + Asm string `json:"asm"` + ReqSigs int `json:"reqSigs,omitempty"` + Type string `json:"type"` + Addresses []string `json:"addresses,omitempty"` +} + // TxRawResult models the data from the getrawtransaction command. type TxRawResult struct { Hex string `json:"hex"` From e1053b4a958750cd10b30496504a83c9313d7aa1 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 4 Jan 2014 11:54:39 -0600 Subject: [PATCH 096/229] Add P2sh field to DecodeScriptResult. --- jsonapi.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonapi.go b/jsonapi.go index 91ec2373..25d84e46 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -71,6 +71,7 @@ type DecodeScriptResult struct { ReqSigs int `json:"reqSigs,omitempty"` Type string `json:"type"` Addresses []string `json:"addresses,omitempty"` + P2sh string `json:"p2sh"` } // TxRawResult models the data from the getrawtransaction command. From 0ef14522477a573ffd1d53e0ea20c16f0e36a56d Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 6 Jan 2014 10:12:35 -0500 Subject: [PATCH 097/229] Improve test coverage a bit. Fix bug in a json command caught by new test. --- jsoncmd.go | 2 +- jsoncmd_test.go | 334 ++++++++++++++++++++++------------- test_coverage.txt | 434 +++++++++++++++++++++++----------------------- 3 files changed, 435 insertions(+), 335 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 44406612..b19f9a05 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3177,7 +3177,7 @@ func (cmd *GetReceivedByAddressCmd) Id() interface{} { // Method satisfies the Cmd interface by returning the json method. func (cmd *GetReceivedByAddressCmd) Method() string { - return "getrecivedbyaddress" + return "getreceivedbyaddress" } // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. diff --git a/jsoncmd_test.go b/jsoncmd_test.go index ffd1c09a..6f8ba515 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -16,11 +16,13 @@ var testId = float64(1) var jsoncmdtests = []struct { name string + cmd string f func() (Cmd, error) result Cmd // after marshal and unmarshal }{ { - name: "basic addmultisigaddress", + name: "basic", + cmd: "addmultisigaddress", f: func() (Cmd, error) { return NewAddMultisigAddressCmd(testId, 1, []string{"foo", "bar"}) @@ -33,7 +35,8 @@ var jsoncmdtests = []struct { }, }, { - name: "addmultisigaddress + optional", + name: "+ optional", + cmd: "addmultisigaddress", f: func() (Cmd, error) { return NewAddMultisigAddressCmd(testId, 1, []string{"foo", "bar"}, "address") @@ -47,7 +50,8 @@ var jsoncmdtests = []struct { }, // TODO(oga) Too many arguments to newaddmultisigaddress { - name: "basic addnode add", + name: "basic add", + cmd: "addnode", f: func() (Cmd, error) { return NewAddNodeCmd(testId, "address", "add") @@ -59,7 +63,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic addnode remove", + name: "basic remove", + cmd: "addnode", f: func() (Cmd, error) { return NewAddNodeCmd(testId, "address", "remove") @@ -71,7 +76,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic addnode onetry", + name: "basic onetry", + cmd: "addnode", f: func() (Cmd, error) { return NewAddNodeCmd(testId, "address", "onetry") @@ -84,7 +90,8 @@ var jsoncmdtests = []struct { }, // TODO(oga) try invalid subcmds { - name: "basic backupwallet", + name: "basic", + cmd: "backupwallet", f: func() (Cmd, error) { return NewBackupWalletCmd(testId, "destination") }, @@ -94,7 +101,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic createmultisig", + name: "basic", + cmd: "createmultisig", f: func() (Cmd, error) { return NewCreateMultisigCmd(testId, 1, []string{"key1", "key2", "key3"}) @@ -106,7 +114,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic createrawtransaction", + name: "basic", + cmd: "createrawtransaction", f: func() (Cmd, error) { return NewCreateRawTransactionCmd(testId, []TransactionInput{ @@ -127,7 +136,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic debuglevel", + name: "basic", + cmd: "debuglevel", f: func() (Cmd, error) { return NewDebugLevelCmd(testId, "debug") }, @@ -137,7 +147,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic decoderawtransaction", + name: "basic", + cmd: "decoderawtransaction", f: func() (Cmd, error) { return NewDecodeRawTransactionCmd(testId, "thisisahexidecimaltransaction") @@ -148,7 +159,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic decodescript", + name: "basic", + cmd: "decodescript", f: func() (Cmd, error) { return NewDecodeScriptCmd(testId, "a bunch of hex") @@ -159,7 +171,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic dumpprivkey", + name: "basic", + cmd: "dumpprivkey", f: func() (Cmd, error) { return NewDumpPrivKeyCmd(testId, "address") @@ -170,7 +183,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic dumpwallet", + name: "basic", + cmd: "dumpwallet", f: func() (Cmd, error) { return NewDumpWalletCmd(testId, "filename") @@ -181,7 +195,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic encryptwallet", + name: "basic", + cmd: "encryptwallet", f: func() (Cmd, error) { return NewEncryptWalletCmd(testId, "passphrase") @@ -192,7 +207,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getaccount", + name: "basic", + cmd: "getaccount", f: func() (Cmd, error) { return NewGetAccountCmd(testId, "address") @@ -203,7 +219,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getaccountaddress", + name: "basic", + cmd: "getaccountaddress", f: func() (Cmd, error) { return NewGetAccountAddressCmd(testId, "account") @@ -214,7 +231,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getaddednodeinfo true", + name: "basic true", + cmd: "getaddednodeinfo", f: func() (Cmd, error) { return NewGetAddedNodeInfoCmd(testId, true) }, @@ -224,7 +242,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getaddednodeinfo false", + name: "basic false", + cmd: "getaddednodeinfo", f: func() (Cmd, error) { return NewGetAddedNodeInfoCmd(testId, false) }, @@ -234,7 +253,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getaddednodeinfo withnode", + name: "basic withnode", + cmd: "getaddednodeinfo", f: func() (Cmd, error) { return NewGetAddedNodeInfoCmd(testId, true, "thisisanode") @@ -246,7 +266,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getaddressesbyaccount", + name: "basic", + cmd: "getaddressesbyaccount", f: func() (Cmd, error) { return NewGetAddressesByAccountCmd(testId, "account") @@ -257,7 +278,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getbalance", + name: "basic", + cmd: "getbalance", f: func() (Cmd, error) { return NewGetBalanceCmd(testId) }, @@ -267,7 +289,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getbalance + account", + name: "basic + account", + cmd: "getbalance", f: func() (Cmd, error) { return NewGetBalanceCmd(testId, "account") }, @@ -278,7 +301,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getbalance + minconf", + name: "basic + minconf", + cmd: "getbalance", f: func() (Cmd, error) { return NewGetBalanceCmd(testId, "", 2) }, @@ -288,7 +312,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getbalance + account + minconf", + name: "basic + account + minconf", + cmd: "getbalance", f: func() (Cmd, error) { return NewGetBalanceCmd(testId, "account", 2) }, @@ -299,7 +324,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getbestblockhash", + name: "basic", + cmd: "getbestblockhash", f: func() (Cmd, error) { return NewGetBestBlockHashCmd(testId) }, @@ -308,7 +334,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getblock", + name: "basic", + cmd: "getblock", f: func() (Cmd, error) { return NewGetBlockCmd(testId, "somehash") @@ -320,7 +347,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getblockcount", + name: "basic", + cmd: "getblockcount", f: func() (Cmd, error) { return NewGetBlockCountCmd(testId) }, @@ -329,7 +357,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getblockhash", + name: "basic", + cmd: "getblockhash", f: func() (Cmd, error) { return NewGetBlockHashCmd(testId, 1234) }, @@ -339,7 +368,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getblocktemplate", + name: "basic", + cmd: "getblocktemplate", f: func() (Cmd, error) { return NewGetBlockTemplateCmd(testId) }, @@ -348,7 +378,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getblocktemplate + request", + name: "basic + request", + cmd: "getblocktemplate", f: func() (Cmd, error) { return NewGetBlockTemplateCmd(testId, &TemplateRequest{Mode: "mode", @@ -367,7 +398,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getblocktemplate + request no mode", + name: "basic + request no mode", + cmd: "getblocktemplate", f: func() (Cmd, error) { return NewGetBlockTemplateCmd(testId, &TemplateRequest{ @@ -385,7 +417,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getconectioncount", + name: "basic", + cmd: "getconnectioncount", f: func() (Cmd, error) { return NewGetConnectionCountCmd(testId) }, @@ -394,7 +427,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getdifficulty", + name: "basic", + cmd: "getdifficulty", f: func() (Cmd, error) { return NewGetDifficultyCmd(testId) }, @@ -403,7 +437,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getgeneratecmd", + name: "basic", + cmd: "getgenerate", f: func() (Cmd, error) { return NewGetGenerateCmd(testId) }, @@ -412,7 +447,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic gethashespersec", + name: "basic", + cmd: "gethashespersec", f: func() (Cmd, error) { return NewGetHashesPerSecCmd(testId) }, @@ -421,7 +457,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getinfo", + name: "basic", + cmd: "getinfo", f: func() (Cmd, error) { return NewGetInfoCmd(testId) }, @@ -430,16 +467,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getinfo", - f: func() (Cmd, error) { - return NewGetInfoCmd(testId) - }, - result: &GetInfoCmd{ - id: testId, - }, - }, - { - name: "basic getmininginfo", + name: "basic", + cmd: "getmininginfo", f: func() (Cmd, error) { return NewGetMiningInfoCmd(testId) }, @@ -448,7 +477,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getnettotals", + name: "basic", + cmd: "getnettotals", f: func() (Cmd, error) { return NewGetNetTotalsCmd(testId) }, @@ -457,7 +487,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getnetworkhashps", + name: "basic", + cmd: "getnetworkhashps", f: func() (Cmd, error) { return NewGetNetworkHashPSCmd(testId) }, @@ -468,7 +499,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getnetworkhashps + blocks", + name: "basic + blocks", + cmd: "getnetworkhashps", f: func() (Cmd, error) { return NewGetNetworkHashPSCmd(testId, 5000) }, @@ -479,7 +511,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getnetworkhashps + blocks + height", + name: "basic + blocks + height", + cmd: "getnetworkhashps", f: func() (Cmd, error) { return NewGetNetworkHashPSCmd(testId, 5000, 1000) }, @@ -490,7 +523,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getnewaddress", + name: "basic", + cmd: "getnewaddress", f: func() (Cmd, error) { return NewGetNewAddressCmd(testId, "account") }, @@ -500,7 +534,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getpeerinfo", + name: "basic", + cmd: "getpeerinfo", f: func() (Cmd, error) { return NewGetPeerInfoCmd(testId) }, @@ -509,7 +544,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawmchangeaddress", + name: "basic", + cmd: "getrawchangeaddress", f: func() (Cmd, error) { return NewGetRawChangeAddressCmd(testId) }, @@ -518,7 +554,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawmchangeaddress + account", + name: "basic + account", + cmd: "getrawchangeaddress", f: func() (Cmd, error) { return NewGetRawChangeAddressCmd(testId, "accountname") @@ -529,7 +566,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawmempool", + name: "basic", + cmd: "getrawmempool", f: func() (Cmd, error) { return NewGetRawMempoolCmd(testId) }, @@ -538,7 +576,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawmempool noverbose", + name: "basic noverbose", + cmd: "getrawmempool", f: func() (Cmd, error) { return NewGetRawMempoolCmd(testId, false) }, @@ -547,7 +586,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawmempool verbose", + name: "basic verbose", + cmd: "getrawmempool", f: func() (Cmd, error) { return NewGetRawMempoolCmd(testId, true) }, @@ -557,7 +597,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawtransaction", + name: "basic", + cmd: "getrawtransaction", f: func() (Cmd, error) { return NewGetRawTransactionCmd(testId, "sometxid") @@ -568,7 +609,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getrawtransaction + verbose", + name: "basic + verbose", + cmd: "getrawtransaction", f: func() (Cmd, error) { return NewGetRawTransactionCmd(testId, "sometxid", @@ -581,7 +623,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getreceivedbyaccount", + name: "basic", + cmd: "getreceivedbyaccount", f: func() (Cmd, error) { return NewGetReceivedByAccountCmd(testId, "abtcaccount", @@ -594,7 +637,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getreceivedbyaddress", + name: "basic", + cmd: "getreceivedbyaddress", f: func() (Cmd, error) { return NewGetReceivedByAddressCmd(testId, "abtcaddress", @@ -607,7 +651,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic gettransaction", + name: "basic", + cmd: "gettransaction", f: func() (Cmd, error) { return NewGetTransactionCmd(testId, "atxid") @@ -618,7 +663,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic gettxout", + name: "basic", + cmd: "gettxout", f: func() (Cmd, error) { return NewGetTxOutCmd(testId, "sometx", @@ -631,7 +677,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic gettxout + optional", + name: "basic + optional", + cmd: "gettxout", f: func() (Cmd, error) { return NewGetTxOutCmd(testId, "sometx", @@ -646,7 +693,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic gettxsetoutinfo", + name: "basic", + cmd: "gettxoutsetinfo", f: func() (Cmd, error) { return NewGetTxOutSetInfoCmd(testId) }, @@ -655,7 +703,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic getwork", + name: "basic", + cmd: "getwork", f: func() (Cmd, error) { return NewGetWorkCmd(testId, WorkRequest{ @@ -674,7 +723,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic help", + name: "basic", + cmd: "help", f: func() (Cmd, error) { return NewHelpCmd(testId) }, @@ -683,7 +733,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic help + optional cmd", + name: "basic + optional cmd", + cmd: "help", f: func() (Cmd, error) { return NewHelpCmd(testId, "getinfo") @@ -694,7 +745,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic importprivkey", + name: "basic", + cmd: "importprivkey", f: func() (Cmd, error) { return NewImportPrivKeyCmd(testId, "somereallongprivatekey") @@ -706,7 +758,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic importprivkey + 1 opt", + name: "basic + 1 opt", + cmd: "importprivkey", f: func() (Cmd, error) { return NewImportPrivKeyCmd(testId, "somereallongprivatekey", @@ -720,7 +773,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic importprivkey + 2 opts", + name: "basic + 2 opts", + cmd: "importprivkey", f: func() (Cmd, error) { return NewImportPrivKeyCmd(testId, "somereallongprivatekey", @@ -735,7 +789,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic importwallet", + name: "basic", + cmd: "importwallet", f: func() (Cmd, error) { return NewImportWalletCmd(testId, "walletfilename.dat") @@ -746,7 +801,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic keypoolrefill", + name: "basic", + cmd: "keypoolrefill", f: func() (Cmd, error) { return NewKeyPoolRefillCmd(testId) }, @@ -755,7 +811,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listaccounts", + name: "basic", + cmd: "listaccounts", f: func() (Cmd, error) { return NewListAccountsCmd(testId, 1) }, @@ -765,7 +822,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listaddressgroupings", + name: "basic", + cmd: "listaddressgroupings", f: func() (Cmd, error) { return NewListAddressGroupingsCmd(testId) }, @@ -774,7 +832,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listlockunspent", + name: "basic", + cmd: "listlockunspent", f: func() (Cmd, error) { return NewListLockUnspentCmd(testId) }, @@ -783,7 +842,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listreceivedbyaccount", + name: "basic", + cmd: "listreceivedbyaccount", f: func() (Cmd, error) { return NewListReceivedByAccountCmd(testId) }, @@ -793,7 +853,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listtransactions", + name: "basic", + cmd: "listtransactions", f: func() (Cmd, error) { return NewListTransactionsCmd(testId) }, @@ -805,7 +866,8 @@ var jsoncmdtests = []struct { }, }, { - name: "listtransactions 1 optarg", + name: "+ 1 optarg", + cmd: "listtransactions", f: func() (Cmd, error) { return NewListTransactionsCmd(testId, "abcde") }, @@ -817,7 +879,8 @@ var jsoncmdtests = []struct { }, }, { - name: "listtransactions 2 optargs", + name: "+ 2 optargs", + cmd: "listtransactions", f: func() (Cmd, error) { return NewListTransactionsCmd(testId, "abcde", 123) }, @@ -829,7 +892,8 @@ var jsoncmdtests = []struct { }, }, { - name: "listtransactions 3 optargs", + name: "+ 3 optargs", + cmd: "listtransactions", f: func() (Cmd, error) { return NewListTransactionsCmd(testId, "abcde", 123, 456) }, @@ -841,7 +905,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listunspent", + name: "basic", + cmd: "listunspent", f: func() (Cmd, error) { return NewListUnspentCmd(testId) }, @@ -852,7 +917,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic listunspent + opts", + name: "basic + opts", + cmd: "listunspent", f: func() (Cmd, error) { return NewListUnspentCmd(testId, 0, 6) }, @@ -863,7 +929,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic lockunspent", + name: "basic", + cmd: "lockunspent", f: func() (Cmd, error) { return NewLockUnspentCmd(testId, true) }, @@ -873,7 +940,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic move", + name: "basic", + cmd: "move", f: func() (Cmd, error) { return NewMoveCmd(testId, "account1", @@ -890,7 +958,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic move + optionals", + name: "basic + optionals", + cmd: "move", f: func() (Cmd, error) { return NewMoveCmd(testId, "account1", @@ -909,7 +978,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic ping", + name: "basic", + cmd: "ping", f: func() (Cmd, error) { return NewPingCmd(testId) }, @@ -918,7 +988,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic sendfrom", + name: "basic", + cmd: "sendfrom", f: func() (Cmd, error) { return NewSendFromCmd(testId, "account", @@ -935,7 +1006,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic sendfrom + options", + name: "basic + options", + cmd: "sendfrom", f: func() (Cmd, error) { return NewSendFromCmd(testId, "account", @@ -956,7 +1028,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic sendmany", + name: "basic", + cmd: "sendmany", f: func() (Cmd, error) { pairs := map[string]int64{ "address A": 1000, @@ -979,7 +1052,8 @@ var jsoncmdtests = []struct { }, }, { - name: "sendmany + options", + name: "+ options", + cmd: "sendmany", f: func() (Cmd, error) { pairs := map[string]int64{ "address A": 1000, @@ -1005,7 +1079,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic sendrawtransaction", + name: "basic", + cmd: "sendrawtransaction", f: func() (Cmd, error) { return NewSendRawTransactionCmd(testId, "hexstringofatx") @@ -1016,7 +1091,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic sendtoaddress", + name: "basic", + cmd: "sendtoaddress", f: func() (Cmd, error) { return NewSendToAddressCmd(testId, "somebtcaddress", @@ -1029,7 +1105,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic sendtoaddress plus optional", + name: "basic + optional", + cmd: "sendtoaddress", f: func() (Cmd, error) { return NewSendToAddressCmd(testId, "somebtcaddress", @@ -1046,7 +1123,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic setaccount", + name: "basic", + cmd: "setaccount", f: func() (Cmd, error) { return NewSetAccountCmd(testId, "somebtcaddress", @@ -1059,7 +1137,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic setgenerate", + name: "basic", + cmd: "setgenerate", f: func() (Cmd, error) { return NewSetGenerateCmd(testId, true) }, @@ -1069,7 +1148,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic setgenerate + optional", + name: "basic + optional", + cmd: "setgenerate", f: func() (Cmd, error) { return NewSetGenerateCmd(testId, true, 10) }, @@ -1080,7 +1160,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic settxfee", + name: "basic", + cmd: "settxfee", f: func() (Cmd, error) { return NewSetTxFeeCmd(testId, 10) }, @@ -1090,7 +1171,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic signmessage", + name: "basic", + cmd: "signmessage", f: func() (Cmd, error) { return NewSignMessageCmd(testId, "btcaddress", @@ -1103,7 +1185,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic signrawtransaction", + name: "basic", + cmd: "signrawtransaction", f: func() (Cmd, error) { return NewSignRawTransactionCmd(testId, "sometxstring") @@ -1114,7 +1197,8 @@ var jsoncmdtests = []struct { }, }, /* { - name: "basic signrawtransaction with optional", + name: "basic + optional", + cmd: "signrawtransaction", f: func() (Cmd, error) { return NewSignRawTransactionCmd(testId, "sometxstring", @@ -1145,7 +1229,8 @@ var jsoncmdtests = []struct { }, },*/ { - name: "basic stop", + name: "basic", + cmd: "stop", f: func() (Cmd, error) { return NewStopCmd(testId) }, @@ -1154,7 +1239,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic submitblock", + name: "basic", + cmd: "submitblock", f: func() (Cmd, error) { return NewSubmitBlockCmd(testId, "lotsofhex") @@ -1165,7 +1251,8 @@ var jsoncmdtests = []struct { }, }, { - name: "submitblock with optional object", + name: "+ optional object", + cmd: "submitblock", f: func() (Cmd, error) { return NewSubmitBlockCmd(testId, "lotsofhex", @@ -1178,7 +1265,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic validateaddress", + name: "basic", + cmd: "validateaddress", f: func() (Cmd, error) { return NewValidateAddressCmd(testId, "somebtcaddress") @@ -1189,7 +1277,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic verifychain", + name: "basic", + cmd: "verifychain", f: func() (Cmd, error) { return NewVerifyChainCmd(testId) }, @@ -1200,7 +1289,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic verifychain + optional", + name: "basic + optional", + cmd: "verifychain", f: func() (Cmd, error) { return NewVerifyChainCmd(testId, 4, 1) }, @@ -1211,7 +1301,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic verifymessage", + name: "basic", + cmd: "verifymessage", f: func() (Cmd, error) { return NewVerifyMessageCmd(testId, "someaddress", @@ -1226,7 +1317,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic walletlock", + name: "basic", + cmd: "walletlock", f: func() (Cmd, error) { return NewWalletLockCmd(testId) }, @@ -1235,7 +1327,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic walletpassphrase", + name: "basic", + cmd: "walletpassphrase", f: func() (Cmd, error) { return NewWalletPassphraseCmd(testId, "phrase1", @@ -1248,7 +1341,8 @@ var jsoncmdtests = []struct { }, }, { - name: "basic walletpassphrasechange", + name: "basic", + cmd: "walletpassphrasechange", f: func() (Cmd, error) { return NewWalletPassphraseChangeCmd(testId, "phrase1", "phrase2") @@ -1264,39 +1358,45 @@ var jsoncmdtests = []struct { func TestCmds(t *testing.T) { for _, test := range jsoncmdtests { c, err := test.f() + name := test.cmd + " " + test.name if err != nil { t.Errorf("%s: failed to run func: %v", - test.name, err) + name, err) continue } msg, err := json.Marshal(c) if err != nil { t.Errorf("%s: failed to marshal cmd: %v", - test.name, err) + name, err) continue } c2, err := ParseMarshaledCmd(msg) if err != nil { t.Errorf("%s: failed to ummarshal cmd: %v", - test.name, err) + name, err) continue } id, ok := (c.Id()).(float64) if !ok || id != testId { - t.Errorf("%s: id not returned properly", test.name) + t.Errorf("%s: id not returned properly", name) + } + + if c.Method() != test.cmd { + t.Errorf("%s: Method name not returned properly: "+ + "%s vs. %s", name, c.Method(), test.cmd) } if !reflect.DeepEqual(test.result, c2) { t.Errorf("%s: unmarshal not as expected. "+ - "got %v wanted %v", test.name, spew.Sdump(c2), + "got %v wanted %v", name, spew.Sdump(c2), spew.Sdump(test.result)) } if !reflect.DeepEqual(c, c2) { t.Errorf("%s: unmarshal not as we started with. "+ - "got %v wanted %v", test.name, spew.Sdump(c2), + "got %v wanted %v", name, spew.Sdump(c2), spew.Sdump(c)) } diff --git a/test_coverage.txt b/test_coverage.txt index 02a5122c..5e5cad11 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -5,231 +5,300 @@ github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.53% (77/86) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -237,45 +306,45 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) @@ -300,91 +369,22 @@ github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 72.56% (1949/2686) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 75.13% (2018/2686) From 5ced990c2234be842068a628ea025b5db9269a4c Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 6 Jan 2014 11:02:32 -0500 Subject: [PATCH 098/229] Add test for listsinceblock. Fix bug in listsinceblock found by test. --- jsoncmd.go | 2 +- jsoncmd_test.go | 35 +++++++++ test_coverage.txt | 180 +++++++++++++++++++++++----------------------- 3 files changed, 126 insertions(+), 91 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index b19f9a05..7dd3ac0f 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4371,7 +4371,7 @@ func NewListSinceBlockCmd(id interface{}, optArgs ...interface{}) (*ListSinceBlo blockhash = bh } if len(optArgs) > 1 { - tc, ok := optArgs[0].(int) + tc, ok := optArgs[1].(int) if !ok { return nil, errors.New("second optional argument targetconfirmations is not an int") } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 6f8ba515..225d2191 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -852,6 +852,41 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic", + cmd: "listsinceblock", + f: func() (Cmd, error) { + return NewListSinceBlockCmd(testId) + }, + result: &ListSinceBlockCmd{ + id: testId, + TargetConfirmations: 1, + }, + }, + { + name: "basic + 1 ops", + cmd: "listsinceblock", + f: func() (Cmd, error) { + return NewListSinceBlockCmd(testId, "someblockhash") + }, + result: &ListSinceBlockCmd{ + id: testId, + BlockHash: "someblockhash", + TargetConfirmations: 1, + }, + }, + { + name: "basic + 2 ops", + cmd: "listsinceblock", + f: func() (Cmd, error) { + return NewListSinceBlockCmd(testId, "someblockhash", 3) + }, + result: &ListSinceBlockCmd{ + id: testId, + BlockHash: "someblockhash", + TargetConfirmations: 3, + }, + }, { name: "basic", cmd: "listtransactions", diff --git a/test_coverage.txt b/test_coverage.txt index 5e5cad11..81529e09 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,50 +2,50 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) @@ -62,6 +62,8 @@ github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) @@ -108,11 +110,7 @@ github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) @@ -189,6 +187,8 @@ github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) @@ -243,59 +243,64 @@ github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1 github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.53% (77/86) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 90.70% (78/86) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) @@ -306,53 +311,53 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) @@ -365,26 +370,21 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 0.00% (0/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 75.13% (2018/2686) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 76.51% (2055/2686) From cea1120a0aef7d76a81008f47ee9809a08473ab1 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 7 Jan 2014 10:22:17 -0500 Subject: [PATCH 099/229] Add tests for listreceivebyaddress. Fix bug with minconf type caught by test (thanks oga). --- jsoncmd.go | 2 +- jsoncmd_test.go | 34 +++++++++ test_coverage.txt | 178 +++++++++++++++++++++++----------------------- 3 files changed, 124 insertions(+), 90 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 7dd3ac0f..814480e1 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4324,7 +4324,7 @@ func (cmd *ListReceivedByAddressCmd) UnmarshalJSON(b []byte) error { if !ok { return errors.New("first optional parameter minconf must be a number") } - optArgs = append(optArgs, minconf) + optArgs = append(optArgs, int(minconf)) } if len(r.Params) > 1 { includeempty, ok := r.Params[1].(bool) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 225d2191..d04bb1bb 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -852,6 +852,40 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic", + cmd: "listreceivedbyaddress", + f: func() (Cmd, error) { + return NewListReceivedByAddressCmd(testId) + }, + result: &ListReceivedByAddressCmd{ + id: testId, + MinConf: 1, + }, + }, + { + name: "basic + 1 opt", + cmd: "listreceivedbyaddress", + f: func() (Cmd, error) { + return NewListReceivedByAddressCmd(testId, 2) + }, + result: &ListReceivedByAddressCmd{ + id: testId, + MinConf: 2, + }, + }, + { + name: "basic + 2 opt", + cmd: "listreceivedbyaddress", + f: func() (Cmd, error) { + return NewListReceivedByAddressCmd(testId, 2, true) + }, + result: &ListReceivedByAddressCmd{ + id: testId, + MinConf: 2, + IncludeEmpty: true, + }, + }, { name: "basic", cmd: "listsinceblock", diff --git a/test_coverage.txt b/test_coverage.txt index 81529e09..b72cb0d7 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,51 +2,51 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) @@ -111,11 +111,7 @@ github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) @@ -187,6 +183,8 @@ github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) @@ -254,56 +252,63 @@ github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% ( github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 90.70% (78/86) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -312,52 +317,52 @@ github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/3 github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) @@ -370,21 +375,16 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 0.00% (0/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 0.00% (0/15) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 76.51% (2055/2686) +github.com/conformal/btcjson --------------------------------------- 77.89% (2092/2686) From ee378dc0c0003ca98852b80a069aa015ce33a138 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 7 Jan 2014 13:49:45 -0500 Subject: [PATCH 100/229] Add additional tests for listreceivedbyaccount. Fix bug caught by tests. --- jsoncmd.go | 2 +- jsoncmd_test.go | 23 ++++++ test_coverage.txt | 196 +++++++++++++++++++++++----------------------- 3 files changed, 122 insertions(+), 99 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 814480e1..3835a649 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4214,7 +4214,7 @@ func (cmd *ListReceivedByAccountCmd) UnmarshalJSON(b []byte) error { if !ok { return errors.New("first optional parameter minconf must be a number") } - optArgs = append(optArgs, minconf) + optArgs = append(optArgs, int(minconf)) } if len(r.Params) > 1 { includeempty, ok := r.Params[1].(bool) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index d04bb1bb..16af043b 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -852,6 +852,29 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic + 1 opt", + cmd: "listreceivedbyaccount", + f: func() (Cmd, error) { + return NewListReceivedByAccountCmd(testId, 2) + }, + result: &ListReceivedByAccountCmd{ + id: testId, + MinConf: 2, + }, + }, + { + name: "basic + 2 opt", + cmd: "listreceivedbyaccount", + f: func() (Cmd, error) { + return NewListReceivedByAccountCmd(testId, 2, true) + }, + result: &ListReceivedByAccountCmd{ + id: testId, + MinConf: 2, + IncludeEmpty: true, + }, + }, { name: "basic", cmd: "listreceivedbyaddress", diff --git a/test_coverage.txt b/test_coverage.txt index b72cb0d7..7a673aeb 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,52 +2,52 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) @@ -64,6 +64,10 @@ github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1 github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) @@ -112,7 +116,7 @@ github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) @@ -241,10 +245,6 @@ github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1 github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) @@ -257,55 +257,58 @@ github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) @@ -316,48 +319,47 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) @@ -369,8 +371,6 @@ github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) 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/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 47.62% (10/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 40.00% (6/15) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) @@ -378,13 +378,13 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 77.89% (2092/2686) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.41% (2106/2686) From d1efe0c10941ff3a994f35e0f15fee9e78c52e21 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 8 Jan 2014 09:29:10 -0500 Subject: [PATCH 101/229] Add SetId() to Cmd along with tests. --- jsoncmd.go | 366 ++++++++++++++++++++++++++++++++++++++ jsoncmd_test.go | 6 + test_coverage.txt | 443 +++++++++++++++++++++++++++------------------- 3 files changed, 630 insertions(+), 185 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 3835a649..7e5690c1 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -23,6 +23,7 @@ type Cmd interface { json.Marshaler json.Unmarshaler Id() interface{} + SetId(interface{}) Method() string } @@ -327,6 +328,11 @@ func (cmd *unparsableCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *unparsableCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *unparsableCmd) Method() string { return cmd.method @@ -397,6 +403,11 @@ func (cmd *AddMultisigAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *AddMultisigAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *AddMultisigAddressCmd) Method() string { return "addmultisigaddress" @@ -504,6 +515,11 @@ func (cmd *AddNodeCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *AddNodeCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *AddNodeCmd) Method() string { return "addnode" @@ -576,6 +592,11 @@ func (cmd *BackupWalletCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *BackupWalletCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *BackupWalletCmd) Method() string { return "backupwallet" @@ -645,6 +666,11 @@ func (cmd *CreateMultisigCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *CreateMultisigCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *CreateMultisigCmd) Method() string { return "createmultisig" @@ -793,6 +819,11 @@ func (cmd *CreateRawTransactionCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *CreateRawTransactionCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *CreateRawTransactionCmd) Method() string { return "createrawtransaction" @@ -870,6 +901,11 @@ func (cmd *DebugLevelCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *DebugLevelCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *DebugLevelCmd) Method() string { return "debuglevel" @@ -937,6 +973,11 @@ func (cmd *DecodeRawTransactionCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *DecodeRawTransactionCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *DecodeRawTransactionCmd) Method() string { return "decoderawtransaction" @@ -1004,6 +1045,11 @@ func (cmd *DecodeScriptCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *DecodeScriptCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *DecodeScriptCmd) Method() string { return "decodescript" @@ -1071,6 +1117,11 @@ func (cmd *DumpPrivKeyCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *DumpPrivKeyCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *DumpPrivKeyCmd) Method() string { return "dumpprivkey" @@ -1138,6 +1189,11 @@ func (cmd *DumpWalletCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *DumpWalletCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *DumpWalletCmd) Method() string { return "dumpwallet" @@ -1205,6 +1261,11 @@ func (cmd *EncryptWalletCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *EncryptWalletCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *EncryptWalletCmd) Method() string { return "encryptwallet" @@ -1272,6 +1333,11 @@ func (cmd *GetAccountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetAccountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAccountCmd) Method() string { return "getaccount" @@ -1339,6 +1405,11 @@ func (cmd *GetAccountAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetAccountAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAccountAddressCmd) Method() string { return "getaccountaddress" @@ -1418,6 +1489,11 @@ func (cmd *GetAddedNodeInfoCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetAddedNodeInfoCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAddedNodeInfoCmd) Method() string { return "getaddednodeinfo" @@ -1501,6 +1577,11 @@ func (cmd *GetAddressesByAccountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetAddressesByAccountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAddressesByAccountCmd) Method() string { return "getaddressesbyaccount" @@ -1593,6 +1674,11 @@ func (cmd *GetBalanceCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBalanceCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBalanceCmd) Method() string { return "getbalance" @@ -1677,6 +1763,11 @@ func (cmd *GetBestBlockHashCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBestBlockHashCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBestBlockHashCmd) Method() string { return "getbestblockhash" @@ -1761,6 +1852,11 @@ func (cmd *GetBlockCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBlockCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockCmd) Method() string { return "getblock" @@ -1860,6 +1956,11 @@ func (cmd *GetBlockCountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBlockCountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockCountCmd) Method() string { return "getblockcount" @@ -1922,6 +2023,11 @@ func (cmd *GetBlockHashCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBlockHashCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockHashCmd) Method() string { return "getblockhash" @@ -2006,6 +2112,11 @@ func (cmd *GetBlockTemplateCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBlockTemplateCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockTemplateCmd) Method() string { return "getblocktemplate" @@ -2108,6 +2219,11 @@ func (cmd *GetConnectionCountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetConnectionCountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetConnectionCountCmd) Method() string { return "getconnectioncount" @@ -2168,6 +2284,11 @@ func (cmd *GetDifficultyCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetDifficultyCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetDifficultyCmd) Method() string { return "getdifficulty" @@ -2228,6 +2349,11 @@ func (cmd *GetGenerateCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetGenerateCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetGenerateCmd) Method() string { return "getgenerate" @@ -2288,6 +2414,11 @@ func (cmd *GetHashesPerSecCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetHashesPerSecCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetHashesPerSecCmd) Method() string { return "gethashespersec" @@ -2348,6 +2479,11 @@ func (cmd *GetInfoCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetInfoCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetInfoCmd) Method() string { return "getinfo" @@ -2408,6 +2544,11 @@ func (cmd *GetMiningInfoCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetMiningInfoCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetMiningInfoCmd) Method() string { return "getmininginfo" @@ -2468,6 +2609,11 @@ func (cmd *GetNetTotalsCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetNetTotalsCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNetTotalsCmd) Method() string { return "getnettotals" @@ -2546,6 +2692,11 @@ func (cmd *GetNetworkHashPSCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetNetworkHashPSCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNetworkHashPSCmd) Method() string { return "getnetworkhashps" @@ -2644,6 +2795,11 @@ func (cmd *GetNewAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetNewAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNewAddressCmd) Method() string { return "getnewaddress" @@ -2718,6 +2874,11 @@ func (cmd *GetPeerInfoCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetPeerInfoCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetPeerInfoCmd) Method() string { return "getpeerinfo" @@ -2788,6 +2949,11 @@ func (cmd *GetRawChangeAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetRawChangeAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetRawChangeAddressCmd) Method() string { return "getrawchangeaddress" @@ -2871,6 +3037,11 @@ func (cmd *GetRawMempoolCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetRawMempoolCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetRawMempoolCmd) Method() string { return "getrawmempool" @@ -2957,6 +3128,11 @@ func (cmd *GetRawTransactionCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetRawTransactionCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetRawTransactionCmd) Method() string { return "getrawtransaction" @@ -3063,6 +3239,11 @@ func (cmd *GetReceivedByAccountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetReceivedByAccountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetReceivedByAccountCmd) Method() string { return "getreceivedbyaccount" @@ -3175,6 +3356,11 @@ func (cmd *GetReceivedByAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetReceivedByAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetReceivedByAddressCmd) Method() string { return "getreceivedbyaddress" @@ -3264,6 +3450,11 @@ func (cmd *GetTransactionCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetTransactionCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetTransactionCmd) Method() string { return "gettransaction" @@ -3345,6 +3536,11 @@ func (cmd *GetTxOutCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetTxOutCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetTxOutCmd) Method() string { return "gettxout" @@ -3432,6 +3628,11 @@ func (cmd *GetTxOutSetInfoCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetTxOutSetInfoCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetTxOutSetInfoCmd) Method() string { return "gettxoutsetinfo" @@ -3505,6 +3706,11 @@ func (cmd *GetWorkCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetWorkCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *GetWorkCmd) Method() string { return "getwork" @@ -3616,6 +3822,11 @@ func (cmd *HelpCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *HelpCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *HelpCmd) Method() string { return "help" @@ -3715,6 +3926,11 @@ func (cmd *ImportPrivKeyCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ImportPrivKeyCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ImportPrivKeyCmd) Method() string { return "importprivkey" @@ -3811,6 +4027,11 @@ func (cmd *ImportWalletCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ImportWalletCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ImportWalletCmd) Method() string { return "importwallet" @@ -3879,6 +4100,11 @@ func (cmd *KeyPoolRefillCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *KeyPoolRefillCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *KeyPoolRefillCmd) Method() string { return "keypoolrefill" @@ -3949,6 +4175,11 @@ func (cmd *ListAccountsCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListAccountsCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListAccountsCmd) Method() string { return "listaccounts" @@ -4023,6 +4254,11 @@ func (cmd *ListAddressGroupingsCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListAddressGroupingsCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListAddressGroupingsCmd) Method() string { return "listaddressgroupings" @@ -4084,6 +4320,11 @@ func (cmd *ListLockUnspentCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListLockUnspentCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListLockUnspentCmd) Method() string { return "listlockunspent" @@ -4170,6 +4411,11 @@ func (cmd *ListReceivedByAccountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListReceivedByAccountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListReceivedByAccountCmd) Method() string { return "listreceivedbyaccount" @@ -4280,6 +4526,11 @@ func (cmd *ListReceivedByAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListReceivedByAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListReceivedByAddressCmd) Method() string { return "listreceivedbyaddress" @@ -4390,6 +4641,11 @@ func (cmd *ListSinceBlockCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListSinceBlockCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListSinceBlockCmd) Method() string { return "listsinceblock" @@ -4511,6 +4767,11 @@ func (cmd *ListTransactionsCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListTransactionsCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListTransactionsCmd) Method() string { return "listtransactions" @@ -4622,6 +4883,11 @@ func (cmd *ListUnspentCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ListUnspentCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ListUnspentCmd) Method() string { return "listunspent" @@ -4721,6 +4987,11 @@ func (cmd *LockUnspentCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *LockUnspentCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *LockUnspentCmd) Method() string { return "lockunspent" @@ -4858,6 +5129,11 @@ func (cmd *MoveCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *MoveCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *MoveCmd) Method() string { return "move" @@ -4967,6 +5243,11 @@ func (cmd *PingCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *PingCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *PingCmd) Method() string { return "ping" @@ -5071,6 +5352,11 @@ func (cmd *SendFromCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SendFromCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SendFromCmd) Method() string { return "sendfrom" @@ -5223,6 +5509,11 @@ func (cmd *SendManyCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SendManyCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SendManyCmd) Method() string { return "sendmany" @@ -5343,6 +5634,11 @@ func (cmd *SendRawTransactionCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SendRawTransactionCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SendRawTransactionCmd) Method() string { return "sendrawtransaction" @@ -5441,6 +5737,11 @@ func (cmd *SendToAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SendToAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SendToAddressCmd) Method() string { return "sendtoaddress" @@ -5549,6 +5850,11 @@ func (cmd *SetAccountCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SetAccountCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SetAccountCmd) Method() string { return "setaccount" @@ -5636,6 +5942,11 @@ func (cmd *SetGenerateCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SetGenerateCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SetGenerateCmd) Method() string { return "setgenerate" @@ -5719,6 +6030,11 @@ func (cmd *SetTxFeeCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SetTxFeeCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SetTxFeeCmd) Method() string { return "settxfee" @@ -5796,6 +6112,11 @@ func (cmd *SignMessageCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SignMessageCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SignMessageCmd) Method() string { return "signmessage" @@ -5915,6 +6236,11 @@ func (cmd *SignRawTransactionCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SignRawTransactionCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SignRawTransactionCmd) Method() string { return "signrawtransaction" @@ -6067,6 +6393,11 @@ func (cmd *StopCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *StopCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *StopCmd) Method() string { return "stop" @@ -6147,6 +6478,11 @@ func (cmd *SubmitBlockCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *SubmitBlockCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *SubmitBlockCmd) Method() string { return "submitblock" @@ -6242,6 +6578,11 @@ func (cmd *ValidateAddressCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *ValidateAddressCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *ValidateAddressCmd) Method() string { return "validateaddress" @@ -6329,6 +6670,11 @@ func (cmd *VerifyChainCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *VerifyChainCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *VerifyChainCmd) Method() string { return "verifychain" @@ -6426,6 +6772,11 @@ func (cmd *VerifyMessageCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *VerifyMessageCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *VerifyMessageCmd) Method() string { return "verifymessage" @@ -6507,6 +6858,11 @@ func (cmd *WalletLockCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *WalletLockCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *WalletLockCmd) Method() string { return "walletlock" @@ -6573,6 +6929,11 @@ func (cmd *WalletPassphraseCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *WalletPassphraseCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *WalletPassphraseCmd) Method() string { return "walletpassphrase" @@ -6652,6 +7013,11 @@ func (cmd *WalletPassphraseChangeCmd) Id() interface{} { return cmd.id } +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *WalletPassphraseChangeCmd) SetId(id interface{}) { + cmd.id = id +} + // Method satisfies the Cmd interface by returning the json method. func (cmd *WalletPassphraseChangeCmd) Method() string { return "walletpassphrasechange" diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 16af043b..c0b53f44 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1491,6 +1491,12 @@ func TestCmds(t *testing.T) { "got %v wanted %v", name, spew.Sdump(c2), spew.Sdump(c)) } + newId := 2.0 + c.SetId(newId) + id, ok = (c.Id()).(float64) + if !ok || id != newId { + t.Errorf("%s: id not returned properly after change.", name) + } } } diff --git a/test_coverage.txt b/test_coverage.txt index 7a673aeb..bae79d2d 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -2,316 +2,388 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -319,52 +391,52 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) @@ -378,13 +450,14 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.41% (2106/2686) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.94% (2178/2759) From 6747e36f51b66494080899c3bbc5aff88c66b223 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Wed, 8 Jan 2014 10:31:54 -0500 Subject: [PATCH 102/229] Slight increase in test coverage. --- jsoncmd_test.go | 39 +++++++++ test_coverage.txt | 198 +++++++++++++++++++++++----------------------- 2 files changed, 138 insertions(+), 99 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index c0b53f44..2f22c8ce 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -636,6 +636,20 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic + opt", + cmd: "getreceivedbyaccount", + f: func() (Cmd, error) { + return NewGetReceivedByAccountCmd(testId, + "abtcaccount", + 2) + }, + result: &GetReceivedByAccountCmd{ + id: testId, + Account: "abtcaccount", + MinConf: 2, + }, + }, { name: "basic", cmd: "getreceivedbyaddress", @@ -650,6 +664,20 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic + opt", + cmd: "getreceivedbyaddress", + f: func() (Cmd, error) { + return NewGetReceivedByAddressCmd(testId, + "abtcaddress", + 2) + }, + result: &GetReceivedByAddressCmd{ + id: testId, + Address: "abtcaddress", + MinConf: 2, + }, + }, { name: "basic", cmd: "gettransaction", @@ -821,6 +849,17 @@ var jsoncmdtests = []struct { MinConf: 1, }, }, + { + name: "basic + opt", + cmd: "listaccounts", + f: func() (Cmd, error) { + return NewListAccountsCmd(testId, 2) + }, + result: &ListAccountsCmd{ + id: testId, + MinConf: 2, + }, + }, { name: "basic", cmd: "listaddressgroupings", diff --git a/test_coverage.txt b/test_coverage.txt index bae79d2d..f7af2f9f 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -5,52 +5,52 @@ github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) @@ -82,6 +82,16 @@ github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00 github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) @@ -131,9 +141,9 @@ github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) @@ -260,16 +270,6 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) @@ -330,60 +330,63 @@ github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% ( github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -391,56 +394,53 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 61.90% (13/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 61.90% (13/21) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 56.25% (9/16) 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/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) @@ -450,14 +450,14 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.94% (2178/2759) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 79.38% (2190/2759) From bf90ed21428dac774da33a6b965e46c54cb14d38 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 8 Jan 2014 23:49:06 -0600 Subject: [PATCH 103/229] Add 2014 to copyright dates. --- LICENSE | 2 +- doc.go | 2 +- internal_test.go | 2 +- jsonapi.go | 2 +- jsonapi_test.go | 2 +- jsoncmd.go | 2 +- jsoncmd_test.go | 2 +- jsonerr.go | 2 +- jsonfxns.go | 2 +- jsonfxns_test.go | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index 0d760cbb..992dd50d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013 Conformal Systems LLC. +Copyright (c) 2013-2014 Conformal Systems LLC. Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/doc.go b/doc.go index 418fdda7..30fca096 100644 --- a/doc.go +++ b/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/internal_test.go b/internal_test.go index e5eefd05..cf041f8f 100644 --- a/internal_test.go +++ b/internal_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsonapi.go b/jsonapi.go index 25d84e46..cf4ec150 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsonapi_test.go b/jsonapi_test.go index 319b78e2..8297a3ed 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsoncmd.go b/jsoncmd.go index 7e5690c1..571c1835 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 2f22c8ce..cce2a2e1 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsonerr.go b/jsonerr.go index d0ec83ca..e10b9416 100644 --- a/jsonerr.go +++ b/jsonerr.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsonfxns.go b/jsonfxns.go index f4479cf8..d87609c0 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. diff --git a/jsonfxns_test.go b/jsonfxns_test.go index 5f1b316a..2fa2f7c1 100644 --- a/jsonfxns_test.go +++ b/jsonfxns_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2013 Conformal Systems LLC. +// Copyright (c) 2013-2014 Conformal Systems LLC. // Use of this source code is governed by an ISC // license that can be found in the LICENSE file. From b677a421d067a87f66c359e9b2225d29e9d3adfb Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Wed, 8 Jan 2014 16:06:54 +0000 Subject: [PATCH 104/229] Add an interface to provide help text for supported commands. This changes the api to register new commands to also pass in the help text. --- cmdhelp.go | 766 ++++++++++++++++++++++++++++++++++++++++++++++++ jsoncmd.go | 15 +- jsoncmd_test.go | 93 ++++++ 3 files changed, 869 insertions(+), 5 deletions(-) create mode 100644 cmdhelp.go diff --git a/cmdhelp.go b/cmdhelp.go new file mode 100644 index 00000000..365efb96 --- /dev/null +++ b/cmdhelp.go @@ -0,0 +1,766 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "errors" +) + +// defaultHelpStrings contains the help text for all commands that are supported +// by btcjson by default. +var defaultHelpStrings = map[string]string{ + "addmultisigaddress": `addmultisigaddress nrequired ["key",...] ("account" ) +Add a multisignature address to the wallet where 'nrequired' signatures are +required for spending. Each key is an address of publickey. Optionally, account +may be provided to assign the address to that account.`, + + "addnode": `addnode "node" "{add|remove|onetry}" +Add or remove a node from the list of hosts we connect to. If mode is "onetry" +then the host will be connected to once only, otherwise the node will be retried +upon disconnection.`, + + "backupwallet": `backupwallet "destination" +Safely copies the wallet file to the destination provided, either a directory or +a filename.`, + + "createmultisig": `createmultisig nrequired ["key", ...] +Creates a multi-signature address with m keys where "nrequired" signatures are +required from those m. A JSON object is returned containing the address and +redemption script: +{ + "address":"address", # the value of the new address. + redeemScript":"script" # The stringified hex-encoded redemption script. +}`, + + "createrawtransaction": `createrawtransaction [{"txid":"id", "vout":n},...] {"address":amount,...} +Creates a transaction spending the given inputs and outputting to the +given addresses. The return is a hex encoded string of the raw +transaction with *unsigned* inputs. The transaction is not stored in any +wallet.`, + + // TODO(oga) this should be external since it is nonstandard. + "debuglevel": `debuglevel "levelspec" +Dynamically changes the debug logging level. Levelspec must be either a debug +level, one of the following: +trace, +debug, +info, +warn, +error, +critical. +Alternatively levelspec may be a specification of the form: +=,= +Where the valid subsystem names are: +AMGR, +BCDB, +BMGR, +BTCD, +CHAN, +DISC, +PEER, +RPCS, +SCRP, +SRVR, +TXMP. +Finally the keyword "show" will return a list of the available subsystems. +The command returns a string which will be "Done." if the command was sucessful, +or the list of subsystems if "show" was specified.`, + + "decoderawtransaction": `decoderawtransaction "hexstring" +Decodes the seralized, hex-encoded transaction in hexstring and returns a JSON +object representing it: +{ + "hex":"hex", # String of the hex encoded transaction provided. + "txid":"id", # The sha id of the transaction as a hex string + "version":n, # The version of the transaction as a number. + "locktime":t, # Locktime of the tx (number). + "vin": [ # Array of objects for inputs. + { + "txid":"id", # Txid that is spent. + "vout":n, # Output number. + "scriptSig": { + "asm":"asm", # Disasembled script as a string. + "hex":"hex", # Hex string of script. + }, + "sequence":n, # Sequence number of script. + } + ], + "vout": [ # Array of objects for outputs. + { + "value":x.xxx, # Value in BTC. + "n":n, # Numeric index. + "scriptPubkey": { # Object representing script. + "asm":"asm", # Disassembled script as string. + "hex":"hex", # Hex string of script. + "reqSigs":n, # Number of required signatures. + "type":"type" # Type as string, e.g. pubkeyhash. + }, + } + ] + "blockhash":"hash", # The block hash. as a string. + "confirmations":n # Number of confirmations in blockchain. + "time":t, # Transaction time in seconds since the epoch. + "blocktime":t, # Block time in seconds since the epoch. +}`, + + "decodescript": `decodescript "hex" +Decodes the hex encoded script passed as a string and returns a JSON object: +{ + "asm":"asm", # disassembled string of the script. + "hex":"hex", # hex string of the script. + "type":"type", # type of script as a string. + "reqSigs":n, # number of required signatures. + "addresses": [ # JSON array of address strings. + "address", # bitcoin address as a string. + ], + "p2sh","address" # script address as a string. +}`, + + "dumpprivkey": `dumpprivkey "bitcoinaddress" +Returns the private key corresponding to the provided address in a format +compatible with importprivkey.`, + + "dumpwallet": `dumpwallet "filename" +Dumps all wallet keys into "filename" in a human readable format.`, + + "encryptwallet": `encryptwallet "passphrase" +Encrypts the wallet with "passphrase". This command is for the initial +encryption of an otherwise unencrypted wallet, changing a passphrase +should use walletpassphrasechange.`, + + "getaccount": `getaccount "address" +Returns the account associated with the given "address" as a string.`, + + "getaccountaddress": `getaccountaddress "account" +Returns the current address used for receiving payments in this given account.`, + + "getaddednodeinfo": `getaddednodeinfo dns ( "node" ) +Returns a list of JSON objects with information about the local list of +permanent nodes. If dns is false, only a list of permanent nodes will +be provided, otherwise connected information will also be provided. If +node is not provided then all nodes will be detailed. The JSON return +format is as follows: +[ + { + "addednode":"1.2.3.4", # node ip address as a string + "connected":true|false # boolean connectionstate. + "addresses": [ + "address":"1.2.3.4:5678" # Bitcoin server host and port as a string. + "connected":"inbound", # The string "inbound" or "outbound". + ], + }, + ... +]`, + + "getaddressesbyaccount": `getaddressesbyaccount "account" +Returns the list of addresses for the given account: +[ + "address", # Bitcoin address associated with the given account. + ... +]`, + + "getbalance": `getbalance ("account" "minconf") +Returns the balance for an account. If "account" is not specified this is the +total balance for the server. if "minconf" is provided then only transactions +with at least "minconf" confirmations will be counted for the balance. The +result is a JSON numeric type.`, + + "getbestblockhash": `getbestblockhash +Returns the hash of the last block in the longest blockchain known to +the server as a hex encoded string.`, + + "getblock": `getblock "hash" ( verbose verbosetx=false) +Returns data about the block with hash "hash". If verbose is false a +string of hex-encoded data for the block is returned. If verbose is true +a JSON object is provided with the following: +{ + "hash":"hash", # The block hash (same as argument). + "confirmations":n, # Number of confirmations as numeric. + "size":n, # Block size as numeric. + "height":n, # Block height as numeric. + "version":n, # Block version as numeric. + "merkelroot":"...", # The merkle root of the block. + "tx" : [ # the transactions in the block as an array of strings. + "transactionid", + ... + ], + "time":t, # The block time in seconds since the epoch. + "nonce":n, # The nonce of the block as a number. + "bits":"1d00ffff", # the compact representation of the difficulty as bits. + "difficulty":n, # the difficulty of the block as a number. + "previousblockhash":"hash", # hash of the previous block as a string. + "nextblockhash":""hash", # hash of the next block as a string. +} +If "verbosetx" is true, the returned object will contain a "rawtx" member +instead of the "tx" member; It will contain objects representing the +transactions in the block in format used by getrawtransaction. +Please note that verbosetx is a btcd/btcjson extension.`, + + "getblockcount": `getblockcount +Returns a numeric for the number of blocks in the longest block chain.`, + + "getblockhash": `getblockhash index +Returns the hash of the block (as a string) at the given index in the +current blockchain.`, + + "getblocktemplate": `getblocktemplate ( jsonrequestobject ) +Returns a block template for external mining purposes. The optional +request object follows the following format: +{ + "mode":"template" # Optional, "template" or omitted. + "capabilities": [ # List of strings, optional. + "support", # Client side features supported. one of: + ... # "longpoll", "coinbasetxn", "coinbasevalue", + ... # "proposal", "serverlist", "workid". + ] +} +The result object is of the following format: +{ + "version":n, # Numeric block version. + "previousblockhash":"string" # Hash of the current tip of the blocktrain. + "transactions":[ + "data" # String of hex-encoded serialized transaction. + "hash" # Hex encoded hash of the tx. + "depends": [ # Array of numbers representing the transactions + n, # that must be included in the final block if + ..., # this one is. A 1 based index into the + ..., # transactions list. + ] + "fee":n # Numeric transaction fee in satoshi. This is calculated by the diffrence between the sum of inputs and outputs. For coinbase transaction this is a negative number of total collected block fees. If not present fee is unknown; clients must not assume that there is no fee in this case. + "sigops":n # Number of total signature operations calculated for purposes of block limits. If not present the count is unknown but clients must not assume it is zero. + "required":true|false # If provided and true this transaction *must* be in the final block. + ], + "coinbaseaux": { # Object of data to be included in coinbase's scriptSig. + "flags":"flags" # String of flags. + } + "coinbasevalue" # Numeric value in satoshi for maximum allowable input to coinbase transaction, including transaction fees and mining aware. + "coinbasetxn":{} # Object contining information for coinbase transaction. + "target":"target", # The hash target as a string. + "mintime":t, # Minimum timestamp appropriate for next block in seconds since the epoch. + "mutable":[ # Array of ways the template may be modified. + "value" # e.g. "time", "transactions", "prevblock", etc + ] + "noncerange":"00000000ffffffff" # Wtring representing the range of valid nonces. + "sigopliit" # Numeric limit for max sigops in block. + "sizelimit" # Numeric limit of block size. + "curtime":t # Current timestamp in seconds since the epoch. + "bits":"xxx", # Compressed target for next block as string. + "height":n, # Numeric height of the next block. +}`, + + "getconnectioncount": `getconnectioncount +Returns the number of connections to other nodes currently active as a JSON +number.`, + + "getdifficulty": `getdifficulty +Returns the proof-of-work difficulty as a JSON number. The result is a +multiple of the minimum difficulty.`, + + "getgenerate": `getgenerate +Returns JSON boolean whether or not the server is set to "mine" coins or not.`, + + "gethashespersec": `gethashespersec +Returns a JSON number representing a recent measurement of hashes-per-second +during mining.`, + + "getinfo": `getinfo +Returns a JSON object containing state information about the service: +{ + "version":n, # Numeric server version. + "protocolversion":n, # Numeric protocol version. + "walletversion":n, # Numeric wallet version. + "balance":n, # Total balance in the wallet as a number. + "blocks":n, # Numeric detailing current number of blocks. + "timeoffset":n, # Numeric server time offset. + "proxy":"host:port" # Optional string detailing the proxy in use. + "difficulty":n, # Current blockchain difficulty as a number. + "testnet":true|false # Boolean if the server is testnet. + "keypoololdest":t, # Oldest timstamp for pre generated keys. (in seconds since the epoch). + "keypoolsize":n, # Numeric size of the wallet keypool. + "paytxfee":n, # Numeric transaction fee that has been set. + "unlocked_until":t, # Numeric time the wallet is unlocked for in seconds since epoch. + "errors":"..." # Any error messages as a string. +}`, + + "getmininginfo": `getmininginfo +Returns a JSON object containing information related to mining: +{ + "blocks":n, # Numeric current block + "currentblocksize":n, # Numeric last block size. + currentblocktx":n, # Numeric last block transaction + "difficulty":n, # Numeric current difficulty. + "errors":"...", # Current error string. +}`, + + "getnettotals": `getnettotals +Returns JSON object containinng network traffic statistics: +{ + "totalbytesrecv":n, # Numeric total bytes received. + "totalbytessent":n, # Numeric total bytes sent. + "timemilis",t, # Total numeric cpu time. +}`, + + "getnetworkhashps": `getnetworkhashps ( blocks=120 height=-1 ) +Returns the estimated network hash rate per second based on the last +"blocks" blocks. If "blocks" is -1 then the number of blocks since the +last difficulty change will be used. If "height" is set then the +calculation will be carried out for the given block height instead of +the block tip. A JSON number is returned with the hashes per second +estimate.`, + + "getnewaddress": `getnewaddress ( "account" ) +Returns a string for a new Bitcoin address for receiving payments. In the case +that "account" is specified then the address will be for "account", else the +default account will be used.`, + + "getpeerinfo": `getpeerinfo +Returns a list of JSON objects containing information about each connected +network node. The objects have the following format: +[ + { + "addr":"host:port" # IP and port of the peer as a string. + "addrlocal":"ip:port" # Local address as a string. + "services":"00000001", # Services bitmask as a string. + "lastsend":t, # Time in seconds since epoch since last send. + "lastrecv":t, # Time in seconds since epoch since last received message. + "bytessent":n, # Total number of bytes sent. + "bytesrecv":n, # Total number of bytes received + "conntime":t, # Connection time in seconds since epoc. + "pingtime":n, # Ping time + "pingwait":n, # Ping wait. + "version":n, # The numeric peer version. + "subver":"/btcd:0.1/" # The peer useragent string. + "inbound":true|false, # True or false whether peer is inbound. + "startingheight":n, # Numeric block heght of peer at connect time. + "banscore":n, # The numeric ban score. + "syncnode":true|false, # Boolean if the peer is the current sync node. + } +]`, + "getrawchangeaddress": `getrawchangeaddress +Returns a string containing a new Bitcoin addres for receiving change. +This rpc call is for use with raw transactions only.`, + + "getrawmempool": `getrawmempool ( verbose ) +Returns the contents of the transaction memory pool as a JSON array. If +verbose is false just the transaction ids will be returned as strings. +If it is true then objects in the following format will be returned: +[ + "transactionid": { + "size":n, # Numeric transaction size in bytes. + "fee":n, # Numeric transqaction fee in btc. + "time":t, # Time transaction entered pool in seconds since the epoch. + "height":n, # Numeric block height when the transaction entered pool. + "startingpriority:n, # Numeric transaction priority when it entered the pool. + "currentpriority":n, # Numeric transaction priority. + "depends":[ # Unconfirmed transactions used as inputs for this one. As an array of strings. + "transactionid", # Parent transaction id. + ] + }, + ... +]`, + + "getrawtransaction": `getrawtransaction "txid" ( verbose ) +Returns raw data related to "txid". If verbose is false, a string containing +hex-encoded serialized data for txid. If verbose is true a JSON object with the +following information about txid is returned: +{ + "hex":"data", # String of serialized, hex encoded data for txid. + "txid":"id", # String containing the transaction id (same as "txid" parameter) + "version":n # Numeric tx version number. + "locktime":t, # Transaction locktime. + "vin":[ # Array of objects representing transaction inputs. + { + "txid":"id", # Spent transaction id as a string. + "vout""n, # Spent transaction output no. + "scriptSig":{ # Signature script as an object. + "asm":"asm", # Disassembled script string. + "hex":"hex", # Hex serialized string. + }, + "sequence":n, # Script sequence number. + }, + ... + ], + vout:[ # Array of objects representing transaction outputs. + { + "value":n, # Numeric value of output in btc. + "n", n, # Numeric output index. + "scriptPubKey":{ # Object representing pubkey script. + "asm":"asm" # Disassembled string of script. + "hex":"hex" # Hex serialized string. + "reqSigs":n, # Number of required signatures. + "type":"pubkey", # Type of scirpt. e.g. pubkeyhash" or "pubkey". + "addresses":[ # Array of address strings. + "address", # Bitcoin address. + ... + ], + } + } + ], + "blockhash":"hash" # Hash of the block the transaction is part of. + "confirmations":n, # Number of numeric confirmations of block. + "time":t, # Transaction time in seconds since the epoch. + "blocktime":t, # Block time in seconds since the epoch. +}`, + + "getreceivedbyaccount": `getreceivedbyaccount "account" ( minconf=1 ) +Returns the total amount of BTC received by addresses related to "account". +Only transactions with at least "minconf" confirmations are considered.`, + + "getreceivedbyaddress": `getreceivedbyaddress "address" ( minconf=1 ) +Returns the total amount of BTC received by the given address. Only transactions +with "minconf" confirmations will be used for the total.`, + + "gettransaction": `gettransaction "txid" +Returns a JSON object containing detailed information about the in-wallet +transaction "txid". The object follows the following format: +{ + "amount":n, # Transaction amount in BTC. + "confirmations":n, # Number of confirmations for transaction. + "blockhash":"hash", # Hash of block transaction is part of. + "blockindex":n, # Index of block transaction is part of. + "blocktime":t, # Time of block transaction is part of. + "txid":"id", # Transaction id. + "time":t, # Transaction time in seconds since epoch. + "timereceived":t, # Time transaction was received in seconds since epoch. + "details":[ + { + "account":"name", # The acount name involvedi n the transaction. "" means the default. + "address":"address", # The address involved in the transaction as a string. + "category":"send|recieve", # Category - either send or recieve. + "amount":n, # numeric amount in BTC. + } + ... + ] +}`, + + "gettxout": `gettxout "txid" n ( includemempool ) +Returns an object containing detauls about an unspent transaction output +the "n"th output of "txid": +{ + "bestblock":"hash", # Block has containing transaction. + "confirmations":n, # Number of confirmations for block. + "value":n # Transaction value in BTC. + scriptPubkey" { + "asm":"asm", # Disassembled string of script. + "hex":"hex", # String script serialized and hex encoded. + "reqSigs" # Numeric required signatures. + "type":"pubkeyhash" # Type of transaction. e.g. pubkeyhas + "addresses":[ # Array of strings containing addresses. + "address", + ... + ] + }, +}`, + + "gettxoutsetinfo": `gettxoutsetinfo +Returns an object containing startstics about the unspent transaction +output set: +{ + "height":n, # Numeric current block height. + "bestblock":"hex" # Hex string of best block hash. + "transactions":n, # Numeric count of transactions. + "txouts":n # Numeric count of transaction outputs. + "bytes_serialized":n # Numeric serialized size. + "hash_serialized" # String of serialized hash. + "total_amount":n, # Numeric total amount in BTC. +}`, + + "getwork": `getwork ( "data" ) +If "data" is present it is a hex encoded block datastruture that has been byte +reversed, if this is the case then the server will try to solve the +block and return true upon success, false upon failure. If data is not +specified the following object is returned to describe the work to be +solved: +{ + "midstate":"xxx", # String of precomputed hash state for the first half of the data (deprecated). + "data":"...", # Block data as string. + "hash1":"..." # Hash buffer for second hash as string. (deprecated). + "target":"...", # Byte reversed hash target. +}`, + + "help": `help ( "command" ) +With no arguemnts, lists the supported commands. If "command" is +specified then help text for that command is returned as a string.`, + + "importprivkey": `importprivkey "privkey" ( "label" rescan=true ) +Adds a private key (in the same format as dumpprivkey) to the wallet. If label +is provided this is used as a label for the key. If rescan is true then the +blockchain will be scanned for transaction.`, + + "importwallet": `importwallet "filename" +Imports keys from the wallet dump file in "filename".`, + + "keypoolrefill": `keypoolrefill ( newsize=100 ) +Refills the wallet pregenerated key pool to a size of "newsize"`, + + "listaccounts": `listaccounts ( minconf=1) +Returns a JSON object mapping account names to account balances: +{ + "accountname": n # Account name to numeric balance in BTC. + ... +}`, + + "listaddressgroupings": `listaddressgroupings +Returns a JSON array of array of addreses which have had their relation to each +other made public by common use as inputs or in the change address. The data +takes the following format: +[ + [ + [ + "address", # Bitcoin address. + amount, # Amount in BTC. + "account" # Optional account name string. + ], + ... + ], + ... +]`, + + "listlockunspent": `listlockunspent +Returns a JSON array of objects detailing transaction outputs that are +temporarily unspendable due to being processed by the lockunspent call. +[ + { + "txid":"txid" # Id of locked transaction as a string. + "vout":n, # Numeric index of locked output. + }, + ... +]`, + + "listreceivedbyaccount": `listreceivedbyaccount ( minconf=1 includeempty=false ) +Returns a JSON array containing objects for each account detailing their +balances. Only transaction with at least "minconf" confirmations will be +included. If "includeempty" is true then accounts who have received no payments +will also be included, else they will be elided. The format is as follows: +[ + { + "account":"name", # Name of the receiving account. + "amount":n, # Total received amount in BTC. + "confirmations":n, # Total confirmations for most recent transaction. + } +]`, + + "listreceivedbyaddress": `listreceivedbyaddress ( minconf=1 includeempty=false ) +Returns a JSON array containing objects for each address detailing their +balances. Only transaction with at least "minconf" confirmations will be +included. If "includeempty" is true then adresses who have received no payments +will also be included, else they will be elided. The format is as follows: +[ + { + "account":"name", # Name of the receiving account. + "amount":n, # Total received amount in BTC. + "confirmations":n, # Total confirmations for most recent transaction. + } +]`, + + "listsinceblock": `listsinceblock ("blockhash" minconf=1) +Gets all wallet transactions in block since "blockhash", if blockhash is +omitted then all transactions are provided. If present the only transactions +with "minconf" confirmations are listed. +{ + "transactions":[ + "account" # String of account related to the transaction. + "address" # String of related address of transaction. + "category":"send|receive" # String detailing whether transaction was a send or receive of funds. + "amount":n, # Numeric value of transaction. Negative if transaction category was "send" + "fee":n, # Numeric value of transaction fee in BTC. + "confirmations":n, # Number of transaction confirmations + "blockhash":"hash" # String of hash of block transaction is part of. + "blockindex":n, # Numeric index of block transaction is part of. + "blocktime":t, # Block time in seconds since the epoch. + "txid":"id", # Transaction id. + "time":t, # Transaction time in second since the epoch. + "timereceived":t, # Time transaction received in seconds since the epoch. + "comment":"...", # String of the comment associated with the transaction. + "to":"...", # String of "to" comment of the transaction. + ] + "lastblock":"lastblockhash" # Hash of the last block as a string. +}`, + + "listtransactions": `listtransactions ( "account" count=10 from=0 ) +Returns up to "count" most recent wallet transactions for "account" (or all +accounts if none specified) skipping the first "from" transactions. +{ + "transactions":[ + "account" # String of account related to the transaction. + "address" # String of related address of transaction. + "category":"send|receive|move" # String detailing whether transaction was a send or receive of funds.Move is a local move between accounts and doesnt touch the blockchain. + "amount":n, # Numeric value of transaction. Negative if transaction category was "send" + "fee":n, # Numeric value of transaction fee in BTC. + "confirmations":n, # Number of transaction confirmations + "blockhash":"hash" # String of hash of block transaction is part of. + "blockindex":n, # Numeric index of block transaction is part of. + "blocktime":t, # Block time in seconds since the epoch. + "txid":"id", # Transaction id. + "time":t, # Transaction time in second since the epoch. + "timereceived":t, # Time transaction received in seconds since the epoch. + "comment":"...", # String of the comment associated with the transaction. + "to":"...", # String of "to" comment of the transaction. + ] + "lastblock":"lastblockhash" # Hash of the last block as a string. +}`, + + "listunspent": `listunspent (minconf=1 maxconf=9999999 ["address",...] +Returns a JSON array of objects representing unspent transaction outputs with +between minconf and maxconf confirmations (inclusive). If the array of addresses +is present then only txouts paid to the addresses listed will be considered. The +objects take the following format: +[ + { + "txid":"id", # The transaction id as a string. + "vout":n, # The output number of the tx. + "address":"add", # String of the transaction address. + "account":"acc", # The associated account, "" for default. + "scriptPubkey":"key" # The pubkeyscript as a string. + "amount":n, # The value of the transaction in BTC. + "confirmations":n, # The numer of confirmations. + }, + ... +]`, + + "lockunspent": `lockunspent unlock [{"txid":id", "vout":n},...] +Changes the llist of temporarily unspendable transaction outputs. The +transacion outputs in the list of objects provided will be marked as +locked (if unlock is false) or unlocked (unlock is true). A locked +transaction will not be chosen automatically to be spent when a +tranaction is created. Boolean is returned whether the command succeeded.`, + + "move": `move "fromaccount" "toaccount" amount ( minconf=1 "comment" ) +Moves a specifies amount from "fromaccount" to "toaccount". Only funds +with minconf confirmations are used. If comment is present this comment +will be stored in the wallet with the transaction. Boolean is returned +to denode success.`, + + "ping": `ping +Queues a ping to be sent to each connected peer. Ping times are provided in +getpeerinfo.`, + + "sendfrom": `sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf=1 "comment" "comment-to" ) +Sends "amount" (rounded to the nearest 0.00000001) to +"tobitcoindaddress" from "fromaccount". Only funds with at least +"minconf" confirmations will be considered. If "comment" is present this +will be store the purpose of the transaction. If "comment-to" is present +this comment will be recorded locally to store the recipient of the +transaction.`, + + "sendmany": `sendmany "fromaccount" {"address":amount,...} ( minconf=1 "comment" ) +Sends funds to multiple recipients. Funds from "fromaccount" are send to the +address/amount pairs specified. Only funds with minconf confirmations are +considered. "comment" if present is recorded locally as the purpose of the +transaction.`, + + "sendrawtransaction": `sendrawtransaction "hexstring" (allowhighfees=false) +Submits the hex-encoded transaction in "hexstring" to the bitcoin network via +the local node. If allowhighfees is true then high fees will be allowed.`, + + "sendtoaddress": `sendtoaddress "bitcoindaddress" amount ( "comment" "comment-to") +Send "amount" BTC (rounded to the nearest 0.00000001) to "bitcoinaddress". If +comment is set, it will be stored locally to describe the purpose of the +transaction. If comment-to" is set it will be stored locally to describe the +recipient of the transaction. A string containing the transaction id is +returned if successful.`, + + "setaccount": `setaccount "address" "account" +Sets the account associated with "address" to "account".`, + + "setgenerate": `setgenerate generate ( genproclimit ) +Sets the current mining state to "generate". Up to "genproclimit" processors +will be used, if genproclimit is -1 then it is unlimited.`, + + "settxfee": `settxfee amount +Sets the current transaction fee.`, + + "signmessage": `signmessage "address" "message" +Returns a signature for "message" with the private key of "address"`, + + "signrawtransaction": `signrawtransaction "hexstring" ( prevtxs ["privatekey",...] sighashtype="ALL" ) +Signs the inputs for the serialized and hex encoded transaction in +"hexstring". "prevtxs" optionally is an is an array of objects +representing the previous tx outputs that are spent here but may not yet +be in the blockchain, it takes the following format: +[ + { + "txid":id:, # String of transaction id. + "vout":n, # Output number. + "scriptPubKey":"hex", # Hex encoded string of pubkey script from transaction. + "redemScript":"hex" # Hex encoded redemption script. + }, + ... +] +If the third argument is provided these base58-encoded private keys in +the list will be the only keys used to sign the transaction. sighashtype +optionally denoes the signature hash type to be used. is must be one of the +following: + "ALL", + "NONE", + "SINGLE", + "ALL|ANYONECANPAY", + "NONE|ANYONECANPAY", + "SINGLE|ANYONECANPAY". +The return value takes the following format: +{ + "hex":"value" # Hex string of raw transactino with signatures applied. + "complete":n, # If the transaction has a complete set of signatures. 0 if false. +}`, + + "stop": `stop +Stop the server.`, + + "submitblock": `submitblock "data" ( optionalparameterobject ) +Will attempt to submit the block serialized in "data" to the bitcoin network. +optionalparametersobject takes the following format: +{ + "workid":"id" # If getblocktemplate provided a workid it must be included with submissions. +}`, + + "validateaddress": `validateaddress "address +Returns a JSON objects containing information about the provided "address". +Format: +{ + "isvalid":true|false, # If the address is valid. If false this is the only property returned. + "address:"address", # The address that was validated. + "ismine":true|false, # If the address belongs to the server. + "isscript:true|false, # If the address is a script address. + "pubkey":"pk", # The hex value of the public key associated with the address. + "iscompressed":true|false, # If the address is compresssed. + "account":"account", # The related account. "" is the default. +}`, + + "verifychain": `verifychain ( checklevel=3 numblocks=288 ) +Verifies the stored blockchain database. "checklevel" denotes how thorough the +check is and "numblocks" how many blocks from the tip will be verified.`, + + "verifymessage": `verifymessage "bitcoinaddress" "signature" "message" +Verifies the signature "signature" for "message" from the key related +to "bitcoinaddress". The return is true or false if the signature +verified correctly.`, + + "walletlock": `walletlock +Removes any encryption key for the wallet from memory, unlocking the wallet. +In order to use wallet functionality again the wallet must be unlocked via +walletpassphrase.`, + + "walletpassphrase": `walletpassphrase "passphrase" timeout +Decrypts the wallet for "timeout" seconds with "passphrase". This is required +before using wallet functionality.`, + + "walletpassphrasechange": `walletpassphrasechange "oldpassphrase" "newpassphrase" +Changes the wallet passphrase from "oldpassphrase" to "newpassphrase".`, +} + +// GetHelpString returns a string containing help text for "cmdName". If +// cmdName is unknown to btcjson - either via the default command list or those +// registered using RegisterCustomCmd - an error will be returned. +func GetHelpString(cmdName string) (string, error) { + helpstr := "" + + if help, ok := defaultHelpStrings[cmdName]; ok { + return help, nil + } + if c, ok := customCmds[cmdName]; ok { + return c.helpString, nil + } + return helpstr, errors.New("Invalid command specified") +} diff --git a/jsoncmd.go b/jsoncmd.go index 571c1835..1cd8c4dd 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -40,12 +40,17 @@ type RawCmd struct { // ParseRawCmd is a function to create a custom Cmd from a RawCmd. type RawCmdParser func(*RawCmd) (Cmd, error) -var customCmds = make(map[string]RawCmdParser) +type cmd struct { + parser RawCmdParser + helpString string +} + +var customCmds = make(map[string]cmd) // RegisterCustomCmd registers a custom RawCmd parsing func for a // non-standard Bitcoin command. -func RegisterCustomCmd(method string, parser RawCmdParser) { - customCmds[method] = parser +func RegisterCustomCmd(method string, parser RawCmdParser, helpString string) { + customCmds[method] = cmd{parser: parser, helpString: helpString} } // ParseMarshaledCmd parses a raw command and unmarshals as a Cmd. @@ -286,8 +291,8 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { default: // None of the standard Bitcoin RPC methods matched. Try // registered custom commands. - if f, ok := customCmds[r.Method]; ok { - return f(&r) + if c, ok := customCmds[r.Method]; ok { + return c.parser(&r) } } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index cce2a2e1..de21a4ba 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -9,6 +9,7 @@ import ( "encoding/json" "github.com/davecgh/go-spew/spew" "reflect" + "strings" "testing" ) @@ -1539,3 +1540,95 @@ func TestCmds(t *testing.T) { } } + +func TestHelps(t *testing.T) { + helpTests := []string{ + "addmultisigaddress", + "addnode", + "backupwallet", + "createmultisig", + "createrawtransaction", + "debuglevel", + "decoderawtransaction", + "decodescript", + "dumpprivkey", + "dumpwallet", + "encryptwallet", + "getaccount", + "getaccountaddress", + "getaddednodeinfo", + "getaddressesbyaccount", + "getbalance", + "getbestblockhash", + "getblock", + "getblockcount", + "getblockhash", + "getblocktemplate", + "getconnectioncount", + "getdifficulty", + "getgenerate", + "gethashespersec", + "getinfo", + "getmininginfo", + "getnettotals", + "getnetworkhashps", + "getnewaddress", + "getpeerinfo", + "getrawchangeaddress", + "getrawmempool", + "getrawtransaction", + "getreceivedbyaccount", + "getreceivedbyaddress", + "gettransaction", + "gettxout", + "gettxoutsetinfo", + "getwork", + "help", + "importprivkey", + "importwallet", + "keypoolrefill", + "listaccounts", + "listaddressgroupings", + "listlockunspent", + "listreceivedbyaccount", + "listreceivedbyaddress", + "listsinceblock", + "listtransactions", + "listunspent", + "lockunspent", + "move", + "ping", + "sendfrom", + "sendmany", + "sendrawtransaction", + "sendtoaddress", + "setaccount", + "setgenerate", + "settxfee", + "signmessage", + "signrawtransaction", + "stop", + "submitblock", + "validateaddress", + "verifychain", + "verifymessage", + "walletlock", + "walletpassphrase", + "walletpassphrasechange", + } + + for _, test := range helpTests { + helpStr, err := GetHelpString(test) + if err != nil { + t.Errorf("%s: failed to get help string: %v", + test, err) + continue + } + + if !strings.HasPrefix(helpStr, test) { + t.Errorf("%s: help string doesn't begin with command "+ + "name: \"%s\"", test, helpStr) + continue + } + } +} From 5619604c212805ecc3a9a1ef82c57dacdcdb81a2 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 17 Jan 2014 17:04:49 +0000 Subject: [PATCH 105/229] Add addresses member to ListUnspentCmd --- jsoncmd.go | 66 +++++++++++--- jsoncmd_test.go | 15 ++++ test_coverage.txt | 223 +++++++++++++++++++++++----------------------- 3 files changed, 179 insertions(+), 125 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 1cd8c4dd..9196629b 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4853,9 +4853,10 @@ func (cmd *ListTransactionsCmd) UnmarshalJSON(b []byte) error { // ListUnspentCmd is a type handling custom marshaling and // unmarshaling of listunspent JSON RPC commands. type ListUnspentCmd struct { - id interface{} - MinConf int - MaxConf int + id interface{} + MinConf int + MaxConf int + Addresses []string } // Enforce that ListUnspentCmd satisifies the Cmd interface. @@ -4863,23 +4864,40 @@ var _ Cmd = &ListUnspentCmd{} // NewListUnspentCmd creates a new ListUnspentCmd. Optionally a // pointer to a TemplateRequest may be provided. -func NewListUnspentCmd(id interface{}, optArgs ...int) (*ListUnspentCmd, error) { +func NewListUnspentCmd(id interface{}, optArgs ...interface{}) (*ListUnspentCmd, error) { minconf := 1 maxconf := 999999 + var addresses []string - if len(optArgs) > 2 { + if len(optArgs) > 3 { return nil, ErrWrongNumberOfParams } if len(optArgs) > 0 { - minconf = optArgs[0] + m, ok := optArgs[0].(int) + if !ok { + return nil, errors.New("first optional argument minconf is not an int") + } + minconf = m } if len(optArgs) > 1 { - maxconf = optArgs[1] + m, ok := optArgs[1].(int) + if !ok { + return nil, errors.New("second optional argument maxconf is not an int") + } + maxconf = m + } + if len(optArgs) > 2 { + a, ok := optArgs[2].([]string) + if !ok { + return nil, errors.New("third optional argument addresses is not an array of strings") + } + addresses = a } return &ListUnspentCmd{ - id: id, - MinConf: minconf, - MaxConf: maxconf, + id: id, + MinConf: minconf, + MaxConf: maxconf, + Addresses: addresses, }, nil } @@ -4907,14 +4925,18 @@ func (cmd *ListUnspentCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{}, } - if cmd.MinConf != 1 || cmd.MaxConf != 99999 { + if cmd.MinConf != 1 || cmd.MaxConf != 99999 || len(cmd.Addresses) != 0 { raw.Params = append(raw.Params, cmd.MinConf) } - if cmd.MaxConf != 99999 { + if cmd.MaxConf != 99999 || len(cmd.Addresses) != 0 { raw.Params = append(raw.Params, cmd.MaxConf) } + if len(cmd.Addresses) != 0 { + raw.Params = append(raw.Params, cmd.Addresses) + } + return json.Marshal(raw) } @@ -4927,11 +4949,11 @@ func (cmd *ListUnspentCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) > 2 { + if len(r.Params) > 3 { return ErrWrongNumberOfParams } - optArgs := make([]int, 0, 2) + optArgs := make([]interface{}, 0, 3) if len(r.Params) > 0 { minconf, ok := r.Params[0].(float64) if !ok { @@ -4946,6 +4968,22 @@ func (cmd *ListUnspentCmd) UnmarshalJSON(b []byte) error { } optArgs = append(optArgs, int(maxconf)) } + if len(r.Params) > 2 { + iaddr, ok := r.Params[2].([]interface{}) + if !ok { + return errors.New("third optional parameter addresses must be an array") + } + + addr := make([]string, len(iaddr)) + for i, val := range iaddr { + addr[i], ok = val.(string) + if !ok { + return errors.New("optional parameter addreses must be an array of strings") + } + } + + optArgs = append(optArgs, addr) + } newCmd, err := NewListUnspentCmd(r.Id, optArgs...) if err != nil { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index de21a4ba..9be151d7 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1060,6 +1060,21 @@ var jsoncmdtests = []struct { MaxConf: 6, }, }, + { + name: "basic + opts + addresses", + cmd: "listunspent", + f: func() (Cmd, error) { + return NewListUnspentCmd(testId, 0, 6, []string{ + "a", "b", "c", + }) + }, + result: &ListUnspentCmd{ + id: testId, + MinConf: 0, + MaxConf: 6, + Addresses: []string{"a", "b", "c"}, + }, + }, { name: "basic", cmd: "lockunspent", diff --git a/test_coverage.txt b/test_coverage.txt index f7af2f9f..cc9e128b 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -3,54 +3,54 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) @@ -70,7 +70,6 @@ github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% ( github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) @@ -87,12 +86,7 @@ github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) @@ -144,6 +138,8 @@ github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/ github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) @@ -172,8 +168,6 @@ github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) @@ -270,6 +264,12 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) @@ -292,6 +292,7 @@ github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) @@ -327,66 +328,65 @@ github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -394,45 +394,45 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) @@ -443,6 +443,7 @@ github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/ github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) 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/jsoncmd.go GetHelpString 50.00% (3/6) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) @@ -450,14 +451,14 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 79.38% (2190/2759) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 79.31% (2212/2789) From 99fdcf5d0972416b92503ebbda974bf4a72fccd9 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 17 Jan 2014 17:11:35 +0000 Subject: [PATCH 106/229] Add allowhighfees to SendRawTransactionCmd --- jsoncmd.go | 36 ++++++++++--- jsoncmd_test.go | 25 +++++++++ test_coverage.txt | 132 +++++++++++++++++++++++----------------------- 3 files changed, 120 insertions(+), 73 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 9196629b..1dab08b3 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -5655,8 +5655,9 @@ func (cmd *SendManyCmd) UnmarshalJSON(b []byte) error { // SendRawTransactionCmd is a type handling custom marshaling and // unmarshaling of sendrawtransaction JSON RPC commands. type SendRawTransactionCmd struct { - id interface{} - HexTx string + id interface{} + HexTx string + AllowHighFees bool } // Enforce that SendRawTransactionCmd satisifies the Cmd interface. @@ -5664,11 +5665,19 @@ var _ Cmd = &SendRawTransactionCmd{} // NewSendRawTransactionCmd creates a new SendRawTransactionCmd. Optionally a // pointer to a TemplateRequest may be provided. -func NewSendRawTransactionCmd(id interface{}, hextx string) (*SendRawTransactionCmd, error) { +func NewSendRawTransactionCmd(id interface{}, hextx string, optArgs ...bool) (*SendRawTransactionCmd, error) { + allowHighFees := false + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + if len(optArgs) == 1 { + allowHighFees = optArgs[0] + } return &SendRawTransactionCmd{ - id: id, - HexTx: hextx, + id: id, + HexTx: hextx, + AllowHighFees: allowHighFees, }, nil } @@ -5698,6 +5707,10 @@ func (cmd *SendRawTransactionCmd) MarshalJSON() ([]byte, error) { }, } + if cmd.AllowHighFees { + raw.Params = append(raw.Params, cmd.AllowHighFees) + } + return json.Marshal(raw) } @@ -5710,7 +5723,7 @@ func (cmd *SendRawTransactionCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) != 1 { + if len(r.Params) > 2 || len(r.Params) < 1 { return ErrWrongNumberOfParams } @@ -5719,7 +5732,16 @@ func (cmd *SendRawTransactionCmd) UnmarshalJSON(b []byte) error { return errors.New("first parameter hextx must be a string") } - newCmd, err := NewSendRawTransactionCmd(r.Id, hextx) + optArgs := make([]bool, 0, 1) + if len(r.Params) > 1 { + allowHighFees, ok := r.Params[1].(bool) + if !ok { + return errors.New("second optional parameter allowhighfees must be a bool") + } + optArgs = append(optArgs, allowHighFees) + } + + newCmd, err := NewSendRawTransactionCmd(r.Id, hextx, optArgs...) if err != nil { return err } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 9be151d7..1f56d6b2 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1237,6 +1237,31 @@ var jsoncmdtests = []struct { HexTx: "hexstringofatx", }, }, + { + name: "allowhighfees: false", + cmd: "sendrawtransaction", + f: func() (Cmd, error) { + return NewSendRawTransactionCmd(testId, + "hexstringofatx", false) + }, + result: &SendRawTransactionCmd{ + id: testId, + HexTx: "hexstringofatx", + }, + }, + { + name: "allowhighfees: true", + cmd: "sendrawtransaction", + f: func() (Cmd, error) { + return NewSendRawTransactionCmd(testId, + "hexstringofatx", true) + }, + result: &SendRawTransactionCmd{ + id: testId, + HexTx: "hexstringofatx", + AllowHighFees: true, + }, + }, { name: "basic", cmd: "sendtoaddress", diff --git a/test_coverage.txt b/test_coverage.txt index cc9e128b..16d33bf5 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -19,21 +19,20 @@ github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 1 github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) @@ -46,11 +45,12 @@ github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) @@ -138,6 +138,8 @@ github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/ github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) @@ -209,7 +211,6 @@ github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) @@ -331,61 +332,61 @@ github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% ( github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) @@ -394,45 +395,44 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) @@ -451,14 +451,14 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 79.31% (2212/2789) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 79.34% (2223/2802) From 3c1bcb86ee5966b8a5396d1646deb1f91e731c71 Mon Sep 17 00:00:00 2001 From: "Owain G. Ainsworth" Date: Fri, 17 Jan 2014 17:18:34 +0000 Subject: [PATCH 107/229] add newsize parameter to keypoolrefill --- jsoncmd.go | 34 +++++++++++-- jsoncmd_test.go | 11 ++++ test_coverage.txt | 124 +++++++++++++++++++++++----------------------- 3 files changed, 102 insertions(+), 67 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 1dab08b3..63abfbbe 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4086,7 +4086,8 @@ func (cmd *ImportWalletCmd) UnmarshalJSON(b []byte) error { // KeyPoolRefillCmd is a type handling custom marshaling and // unmarshaling of keypoolrefill JSON RPC commands. type KeyPoolRefillCmd struct { - id interface{} + id interface{} + NewSize uint } // Enforce that KeyPoolRefillCmd satisifies the Cmd interface. @@ -4094,9 +4095,19 @@ var _ Cmd = &KeyPoolRefillCmd{} // NewKeyPoolRefillCmd creates a new KeyPoolRefillCmd. Optionally a // pointer to a TemplateRequest may be provided. -func NewKeyPoolRefillCmd(id interface{}) (*KeyPoolRefillCmd, error) { +func NewKeyPoolRefillCmd(id interface{}, optArgs ...uint) (*KeyPoolRefillCmd, error) { + newSize := uint(0) + + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + newSize = optArgs[0] + } + return &KeyPoolRefillCmd{ - id: id, + id: id, + NewSize: newSize, }, nil } @@ -4124,6 +4135,10 @@ func (cmd *KeyPoolRefillCmd) MarshalJSON() ([]byte, error) { Params: []interface{}{}, } + if cmd.NewSize != 0 { + raw.Params = append(raw.Params, cmd.NewSize) + } + return json.Marshal(raw) } @@ -4136,11 +4151,20 @@ func (cmd *KeyPoolRefillCmd) UnmarshalJSON(b []byte) error { return err } - if len(r.Params) > 0 { + if len(r.Params) > 1 { return ErrWrongNumberOfParams } - newCmd, err := NewKeyPoolRefillCmd(r.Id) + optArgs := make([]uint, 0, 1) + if len(r.Params) > 0 { + newsize, ok := r.Params[0].(float64) + if !ok { + return errors.New("first optional parameter newsize must be a number") + } + optArgs = append(optArgs, uint(newsize)) + } + + newCmd, err := NewKeyPoolRefillCmd(r.Id, optArgs...) if err != nil { return err } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 1f56d6b2..282e5ebd 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -839,6 +839,17 @@ var jsoncmdtests = []struct { id: testId, }, }, + { + name: "newsize", + cmd: "keypoolrefill", + f: func() (Cmd, error) { + return NewKeyPoolRefillCmd(testId, 1000000) + }, + result: &KeyPoolRefillCmd{ + id: testId, + NewSize: 1000000, + }, + }, { name: "basic", cmd: "listaccounts", diff --git a/test_coverage.txt b/test_coverage.txt index 16d33bf5..f4a9f732 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -23,18 +23,17 @@ github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100. github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) @@ -45,12 +44,13 @@ github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) @@ -138,6 +138,8 @@ github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/ github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) @@ -167,7 +169,6 @@ github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) @@ -330,64 +331,64 @@ github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) @@ -396,43 +397,42 @@ github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/3 github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) @@ -451,14 +451,14 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 79.34% (2223/2802) +github.com/conformal/btcjson --------------------------------------- 79.36% (2234/2815) From 908945ed53d102a8627d90b5c0e5ac685c94e017 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 23 Jan 2014 15:55:52 -0500 Subject: [PATCH 108/229] fix getwork API closes #12 --- jsoncmd.go | 20 ++++++++++++++------ jsoncmd_test.go | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 63abfbbe..5224d948 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3691,7 +3691,7 @@ type WorkRequest struct { // unmarshaling of getwork JSON RPC commands. type GetWorkCmd struct { id interface{} - Request WorkRequest + Request *WorkRequest } // Enforce that GetWorkCmd satisifies the Cmd interface. @@ -3699,7 +3699,14 @@ var _ Cmd = &GetWorkCmd{} // NewGetWorkCmd creates a new GetWorkCmd. Optionally a // pointer to a TemplateRequest may be provided. -func NewGetWorkCmd(id interface{}, request WorkRequest) (*GetWorkCmd, error) { +func NewGetWorkCmd(id interface{}, optArgs ...*WorkRequest) (*GetWorkCmd, error) { + var request *WorkRequest + if len(optArgs) > 0 { + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + request = optArgs[0] + } return &GetWorkCmd{ id: id, Request: request, @@ -3727,9 +3734,10 @@ func (cmd *GetWorkCmd) MarshalJSON() ([]byte, error) { Jsonrpc: "1.0", Method: "getwork", Id: cmd.id, - Params: []interface{}{ - cmd.Request, - }, + Params: []interface{}{}, + } + if cmd.Request != nil { + raw.Params = append(raw.Params, cmd.Request) } return json.Marshal(raw) @@ -3786,7 +3794,7 @@ func (cmd *GetWorkCmd) UnmarshalJSON(b []byte) error { wrequest.Algorithm = salgo } - newCmd, err := NewGetWorkCmd(r.Id, *wrequest) + newCmd, err := NewGetWorkCmd(r.Id, wrequest) if err != nil { return err } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 282e5ebd..e8385ad3 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -736,7 +736,7 @@ var jsoncmdtests = []struct { cmd: "getwork", f: func() (Cmd, error) { return NewGetWorkCmd(testId, - WorkRequest{ + &WorkRequest{ Data: "some data", Target: "our target", Algorithm: "algo", @@ -744,7 +744,7 @@ var jsoncmdtests = []struct { }, result: &GetWorkCmd{ id: testId, - Request: WorkRequest{ + Request: &WorkRequest{ Data: "some data", Target: "our target", Algorithm: "algo", From 4a93564b0489530a084efeedcc1359aa2f854a53 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 23 Jan 2014 17:30:44 -0500 Subject: [PATCH 109/229] Add getwork result infrastructure. Make the work request optional. --- jsonapi.go | 14 +++++++++++ jsoncmd.go | 73 +++++++++++++++++++++++++++--------------------------- 2 files changed, 50 insertions(+), 37 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index cf4ec150..b0514929 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -173,6 +173,14 @@ type GetMiningInfoResult struct { HashesPerSec float64 `json:"hashespersec"` } +// GetWorkResult models the data from the getwork command. +type GetWorkResult struct { + Data string `json:"data"` + Hash1 string `json:"hash1"` + Midstate string `json:"midstate"` + Target string `json:"target"` +} + // ValidateAddressResult models the data from the validateaddress command. type ValidateAddressResult struct { IsValid bool `json:"isvalid"` @@ -872,6 +880,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "getwork": + var res GetWorkResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "validateaddress": var res ValidateAddressResult err = json.Unmarshal(objmap["result"], &res) diff --git a/jsoncmd.go b/jsoncmd.go index 5224d948..55b44c0a 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3751,49 +3751,48 @@ func (cmd *GetWorkCmd) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &r); err != nil { return err } - - if len(r.Params) != 1 { + if len(r.Params) > 1 { return ErrWrongNumberOfParams } - - rmap, ok := r.Params[0].(map[string]interface{}) - if !ok { - return errors.New("first optional parameter template request must be an object") - } - wrequest := new(WorkRequest) - // data is required - data, ok := rmap["data"] - if !ok { - return errors.New("WorkRequest data must be present") - } - sdata, ok := data.(string) - if !ok { - return errors.New("WorkRequest data must be a string") - } - wrequest.Data = sdata - - // target is required - target, ok := rmap["target"] - if !ok { - return errors.New("WorkRequest target must be present") - } - starget, ok := target.(string) - if !ok { - return errors.New("WorkRequest target must be a string") - } - wrequest.Target = starget - - // algorithm is optional - algo, ok := rmap["algorithm"] - if ok { - salgo, ok := algo.(string) + if len(r.Params) == 1 { + rmap, ok := r.Params[0].(map[string]interface{}) if !ok { - return errors.New("WorkRequest algorithm must be a string") + return errors.New("first optional parameter template request must be an object") } - wrequest.Algorithm = salgo - } + // data is required + data, ok := rmap["data"] + if !ok { + return errors.New("WorkRequest data must be present") + } + sdata, ok := data.(string) + if !ok { + return errors.New("WorkRequest data must be a string") + } + wrequest.Data = sdata + + // target is required + target, ok := rmap["target"] + if !ok { + return errors.New("WorkRequest target must be present") + } + starget, ok := target.(string) + if !ok { + return errors.New("WorkRequest target must be a string") + } + wrequest.Target = starget + + // algorithm is optional + algo, ok := rmap["algorithm"] + if ok { + salgo, ok := algo.(string) + if !ok { + return errors.New("WorkRequest algorithm must be a string") + } + wrequest.Algorithm = salgo + } + } newCmd, err := NewGetWorkCmd(r.Id, wrequest) if err != nil { return err From 421f4c54a057f52e272c30513db66c2ebf3d1de2 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 24 Jan 2014 13:34:03 -0600 Subject: [PATCH 110/229] Add support for GetAddedNodeInfoResult. ok @jcvernaleo. --- jsonapi.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index b0514929..9ae4153d 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -207,6 +207,20 @@ type ListUnSpentResult struct { Confirmations float64 `json:"confirmations"` } +// GetAddedNodeInfoResultAddr models the data of the addresses portion of the +// getaddednodeinfo command. +type GetAddedNodeInfoResultAddr struct { + Address string `json:"address"` + Connected string `json:"connected"` +} + +// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. +type GetAddedNodeInfoResult struct { + AddedNode string `json:"addednode"` + Connected *bool `json:"connected,omitempty"` + Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` +} + // Error models the error field of the json returned by a bitcoin client. When // there is no error, this should be a nil pointer to produce the null in the // json that bitcoind produces. @@ -822,6 +836,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // generate put the results in the proper structure. // We handle the error condition after the switch statement. switch cmd { + case "getaddednodeinfo": + var res []GetAddedNodeInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getinfo": var res InfoResult err = json.Unmarshal(objmap["result"], &res) From 6e2fa5aad7d966f7d22a05bb92fb15ff0e153229 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 24 Jan 2014 22:37:18 -0600 Subject: [PATCH 111/229] Allow getaddednodeinfo result to be string slice. The getaddednode command dns flag alters the output. It is a JSON object when true and a slice of strings containing the addresses when false. Note there is a bug in bitcoind as of version 0.8.6 which returns the addresses as a JSON object with duplicate keys. This has been reported as issue 3581 on the bitcoind issue tracker. This commit allows the result for getaddednodeinfo to be either the JSON object or the string slice. --- jsonapi.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index 9ae4153d..c15cab61 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -837,7 +837,15 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // We handle the error condition after the switch statement. switch cmd { case "getaddednodeinfo": - var res []GetAddedNodeInfoResult + // getaddednodeinfo can either return a JSON object or a + // slice of strings depending on the verbose flag. Choose the + // right form accordingly. + var res interface{} + if strings.Contains(string(objmap["result"]), "{") { + res = []GetAddedNodeInfoResult{} + } else { + res = []string{} + } err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res From cbe4b140b9ccca2918a9e9e9a7138256b6721f2e Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 29 Jan 2014 21:19:07 -0500 Subject: [PATCH 112/229] Change the optional parameter for getrawtransaction from bool to int. This matches bitcoind. ok oga@ --- jsoncmd.go | 16 ++++++++-------- jsoncmd_test.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 55b44c0a..154ff139 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3105,15 +3105,15 @@ func (cmd *GetRawMempoolCmd) UnmarshalJSON(b []byte) error { type GetRawTransactionCmd struct { id interface{} Txid string - Verbose bool + Verbose int } // Enforce that GetRawTransactionCmd satisifies the Cmd interface. var _ Cmd = &GetRawTransactionCmd{} // NewGetRawTransactionCmd creates a new GetRawTransactionCmd. -func NewGetRawTransactionCmd(id interface{}, txid string, optArgs ...bool) (*GetRawTransactionCmd, error) { - var verbose bool +func NewGetRawTransactionCmd(id interface{}, txid string, optArgs ...int) (*GetRawTransactionCmd, error) { + var verbose int if len(optArgs) > 0 { if len(optArgs) > 1 { return nil, ErrTooManyOptArgs @@ -3155,7 +3155,7 @@ func (cmd *GetRawTransactionCmd) MarshalJSON() ([]byte, error) { }, } - if cmd.Verbose { + if cmd.Verbose != 0 { raw.Params = append(raw.Params, cmd.Verbose) } return json.Marshal(raw) @@ -3179,14 +3179,14 @@ func (cmd *GetRawTransactionCmd) UnmarshalJSON(b []byte) error { return errors.New("first parameter txid must be a string") } - optArgs := make([]bool, 0, 1) + optArgs := make([]int, 0, 1) if len(r.Params) == 2 { - verbose, ok := r.Params[1].(bool) + verbose, ok := r.Params[1].(float64) if !ok { - return errors.New("second optional parameter verbose must be a bool") + return errors.New("second optional parameter verbose must be a number") } - optArgs = append(optArgs, verbose) + optArgs = append(optArgs, int(verbose)) } newCmd, err := NewGetRawTransactionCmd(r.Id, txid, optArgs...) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index e8385ad3..2378f7f7 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -615,12 +615,12 @@ var jsoncmdtests = []struct { f: func() (Cmd, error) { return NewGetRawTransactionCmd(testId, "sometxid", - true) + 1) }, result: &GetRawTransactionCmd{ id: testId, Txid: "sometxid", - Verbose: true, + Verbose: 1, }, }, { From ced679c4e5c99c07c9a74227f0afd0b5a59779b0 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 30 Jan 2014 11:48:27 -0500 Subject: [PATCH 113/229] Fix getreceivedby[account|address] api. The first parameter is not optional. --- jsoncmd.go | 88 +++++++++++++++--------------------------------------- 1 file changed, 24 insertions(+), 64 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 154ff139..e2a08da4 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3210,27 +3210,13 @@ type GetReceivedByAccountCmd struct { var _ Cmd = &GetReceivedByAccountCmd{} // NewGetReceivedByAccountCmd creates a new GetReceivedByAccountCmd. -func NewGetReceivedByAccountCmd(id interface{}, optArgs ...interface{}) (*GetReceivedByAccountCmd, error) { - if len(optArgs) > 2 { +func NewGetReceivedByAccountCmd(id interface{}, account string, optArgs ...int) (*GetReceivedByAccountCmd, error) { + if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - var account string - if len(optArgs) > 0 { - a, ok := optArgs[0].(string) - if !ok { - return nil, errors.New("first optional argument account is not a string") - } - - account = a - } var minconf int = 1 - if len(optArgs) > 1 { - m, ok := optArgs[1].(int) - if !ok { - return nil, errors.New("second optional argument minconf is not a int") - } - minconf = m - + if len(optArgs) > 0 { + minconf = optArgs[0] } return &GetReceivedByAccountCmd{ id: id, @@ -3261,11 +3247,9 @@ func (cmd *GetReceivedByAccountCmd) MarshalJSON() ([]byte, error) { Jsonrpc: "1.0", Method: "getreceivedbyaccount", Id: cmd.id, - Params: []interface{}{}, - } - - if cmd.Account != "" || cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.Account) + Params: []interface{}{ + cmd.Account, + }, } if cmd.MinConf != 1 { @@ -3287,16 +3271,12 @@ func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - optArgs := make([]interface{}, 0, 2) - if len(r.Params) > 0 { - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter account must be a string") - } - - optArgs = append(optArgs, account) + account, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter account must be a string") } + optArgs := make([]int, 0, 1) if len(r.Params) > 1 { minconf, ok := r.Params[1].(float64) if !ok { @@ -3306,7 +3286,7 @@ func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { optArgs = append(optArgs, int(minconf)) } - newCmd, err := NewGetReceivedByAccountCmd(r.Id, optArgs...) + newCmd, err := NewGetReceivedByAccountCmd(r.Id, account, optArgs...) if err != nil { return err } @@ -3327,27 +3307,13 @@ type GetReceivedByAddressCmd struct { var _ Cmd = &GetReceivedByAddressCmd{} // NewGetReceivedByAddressCmd creates a new GetReceivedByAddressCmd. -func NewGetReceivedByAddressCmd(id interface{}, optArgs ...interface{}) (*GetReceivedByAddressCmd, error) { - if len(optArgs) > 2 { +func NewGetReceivedByAddressCmd(id interface{}, address string, optArgs ...int) (*GetReceivedByAddressCmd, error) { + if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - var address string - if len(optArgs) > 0 { - a, ok := optArgs[0].(string) - if !ok { - return nil, errors.New("first optional argument address is not a string") - } - - address = a - } var minconf int = 1 - if len(optArgs) > 1 { - m, ok := optArgs[1].(int) - if !ok { - return nil, errors.New("second optional argument minconf is not a int") - } - minconf = m - + if len(optArgs) > 0 { + minconf = optArgs[0] } return &GetReceivedByAddressCmd{ id: id, @@ -3378,11 +3344,9 @@ func (cmd *GetReceivedByAddressCmd) MarshalJSON() ([]byte, error) { Jsonrpc: "1.0", Method: "getreceivedbyaddress", Id: cmd.id, - Params: []interface{}{}, - } - - if cmd.Address != "" || cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.Address) + Params: []interface{}{ + cmd.Address, + }, } if cmd.MinConf != 1 { @@ -3404,16 +3368,12 @@ func (cmd *GetReceivedByAddressCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - optArgs := make([]interface{}, 0, 2) - if len(r.Params) > 0 { - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter address must be a string") - } - - optArgs = append(optArgs, address) + address, ok := r.Params[0].(string) + if !ok { + return errors.New("first parameter address must be a string") } + optArgs := make([]int, 0, 1) if len(r.Params) > 1 { minconf, ok := r.Params[1].(float64) if !ok { @@ -3423,7 +3383,7 @@ func (cmd *GetReceivedByAddressCmd) UnmarshalJSON(b []byte) error { optArgs = append(optArgs, int(minconf)) } - newCmd, err := NewGetReceivedByAddressCmd(r.Id, optArgs...) + newCmd, err := NewGetReceivedByAddressCmd(r.Id, address, optArgs...) if err != nil { return err } From 25bb31ebd5847227bca0b56a7bb15618e94c5e80 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 4 Feb 2014 15:40:16 -0500 Subject: [PATCH 114/229] use bytes.Equal instead. --- jsonapi_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi_test.go b/jsonapi_test.go index 8297a3ed..98ec517e 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -371,7 +371,7 @@ func TestReadResultCmd(t *testing.T) { if err != nil { t.Errorf("Should unmarshal result: %d %v", i, err) } - if bytes.Compare(tt.msg, msg2) != 0 { + if !bytes.Equal(tt.msg, msg2) { t.Errorf("json byte arrays differ. %d %v %v", i, tt.msg, msg2) } } From ae21689a57f2127300461220fca543992613c5f6 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 4 Feb 2014 16:13:24 -0500 Subject: [PATCH 115/229] gofmt --- jsoncmd_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 2378f7f7..42bb21ce 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -120,15 +120,15 @@ var jsoncmdtests = []struct { f: func() (Cmd, error) { return NewCreateRawTransactionCmd(testId, []TransactionInput{ - TransactionInput{Txid: "tx1", Vout: 1}, - TransactionInput{Txid: "tx2", Vout: 3}}, + {Txid: "tx1", Vout: 1}, + {Txid: "tx2", Vout: 3}}, map[string]int64{"bob": 1, "bill": 2}) }, result: &CreateRawTransactionCmd{ id: testId, Inputs: []TransactionInput{ - TransactionInput{Txid: "tx1", Vout: 1}, - TransactionInput{Txid: "tx2", Vout: 3}, + {Txid: "tx1", Vout: 1}, + {Txid: "tx2", Vout: 3}, }, Amounts: map[string]int64{ "bob": 1, From 0d1539118b5b6be03b4d2c260177ac978fdb4f3a Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 4 Feb 2014 17:10:37 -0500 Subject: [PATCH 116/229] Add some missing comments on exported items. --- jsonapi.go | 5 +++++ jsoncmd.go | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index c15cab61..b7b7ee6e 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -115,10 +115,12 @@ type Vin struct { Sequence uint32 `json:"sequence"` } +// IsCoinBase returns a bool to show if a Vin is a Coinbase one or not. func (v *Vin) IsCoinBase() bool { return len(v.Coinbase) > 0 } +// MarshalJSON provides a custom Marshal method for Vin. func (v *Vin) MarshalJSON() ([]byte, error) { if v.IsCoinBase() { coinbaseStruct := struct { @@ -192,11 +194,14 @@ type ValidateAddressResult struct { Account string `json:"account,omitempty"` } +// SignRawTransactionResult models the data from the signrawtransaction +// command. type SignRawTransactionResult struct { Hex string `json:"hex"` Complete bool `json:"complete"` } +// ListUnSpentResult models the data from the ListUnSpentResult command. type ListUnSpentResult struct { TxId string `json:"txid"` Vout float64 `json:"vout"` diff --git a/jsoncmd.go b/jsoncmd.go index e2a08da4..27154f0a 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -37,7 +37,7 @@ type RawCmd struct { Params []interface{} `json:"params"` } -// ParseRawCmd is a function to create a custom Cmd from a RawCmd. +// RawCmdParser is a function to create a custom Cmd from a RawCmd. type RawCmdParser func(*RawCmd) (Cmd, error) type cmd struct { @@ -70,7 +70,7 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { } // Return a custom command type for recognized - var cmd Cmd = nil + var cmd Cmd switch r.Method { case "addmultisigaddress": cmd = new(AddMultisigAddressCmd) @@ -6225,6 +6225,7 @@ func (cmd *SignMessageCmd) UnmarshalJSON(b []byte) error { return nil } +// RawTxInput models the data needed for a raw tx input. type RawTxInput struct { Txid string `json:"txid"` Vout int `json:"vout"` From 4661be87589e621d9645a830b9b3ba111f334c19 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 5 Feb 2014 09:40:56 -0600 Subject: [PATCH 117/229] Add support for GetNetTotalsResult. ok @jcvernaleo --- jsonapi.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index b7b7ee6e..54a088b9 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -97,6 +97,13 @@ type TxRawDecodeResult struct { Vout []Vout `json:"vout"` } +// GetNetTotalsResult models the data returned from the getnettotals command. +type GetNetTotalsResult struct { + TotalBytesRecv uint64 `json:"totalbytesrecv"` + TotalBytesSent uint64 `json:"totalbytessent"` + TimeMillis int64 `json:"timemillis"` +} + // ScriptSig models a signature script. It is defined seperately since it only // applies to non-coinbase. Therefore the field in the Vin structure needs // to be a pointer. @@ -878,6 +885,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } } + case "getnettotals": + var res GetNetTotalsResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getrawtransaction": // getrawtransaction can either return a JSON object or a // hex-encoded string depending on the verbose flag. Choose the From 397c4caefed16631b03dcd24e704f336ef65c68b Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 5 Feb 2014 10:51:59 -0600 Subject: [PATCH 118/229] Correct getnettotals help message. --- cmdhelp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmdhelp.go b/cmdhelp.go index 365efb96..3c1f9d19 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -295,11 +295,11 @@ Returns a JSON object containing information related to mining: }`, "getnettotals": `getnettotals -Returns JSON object containinng network traffic statistics: +Returns JSON object containing network traffic statistics: { "totalbytesrecv":n, # Numeric total bytes received. "totalbytessent":n, # Numeric total bytes sent. - "timemilis",t, # Total numeric cpu time. + "timemilis",t, # Total numeric of milliseconds since epoch. }`, "getnetworkhashps": `getnetworkhashps ( blocks=120 height=-1 ) From 7623d13c3732c2e7d0fbeb167c3e43507929b68a Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 7 Feb 2014 12:10:10 -0600 Subject: [PATCH 119/229] Make getnetworkhashps result an int64. --- jsonapi.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index 54a088b9..246cdcac 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -891,6 +891,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "getnetworkhashps": + var res int64 + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getrawtransaction": // getrawtransaction can either return a JSON object or a // hex-encoded string depending on the verbose flag. Choose the From 773efd633d23e1f96984a202e1cc17937d4014e7 Mon Sep 17 00:00:00 2001 From: Francis Lam Date: Sat, 8 Feb 2014 16:41:36 -0500 Subject: [PATCH 120/229] Added RegisterCustomCmdGenerator to btcjson package Allows for addition of custom Cmd classes that implement UnmarshalJSON directly as opposed to via RawCmd object and RawCmdParser --- jsoncmd.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jsoncmd.go b/jsoncmd.go index 27154f0a..a1b97e96 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -53,6 +53,14 @@ func RegisterCustomCmd(method string, parser RawCmdParser, helpString string) { customCmds[method] = cmd{parser: parser, helpString: helpString} } +type CmdGenerator func() Cmd + +var customCmdGenerators = make(map[string]CmdGenerator) + +func RegisterCustomCmdGenerator(method string, generator CmdGenerator) { + customCmdGenerators[method] = generator +} + // ParseMarshaledCmd parses a raw command and unmarshals as a Cmd. // Code that reads and handles commands should switch on the type and // type assert as the particular commands supported by the program. @@ -294,6 +302,10 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { if c, ok := customCmds[r.Method]; ok { return c.parser(&r) } + + if g, ok := customCmdGenerators[r.Method]; ok { + cmd = g() + } } if cmd == nil { From bfe374e735eaa99b9ce1dabc3cba6488615e8685 Mon Sep 17 00:00:00 2001 From: Francis Lam Date: Sat, 8 Feb 2014 17:55:11 -0500 Subject: [PATCH 121/229] Added comments for CmdGenerator and RegisterCustomCmdGenerator --- jsoncmd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jsoncmd.go b/jsoncmd.go index a1b97e96..e8ffe687 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -53,10 +53,14 @@ func RegisterCustomCmd(method string, parser RawCmdParser, helpString string) { customCmds[method] = cmd{parser: parser, helpString: helpString} } +// CmdGenerator is a function that returns a new concerete Cmd of +// the appropriate type for a non-standard Bitcoin command. type CmdGenerator func() Cmd var customCmdGenerators = make(map[string]CmdGenerator) +// RegisterCustomCmdGenerator registers a custom CmdGenerator func for +// a non-standard Bitcoin command. func RegisterCustomCmdGenerator(method string, generator CmdGenerator) { customCmdGenerators[method] = generator } From cace9187d7973c7a797345f8c4dd4d340b69413b Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 9 Feb 2014 22:30:10 -0600 Subject: [PATCH 122/229] Correct typo in CmdGenerator comment. --- jsoncmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index e8ffe687..b966e23f 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -53,7 +53,7 @@ func RegisterCustomCmd(method string, parser RawCmdParser, helpString string) { customCmds[method] = cmd{parser: parser, helpString: helpString} } -// CmdGenerator is a function that returns a new concerete Cmd of +// CmdGenerator is a function that returns a new concrete Cmd of // the appropriate type for a non-standard Bitcoin command. type CmdGenerator func() Cmd From a73363368564bc3e03e9ec15dc243a895002706f Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 11 Feb 2014 16:26:47 -0600 Subject: [PATCH 123/229] Correct GetWorkCmd. The getwork RPC now only accepts a single optional parameter which, if present, is a string containing the hex-encoded block data to solve. Also update the tests for the new correct parameters. ok @jcvernaleo --- jsoncmd.go | 68 ++++++++++--------------------------------------- jsoncmd_test.go | 15 +++-------- 2 files changed, 17 insertions(+), 66 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index b966e23f..32d281c4 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3654,20 +3654,11 @@ func (cmd *GetTxOutSetInfoCmd) UnmarshalJSON(b []byte) error { return nil } -// WorkRequest is a request object as defined in -// https://en.bitcoin.it/wiki/Getwork, it is provided as a -// pointer argument to GetWorkCmd. -type WorkRequest struct { - Data string `json:"data"` - Target string `json:"target"` - Algorithm string `json:"algorithm,omitempty"` -} - // GetWorkCmd is a type handling custom marshaling and // unmarshaling of getwork JSON RPC commands. type GetWorkCmd struct { - id interface{} - Request *WorkRequest + id interface{} + Data string `json:"data,omitempty"` } // Enforce that GetWorkCmd satisifies the Cmd interface. @@ -3675,17 +3666,17 @@ var _ Cmd = &GetWorkCmd{} // NewGetWorkCmd creates a new GetWorkCmd. Optionally a // pointer to a TemplateRequest may be provided. -func NewGetWorkCmd(id interface{}, optArgs ...*WorkRequest) (*GetWorkCmd, error) { - var request *WorkRequest +func NewGetWorkCmd(id interface{}, optArgs ...string) (*GetWorkCmd, error) { + var data string if len(optArgs) > 0 { if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - request = optArgs[0] + data = optArgs[0] } return &GetWorkCmd{ - id: id, - Request: request, + id: id, + Data: data, }, nil } @@ -3712,8 +3703,8 @@ func (cmd *GetWorkCmd) MarshalJSON() ([]byte, error) { Id: cmd.id, Params: []interface{}{}, } - if cmd.Request != nil { - raw.Params = append(raw.Params, cmd.Request) + if cmd.Data != "" { + raw.Params = append(raw.Params, cmd.Data) } return json.Marshal(raw) @@ -3730,46 +3721,15 @@ func (cmd *GetWorkCmd) UnmarshalJSON(b []byte) error { if len(r.Params) > 1 { return ErrWrongNumberOfParams } - wrequest := new(WorkRequest) + var data string if len(r.Params) == 1 { - rmap, ok := r.Params[0].(map[string]interface{}) + sdata, ok := r.Params[0].(string) if !ok { - return errors.New("first optional parameter template request must be an object") - } - - // data is required - data, ok := rmap["data"] - if !ok { - return errors.New("WorkRequest data must be present") - } - sdata, ok := data.(string) - if !ok { - return errors.New("WorkRequest data must be a string") - } - wrequest.Data = sdata - - // target is required - target, ok := rmap["target"] - if !ok { - return errors.New("WorkRequest target must be present") - } - starget, ok := target.(string) - if !ok { - return errors.New("WorkRequest target must be a string") - } - wrequest.Target = starget - - // algorithm is optional - algo, ok := rmap["algorithm"] - if ok { - salgo, ok := algo.(string) - if !ok { - return errors.New("WorkRequest algorithm must be a string") - } - wrequest.Algorithm = salgo + return errors.New("data must be a string") } + data = sdata } - newCmd, err := NewGetWorkCmd(r.Id, wrequest) + newCmd, err := NewGetWorkCmd(r.Id, data) if err != nil { return err } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 42bb21ce..38632fe6 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -735,20 +735,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getwork", f: func() (Cmd, error) { - return NewGetWorkCmd(testId, - &WorkRequest{ - Data: "some data", - Target: "our target", - Algorithm: "algo", - }) + return NewGetWorkCmd(testId, "some data") }, result: &GetWorkCmd{ - id: testId, - Request: &WorkRequest{ - Data: "some data", - Target: "our target", - Algorithm: "algo", - }, + id: testId, + Data: "some data", }, }, { From 5135fd32034c9cdcd32ce49248316b5778046976 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 11 Feb 2014 17:44:48 -0600 Subject: [PATCH 124/229] Allow getwork result to be a bool or JSON object. The getwork command alters the output depending on whether or not the optional data parameter was specified. It is a JSON object when no data was provided, and a boolean indicating whether a solution was found when data was provided. --- jsonapi.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 246cdcac..d81a2e62 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -933,10 +933,21 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } case "getwork": - var res GetWorkResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res + // getwork can either return a JSON object or a boolean + // depending on whether or not data was provided. Choose the + // right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res GetWorkResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res bool + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } } case "validateaddress": var res ValidateAddressResult From 6a2b93e622a353bef32467785b2d1ef8659bbbf9 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 16 Feb 2014 13:45:04 -0600 Subject: [PATCH 125/229] Add support for GetPeerInfoResult. --- jsonapi.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index d81a2e62..b03f81d5 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -74,6 +74,25 @@ type DecodeScriptResult struct { P2sh string `json:"p2sh"` } +// GetPeerInfoResult models the data returned from the getpeerinfo command. +type GetPeerInfoResult struct { + Addr string `json:"addr"` + Services string `json:"services"` + LastSend int64 `json:"lastsend"` + LastRecv int64 `json:"lastrecv"` + BytesSent uint64 `json:"bytessent"` + BytesRecv uint64 `json:"bytesrecv"` + PingTime int64 `json:"pingtime"` + PingWait int64 `json:"pingwait,omitempty"` + ConnTime int64 `json:"conntime"` + Version uint32 `json:"version"` + SubVer string `json:"subver"` + Inbound bool `json:"inbound"` + StartingHeight int32 `json:"startingheight"` + BanScore int `json:"banscore,omitempty"` + SyncNode bool `json:"syncnode"` +} + // TxRawResult models the data from the getrawtransaction command. type TxRawResult struct { Hex string `json:"hex"` @@ -897,6 +916,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "getpeerinfo": + var res []GetPeerInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getrawtransaction": // getrawtransaction can either return a JSON object or a // hex-encoded string depending on the verbose flag. Choose the From 81843d269f7ef0f9cf432910a0d014073c798329 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 16 Feb 2014 14:02:24 -0600 Subject: [PATCH 126/229] Add support for GetRawMempoolResult. --- jsonapi.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index b03f81d5..cef28ab0 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -93,6 +93,17 @@ type GetPeerInfoResult struct { SyncNode bool `json:"syncnode"` } +// GetRawMempoolResult models the data returned from the getrawmempool command. +type GetRawMempoolResult struct { + Size int `json:"size"` + Fee float64 `json:"fee"` + Time int64 `json:"time"` + Height int64 `json:"height"` + StartingPriority int `json:"startingpriority"` + CurrentPriority int `json:"currentpriority"` + Depends []string `json:"depends"` +} + // TxRawResult models the data from the getrawtransaction command. type TxRawResult struct { Hex string `json:"hex"` @@ -957,6 +968,23 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "getrawmempool": + // getrawmempool can either return a map of JSON objects or + // an array of strings depending on the verbose flag. Choose + // the right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res map[string]GetRawMempoolResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } case "getwork": // getwork can either return a JSON object or a boolean // depending on whether or not data was provided. Choose the From 21b974e2715f48e36dbcb759314dfe96cdfb094d Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 20 Feb 2014 10:51:15 -0500 Subject: [PATCH 127/229] Fix missing ) in comment. --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index cef28ab0..9a1494fb 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -1171,7 +1171,7 @@ func IsValidIdType(id interface{}) bool { // JSONToAmount Safely converts a floating point value to an int. // Clearly not all floating point numbers can be converted to ints (there -// is no one-to-one mapping, but bitcoin's json api returns most numbers as +// is no one-to-one mapping), but bitcoin's json api returns most numbers as // floats which are not safe to use when handling money. Since bitcoins can // only be divided in a limited way, this methods works for the amounts returned // by the json api. It is not for general use. From f65ea832deb0cbd6a6aff3e4a168396f6cf6baa3 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 12 Mar 2014 09:59:35 -0500 Subject: [PATCH 128/229] Export a couple of peer-to-peer client errors. ok @jcvernaleo --- jsonerr.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jsonerr.go b/jsonerr.go index e10b9416..3ebd7f8b 100644 --- a/jsonerr.go +++ b/jsonerr.go @@ -64,6 +64,18 @@ var ( } ) +// Peer-to-peer client errors +var ( + ErrClientNotConnected = Error{ + Code: -9, + Message: "Bitcoin is not connected", + } + ErrClientInInitialDownload = Error{ + Code: -10, + Message: "Bitcoin is downloading blocks...", + } +) + // Wallet JSON errors var ( ErrWallet = Error{ From 1bc63bfd5d9901aab6eb321e4adf2925ebed1053 Mon Sep 17 00:00:00 2001 From: jolan Date: Fri, 14 Mar 2014 15:08:51 -0500 Subject: [PATCH 129/229] recieve->receive --- cmdhelp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdhelp.go b/cmdhelp.go index 3c1f9d19..3211cbce 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -428,7 +428,7 @@ transaction "txid". The object follows the following format: { "account":"name", # The acount name involvedi n the transaction. "" means the default. "address":"address", # The address involved in the transaction as a string. - "category":"send|recieve", # Category - either send or recieve. + "category":"send|receive", # Category - either send or receive. "amount":n, # numeric amount in BTC. } ... From 8f69a0bf690a5e19878bf0ba90dab0dd737b0659 Mon Sep 17 00:00:00 2001 From: Francis Lam Date: Sat, 15 Mar 2014 15:34:55 -0400 Subject: [PATCH 130/229] Added new RelayFee field and missing TimeOffset field to InfoResult --- jsonapi.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index 9a1494fb..583ae52a 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -35,6 +35,7 @@ type InfoResult struct { WalletVersion int `json:"walletversion,omitempty"` Balance float64 `json:"balance,omitempty"` Blocks int `json:"blocks,omitempty"` + TimeOffset int64 `json:"timeoffset,omitempty"` Connections int `json:"connections,omitempty"` Proxy string `json:"proxy,omitempty"` Difficulty float64 `json:"difficulty,omitempty"` @@ -42,6 +43,7 @@ type InfoResult struct { KeypoolOldest int64 `json:"keypoololdest,omitempty"` KeypoolSize int `json:"keypoolsize,omitempty"` PaytxFee float64 `json:"paytxfee,omitempty"` + RelayFee float64 `json:"relayfee,omitempty"` Errors string `json:"errors,omitempty"` } From 71e31f03a25235aaf603a36b29052359b179ade0 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Sun, 16 Mar 2014 14:18:43 -0400 Subject: [PATCH 131/229] Update coverage report. --- test_coverage.txt | 223 +++++++++++++++++++++++----------------------- 1 file changed, 112 insertions(+), 111 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index f4a9f732..22f3ce91 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,50 +6,50 @@ github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) @@ -69,7 +69,7 @@ github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1 github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) @@ -81,12 +81,7 @@ github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00 github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) @@ -138,6 +133,9 @@ github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/ github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) @@ -155,7 +153,6 @@ github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) @@ -267,6 +264,11 @@ github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) @@ -328,111 +330,108 @@ github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.77% (79/88) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 88.00% (66/75) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 73.53% (25/34) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) @@ -440,10 +439,11 @@ github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 58.93% (66/112) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) 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/jsoncmd.go GetHelpString 50.00% (3/6) +github.com/conformal/btcjson/cmdhelp.go GetHelpString 50.00% (3/6) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) @@ -451,14 +451,15 @@ github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22 github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmdGenerator 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 79.36% (2234/2815) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.25% (2205/2818) From b0242a8793cc210f09c67824140cd8988a5d2593 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 7 Apr 2014 14:07:38 -0400 Subject: [PATCH 132/229] Add missing fields to ValidateAddressResult structure ok @jrick --- jsonapi.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 583ae52a..7353bcb3 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -224,13 +224,17 @@ type GetWorkResult struct { // ValidateAddressResult models the data from the validateaddress command. type ValidateAddressResult struct { - IsValid bool `json:"isvalid"` - Address string `json:"address,omitempty"` - IsMine bool `json:"ismine,omitempty"` - IsScript bool `json:"isscript,omitempty"` - PubKey string `json:"pubkey,omitempty"` - IsCompressed bool `json:"iscompressed,omitempty"` - Account string `json:"account,omitempty"` + IsValid bool `json:"isvalid"` + Address string `json:"address,omitempty"` + IsMine bool `json:"ismine,omitempty"` + IsScript bool `json:"isscript,omitempty"` + PubKey string `json:"pubkey,omitempty"` + IsCompressed bool `json:"iscompressed,omitempty"` + Account string `json:"account,omitempty"` + Addresses []string `json:"addresses,omitempty"` + Hex string `json:"hex,omitempty"` + Script string `json:"script,omitempty"` + SigsRequired int `json:"sigsrequired,omitempty"` } // SignRawTransactionResult models the data from the signrawtransaction From 7c39a02ed1de4a8926080d8757171cbfa9d5b0b7 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 8 Apr 2014 00:01:14 -0500 Subject: [PATCH 133/229] Correct ReadResultCmd for getaddednodeinfo. The returned result was previously a []interface{} instead of a []GetAddedNodeInfoResult. This commit resolves that issue. ok @jcvernaleo --- jsonapi.go | 17 ++++++++++------- test_coverage.txt | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 7353bcb3..5e2e1b6c 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -888,15 +888,18 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getaddednodeinfo can either return a JSON object or a // slice of strings depending on the verbose flag. Choose the // right form accordingly. - var res interface{} if strings.Contains(string(objmap["result"]), "{") { - res = []GetAddedNodeInfoResult{} + var res []GetAddedNodeInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } } else { - res = []string{} - } - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } } case "getinfo": var res InfoResult diff --git a/test_coverage.txt b/test_coverage.txt index 22f3ce91..dd589158 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -439,7 +439,7 @@ github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 58.93% (66/112) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 57.89% (66/114) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) github.com/conformal/btcjson/jsonapi.go rpcRawCommand 53.33% (8/15) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 50.00% (12/24) @@ -461,5 +461,5 @@ github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.25% (2205/2818) +github.com/conformal/btcjson --------------------------------------- 78.19% (2205/2820) From dd926bfdf93de2f95d341d22ac7db1d61e1a3a76 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 8 Apr 2014 21:32:58 -0500 Subject: [PATCH 134/229] Add support for ListTransactionsResult. ok @jcvernaleo. --- jsonapi.go | 26 +++++++++++++++ test_coverage.txt | 84 +++++++++++++++++++++++------------------------ 2 files changed, 68 insertions(+), 42 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 5e2e1b6c..b570a1fb 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -106,6 +106,26 @@ type GetRawMempoolResult struct { Depends []string `json:"depends"` } +// ListTransactionsResult models the data from the listtransactions command. +type ListTransactionsResult struct { + Account string `json:"account"` + Address string `json:"address,omitempty"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee"` + Confirmations int64 `json:"confirmations"` + Generated bool `json:"generated"` + BlockHash string `json:"blockhash,omitempty"` + BlockIndex int64 `json:"blockindex,omitempty"` + BlockTime int64 `json:"blocktime,omitempty"` + TxID string `json:"amount"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Comment string `json:"comment,omitempty"` + OtherAccount float64 `json:"otheraccount"` +} + // TxRawResult models the data from the getrawtransaction command. type TxRawResult struct { Hex string `json:"hex"` @@ -1023,6 +1043,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "listtransactions": + var res []ListTransactionsResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "listunspent": var res []ListUnSpentResult err = json.Unmarshal(objmap["result"], &res) diff --git a/test_coverage.txt b/test_coverage.txt index dd589158..9e2da715 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -334,59 +334,59 @@ github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.77% (79/88) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) @@ -395,20 +395,20 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) @@ -416,22 +416,22 @@ github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) @@ -439,8 +439,8 @@ github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 57.89% (66/114) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 55.93% (66/118) 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) @@ -453,13 +453,13 @@ github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmdGenerator 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.19% (2205/2820) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.08% (2205/2824) From 50473f6ed3c11661ee4a1514c14444c4ce641fc8 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 9 Apr 2014 13:45:55 -0400 Subject: [PATCH 135/229] Add support for CreateMultiSigResult. ok @jcvernaleo --- jsonapi.go | 12 +++++++ jsonapi_test.go | 4 +++ test_coverage.txt | 86 +++++++++++++++++++++++------------------------ 3 files changed, 59 insertions(+), 43 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index b570a1fb..dc263328 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -67,6 +67,12 @@ type BlockResult struct { NextHash string `json:"nextblockhash"` } +// CreateMultiSigResult models the data returned from the createmultisig command. +type CreateMultiSigResult struct { + Address string `json:"address"` + RedeemScript string `json:"redeemScript"` +} + // DecodeScriptResult models the data returned from the decodescript command. type DecodeScriptResult struct { Asm string `json:"asm"` @@ -904,6 +910,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // generate put the results in the proper structure. // We handle the error condition after the switch statement. switch cmd { + case "createmultisig": + var res CreateMultiSigResult + 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 diff --git a/jsonapi_test.go b/jsonapi_test.go index 98ec517e..a78cbe60 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -25,6 +25,8 @@ var cmdtests = []struct { args []interface{} pass bool }{ + {"createmultisig", nil, false}, + {"createmultisig", []interface{}{1}, false}, {"getinfo", nil, true}, {"getinfo", []interface{}{1}, false}, {"listaccounts", nil, true}, @@ -333,6 +335,8 @@ var resulttests = []struct { {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, {"anycommand", []byte(`{some junk}`), false, false}, {"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}, {"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}, diff --git a/test_coverage.txt b/test_coverage.txt index 9e2da715..76280274 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -334,59 +334,59 @@ github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.77% (79/88) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) @@ -395,20 +395,20 @@ github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) @@ -416,22 +416,22 @@ github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) github.com/conformal/btcjson/jsoncmd.go NewAddNodeCmd 66.67% (2/3) @@ -439,8 +439,8 @@ github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 62.50% (10/16) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 57.38% (70/122) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 55.93% (66/118) 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) @@ -453,13 +453,13 @@ github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmdGenerator 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.08% (2205/2824) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.11% (2209/2828) From 8a503c614839cf6f6ea7ea006932cec84de1c7da Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 9 Apr 2014 22:39:25 -0400 Subject: [PATCH 136/229] Add addrlocal to GetPeerInfoResult. ok @davecgh --- jsonapi.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonapi.go b/jsonapi.go index dc263328..d3837461 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -85,6 +85,7 @@ type DecodeScriptResult struct { // GetPeerInfoResult models the data returned from the getpeerinfo command. type GetPeerInfoResult struct { Addr string `json:"addr"` + AddrLocal string `json:"addrlocal,omitempty"` Services string `json:"services"` LastSend int64 `json:"lastsend"` LastRecv int64 `json:"lastrecv"` From 016e69cd510bf9b1c7dbd671152959b13fd8adcd Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 9 Apr 2014 12:26:56 -0500 Subject: [PATCH 137/229] Convert RawCmd to use raw messages for params. This commit modifies the RawCmd type to use a slice of json.RawMessages so that unmarshalling each individual parameter can be deferred to the handler for the command. This is superior to the old method of using a []interface{} because it means that each parameter is now unmarshalled into the expected concrete type directly instead of whatever it happens to be in the JSON. Due to this, the old behavior where every number was unmarshlled as a float64 and converted to the appropriate final type, which could lead to odd behavior when going through marshal/unmarshal cycles, has been eliminated. This change also means each individual parameter can now be full blown structs (JSON objects) that marshal and unmarshal themselves which greatly simplifies complex parameters and removes the need for additional and error prone code. This commit contains a lot of changes because every command needed its MarshalJSON and UnmarshalJSON methods updated to support the new mechanism. As a part of changing these functions, a new common creation function for the the RawCmd struct was added to avoid the previous duplication of the common fields. Also, rather than repeating the method string in each MarshJSON functon, it makes use of cmd.Method(). Finally, some of the error messages were incorrect and have been corrected as well as made consistent. ok @jcvernaleo, @jrick, @owainga --- jsoncmd.go | 2264 ++++++++++++++++++++------------------------- test_coverage.txt | 508 +++++----- 2 files changed, 1258 insertions(+), 1514 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 32d281c4..e8621ef6 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -7,6 +7,7 @@ package btcjson import ( "encoding/json" "errors" + "fmt" ) // ErrTooManyOptArgs describes an error where too many optional @@ -31,10 +32,32 @@ type Cmd interface { // custom command type is set. Other packages may register their // own RawCmd to Cmd converters by calling RegisterCustomCmd. type RawCmd struct { - Jsonrpc string `json:"jsonrpc"` - Id interface{} `json:"id"` - Method string `json:"method"` - Params []interface{} `json:"params"` + Jsonrpc string `json:"jsonrpc"` + Id interface{} `json:"id"` + Method string `json:"method"` + Params []json.RawMessage `json:"params"` +} + +// NewRawCmd returns a new raw command given the provided id, method, and +// parameters. The parameters are marshalled into a json.RawMessage for the +// Params field of the returned raw command. +func NewRawCmd(id interface{}, method string, params []interface{}) (*RawCmd, error) { + rawParams := make([]json.RawMessage, 0, len(params)) + for _, param := range params { + marshalledParam, err := json.Marshal(param) + if err != nil { + return nil, err + } + rawMessage := json.RawMessage(marshalledParam) + rawParams = append(rawParams, rawMessage) + } + + return &RawCmd{ + Jsonrpc: "1.0", + Id: id, + Method: method, + Params: rawParams, + }, nil } // RawCmdParser is a function to create a custom Cmd from a RawCmd. @@ -362,10 +385,9 @@ func (cmd *unparsableCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *unparsableCmd) MarshalJSON() ([]byte, error) { // Fill and marshal a RawCmd. - raw := RawCmd{ - Jsonrpc: "1.0", - Method: cmd.method, - Id: cmd.id, + raw, err := NewRawCmd(cmd.id, cmd.method, nil) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -436,21 +458,18 @@ func (cmd *AddMultisigAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *AddMultisigAddressCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "addmultisigaddress", - Id: cmd.id, - Params: []interface{}{ - cmd.NRequired, - cmd.Keys, - }, - } - + params := make([]interface{}, 2, 3) + params[0] = cmd.NRequired + params[1] = cmd.Keys if cmd.Account != "" { - raw.Params = append(raw.Params, cmd.Account) + params = append(params, cmd.Account) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -466,30 +485,24 @@ func (cmd *AddMultisigAddressCmd) UnmarshalJSON(b []byte) error { if len(r.Params) < 2 || len(r.Params) > 3 { return ErrWrongNumberOfParams } - nRequired, ok := r.Params[0].(float64) - if !ok { - return errors.New("first parameter nrequired must be a number") + + var nRequired int + if err := json.Unmarshal(r.Params[0], &nRequired); err != nil { + return fmt.Errorf("first parameter 'nrequired' must be an integer: %v", err) } - ikeys, ok := r.Params[1].([]interface{}) - if !ok { - return errors.New("second parameter keys must be an array") - } - keys := make([]string, len(ikeys)) - for i, val := range ikeys { - keys[i], ok = val.(string) - if !ok { - return errors.New("second parameter keys must be an array of strings") - } + + var keys []string + if err := json.Unmarshal(r.Params[1], &keys); err != nil { + return fmt.Errorf("second parameter 'keys' must be an array of strings: %v", err) } + var account string if len(r.Params) > 2 { - account, ok = r.Params[2].(string) - if !ok { - return errors.New("third (optional) parameter account must be a string") + if err := json.Unmarshal(r.Params[2], &account); err != nil { + return fmt.Errorf("third optional parameter 'account' must be a string: %v", err) } } - newCmd, err := NewAddMultisigAddressCmd(r.Id, int(nRequired), keys, - account) + newCmd, err := NewAddMultisigAddressCmd(r.Id, nRequired, keys, account) if err != nil { return err } @@ -548,16 +561,17 @@ func (cmd *AddNodeCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *AddNodeCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Addr, + cmd.SubCmd, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "addnode", - Id: cmd.id, - Params: []interface{}{ - cmd.Addr, - cmd.SubCmd, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -572,14 +586,17 @@ func (cmd *AddNodeCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 2 { return ErrWrongNumberOfParams } - addr, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter addr must be a string") + + var addr string + if err := json.Unmarshal(r.Params[0], &addr); err != nil { + return fmt.Errorf("first parameter 'addr' must be a string: %v", err) } - subcmd, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter subcmd must be a string") + + var subcmd string + if err := json.Unmarshal(r.Params[1], &subcmd); err != nil { + return fmt.Errorf("second parameter 'subcmd' must be a string: %v", err) } + newCmd, err := NewAddNodeCmd(r.Id, addr, subcmd) if err != nil { return err @@ -625,15 +642,16 @@ func (cmd *BackupWalletCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *BackupWalletCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Destination, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "backupwallet", - Id: cmd.id, - Params: []interface{}{ - cmd.Destination, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -648,10 +666,12 @@ func (cmd *BackupWalletCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - destination, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter desitnation must be a string") + + var destination string + if err := json.Unmarshal(r.Params[0], &destination); err != nil { + return fmt.Errorf("first parameter 'destination' must be a string: %v", err) } + newCmd, err := NewBackupWalletCmd(r.Id, destination) if err != nil { return err @@ -699,16 +719,17 @@ func (cmd *CreateMultisigCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *CreateMultisigCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.NRequired, + cmd.Keys, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "createmultisig", - Id: cmd.id, - Params: []interface{}{ - cmd.NRequired, - cmd.Keys, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -723,24 +744,18 @@ func (cmd *CreateMultisigCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 2 { return ErrWrongNumberOfParams } - nRequired, ok := r.Params[0].(float64) - if !ok { - return errors.New("first parameter nrequired must be a number") + + var nRequired int + if err := json.Unmarshal(r.Params[0], &nRequired); err != nil { + return fmt.Errorf("first parameter 'nrequired' must be an integer: %v", err) } - ikeys, ok := r.Params[1].([]interface{}) - if !ok { - return errors.New("second parameter keys must be an array") - } - keys := make([]string, len(ikeys)) - for i, val := range ikeys { - keys[i], ok = val.(string) - if !ok { - return errors.New("second parameter keys must be an array of strings") - } + var keys []string + if err := json.Unmarshal(r.Params[1], &keys); err != nil { + return fmt.Errorf("second parameter 'keys' must be an array of strings: %v", err) } - newCmd, err := NewCreateMultisigCmd(r.Id, int(nRequired), keys) + newCmd, err := NewCreateMultisigCmd(r.Id, nRequired, keys) if err != nil { return err } @@ -756,65 +771,6 @@ type TransactionInput struct { Vout int `json:"vout"` } -// ConvertCreateRawTxParams validates and converts the passed parameters from -// raw interfaces into concrete structs. This is a separate function since -// the createrawtransaction command parameters are caller-crafted JSON as -// opposed to machine generated JSON as is the case for most commands. -func ConvertCreateRawTxParams(inputs, amounts interface{}) ([]TransactionInput, map[string]int64, error) { - iinputs, ok := inputs.([]interface{}) - if !ok { - return nil, nil, errors.New("first parameter inputs must be an array") - } - rinputs := make([]TransactionInput, len(iinputs)) - for i, iv := range iinputs { - v, ok := iv.(map[string]interface{}) - if !ok { - return nil, nil, errors.New("first parameter inputs must be an array of objects") - } - - if len(v) != 2 { - return nil, nil, errors.New("input with wrong number of members") - } - txid, ok := v["txid"] - if !ok { - return nil, nil, errors.New("input without txid") - } - rinputs[i].Txid, ok = txid.(string) - if !ok { - return nil, nil, errors.New("input txid isn't a string") - } - - vout, ok := v["vout"] - if !ok { - return nil, nil, errors.New("input without vout") - } - fvout, ok := vout.(float64) - if !ok { - return nil, nil, errors.New("input vout not a number") - } - rinputs[i].Vout = int(fvout) - } - famounts, ok := amounts.(map[string]interface{}) - if !ok { - return nil, nil, errors.New("second parameter keys must be a map") - } - - ramounts := make(map[string]int64) - for k, v := range famounts { - fv, ok := v.(float64) - if !ok { - return nil, nil, errors.New("second parameter keys must be a number map") - } - var err error - ramounts[k], err = JSONToAmount(fv) - if err != nil { - return nil, nil, err - } - } - - return rinputs, ramounts, nil -} - // CreateRawTransactionCmd is a type handling custom marshaling and // unmarshaling of createrawtransaction JSON RPC commands. type CreateRawTransactionCmd struct { @@ -852,21 +808,22 @@ func (cmd *CreateRawTransactionCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *CreateRawTransactionCmd) MarshalJSON() ([]byte, error) { - floatAmount := make(map[string]float64) - + floatAmounts := make(map[string]float64) for k, v := range cmd.Amounts { - floatAmount[k] = float64(v) / 1e8 + floatAmounts[k] = float64(v) / 1e8 } + + params := []interface{}{ + cmd.Inputs, + floatAmounts, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "createrawtransaction", - Id: cmd.id, - Params: []interface{}{ - cmd.Inputs, - floatAmount, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -882,13 +839,27 @@ func (cmd *CreateRawTransactionCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - inputs, amounts, err := ConvertCreateRawTxParams(r.Params[0], - r.Params[1]) - if err != nil { - return err + var inputs []TransactionInput + if err := json.Unmarshal(r.Params[0], &inputs); err != nil { + return fmt.Errorf("first parameter 'inputs' must be a JSON array "+ + "of transaction input JSON objects: %v", err) } - newCmd, err := NewCreateRawTransactionCmd(r.Id, inputs, amounts) + var amounts map[string]float64 + if err := json.Unmarshal(r.Params[1], &amounts); err != nil { + return fmt.Errorf("second parameter 'amounts' must be a JSON object: %v", err) + } + + intAmounts := make(map[string]int64, len(amounts)) + for k, v := range amounts { + amount, err := JSONToAmount(v) + if err != nil { + return err + } + intAmounts[k] = amount + } + + newCmd, err := NewCreateRawTransactionCmd(r.Id, inputs, intAmounts) if err != nil { return err } @@ -934,15 +905,16 @@ func (cmd *DebugLevelCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *DebugLevelCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.LevelSpec, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: cmd.Method(), - Id: cmd.id, - Params: []interface{}{ - cmd.LevelSpec, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -957,9 +929,10 @@ func (cmd *DebugLevelCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - levelSpec, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter levelspec must be a string") + + var levelSpec string + if err := json.Unmarshal(r.Params[0], &levelSpec); err != nil { + return fmt.Errorf("first parameter 'levelspec' must be a string: %v", err) } newCmd, err := NewDebugLevelCmd(r.Id, levelSpec) @@ -1006,15 +979,16 @@ func (cmd *DecodeRawTransactionCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *DecodeRawTransactionCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.HexTx, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "decoderawtransaction", - Id: cmd.id, - Params: []interface{}{ - cmd.HexTx, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1029,9 +1003,10 @@ func (cmd *DecodeRawTransactionCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - hextx, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter hextx must be an array of objects") + + var hextx string + if err := json.Unmarshal(r.Params[0], &hextx); err != nil { + return fmt.Errorf("first parameter 'hextx' must be a string: %v", err) } newCmd, err := NewDecodeRawTransactionCmd(r.Id, hextx) @@ -1078,15 +1053,16 @@ func (cmd *DecodeScriptCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *DecodeScriptCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.HexScript, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "decodescript", - Id: cmd.id, - Params: []interface{}{ - cmd.HexScript, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1101,9 +1077,10 @@ func (cmd *DecodeScriptCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - hexscript, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter hexscript must be an array of objects") + + var hexscript string + if err := json.Unmarshal(r.Params[0], &hexscript); err != nil { + return fmt.Errorf("first parameter 'hexscript' must be a string: %v", err) } newCmd, err := NewDecodeScriptCmd(r.Id, hexscript) @@ -1150,15 +1127,16 @@ func (cmd *DumpPrivKeyCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *DumpPrivKeyCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Address, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "dumpprivkey", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1173,9 +1151,10 @@ func (cmd *DumpPrivKeyCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be an array of objects") + + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } newCmd, err := NewDumpPrivKeyCmd(r.Id, address) @@ -1222,15 +1201,16 @@ func (cmd *DumpWalletCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *DumpWalletCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Filename, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "dumpwallet", - Id: cmd.id, - Params: []interface{}{ - cmd.Filename, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1245,9 +1225,10 @@ func (cmd *DumpWalletCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - filename, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter filename must be an array of objects") + + var filename string + if err := json.Unmarshal(r.Params[0], &filename); err != nil { + return fmt.Errorf("first parameter 'filename' must be a string: %v", err) } newCmd, err := NewDumpWalletCmd(r.Id, filename) @@ -1294,15 +1275,16 @@ func (cmd *EncryptWalletCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *EncryptWalletCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Passphrase, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "encryptwallet", - Id: cmd.id, - Params: []interface{}{ - cmd.Passphrase, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1317,9 +1299,10 @@ func (cmd *EncryptWalletCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - passphrase, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter passphrase must be a string") + + var passphrase string + if err := json.Unmarshal(r.Params[0], &passphrase); err != nil { + return fmt.Errorf("first parameter 'passphrase' must be a string: %v", err) } newCmd, err := NewEncryptWalletCmd(r.Id, passphrase) @@ -1366,15 +1349,16 @@ func (cmd *GetAccountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAccountCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Address, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getaccount", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1389,9 +1373,10 @@ func (cmd *GetAccountCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be a string") + + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } newCmd, err := NewGetAccountCmd(r.Id, address) @@ -1438,15 +1423,16 @@ func (cmd *GetAccountAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAccountAddressCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Account, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getaccountaddress", - Id: cmd.id, - Params: []interface{}{ - cmd.Account, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1461,9 +1447,9 @@ func (cmd *GetAccountAddressCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter account must be a string") + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first parameter 'account' must be a string: %v", err) } newCmd, err := NewGetAccountAddressCmd(r.Id, account) @@ -1522,21 +1508,19 @@ func (cmd *GetAddedNodeInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAddedNodeInfoCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getaddednodeinfo", - Id: cmd.id, - Params: []interface{}{ - cmd.Dns, - }, + params := []interface{}{ + cmd.Dns, } if cmd.Node != "" { - raw.Params = append(raw.Params, cmd.Node) + params = append(params, cmd.Node) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -1552,18 +1536,17 @@ func (cmd *GetAddedNodeInfoCmd) UnmarshalJSON(b []byte) error { if len(r.Params) < 1 || len(r.Params) > 2 { return ErrWrongNumberOfParams } - dns, ok := r.Params[0].(bool) - if !ok { - return errors.New("first parameter dns must be a bool") + + var dns bool + if err := json.Unmarshal(r.Params[0], &dns); err != nil { + return fmt.Errorf("first parameter 'dns' must be a bool: %v", err) } var node string - if len(r.Params) == 2 { - node, ok = r.Params[1].(string) - if !ok { - return errors.New("second parameter node must be a string") + if len(r.Params) > 1 { + if err := json.Unmarshal(r.Params[1], &node); err != nil { + return fmt.Errorf("second optional parameter 'node' must be a string: %v", err) } - } newCmd, err := NewGetAddedNodeInfoCmd(r.Id, dns, node) @@ -1610,15 +1593,16 @@ func (cmd *GetAddressesByAccountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAddressesByAccountCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Account, + } + // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getaddressesbyaccount", - Id: cmd.id, - Params: []interface{}{ - cmd.Account, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1633,9 +1617,10 @@ func (cmd *GetAddressesByAccountCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter account must be a string") + + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first parameter 'account' must be a string: %v", err) } newCmd, err := NewGetAddressesByAccountCmd(r.Id, account) @@ -1707,21 +1692,19 @@ func (cmd *GetBalanceCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBalanceCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getbalance", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 2) if cmd.Account != "" || cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.Account) + params = append(params, cmd.Account) } if cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -1737,21 +1720,22 @@ func (cmd *GetBalanceCmd) UnmarshalJSON(b []byte) error { if len(r.Params) > 2 { return ErrWrongNumberOfParams } + optArgs := make([]interface{}, 0, 2) if len(r.Params) > 0 { - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter account must be a string") + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first optional parameter 'account' must be a string: %v", err) } optArgs = append(optArgs, account) } if len(r.Params) > 1 { - minconf, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[1], &minconf); err != nil { + return fmt.Errorf("second optional parameter 'minconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } newCmd, err := NewGetBalanceCmd(r.Id, optArgs...) @@ -1796,14 +1780,12 @@ func (cmd *GetBestBlockHashCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBestBlockHashCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getbestblockhash", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -1885,29 +1867,23 @@ func (cmd *GetBlockCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBlockCmd) MarshalJSON() ([]byte, error) { - - // Fill and marshal a RawCmd. - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getblock", - Id: cmd.id, - Params: []interface{}{ - cmd.Hash, - }, - } - + params := make([]interface{}, 1, 3) + params[0] = cmd.Hash if !cmd.Verbose { // set optional verbose argument to false - raw.Params = append(raw.Params, false) - } else { - if cmd.VerboseTx { - // set optional verbose argument to true - raw.Params = append(raw.Params, true) - // set optional verboseTx argument to true - raw.Params = append(raw.Params, true) - } + params = append(params, false) + } else if cmd.VerboseTx { + // set optional verbose argument to true + params = append(params, true) + // set optional verboseTx argument to true + params = append(params, true) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -1924,26 +1900,24 @@ func (cmd *GetBlockCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - hash, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter hash must be a string") + var hash string + if err := json.Unmarshal(r.Params[0], &hash); err != nil { + return fmt.Errorf("first parameter 'hash' must be a string: %v", err) } - optArgs := make([]bool, 0, 1) + optArgs := make([]bool, 0, 2) if len(r.Params) > 1 { - verbose, ok := r.Params[1].(bool) - if !ok { - return errors.New("second optional parameter verbose must be a bool") + var verbose bool + if err := json.Unmarshal(r.Params[1], &verbose); err != nil { + return fmt.Errorf("second optional parameter 'verbose' must be a bool: %v", err) } - optArgs = append(optArgs, verbose) } - if len(r.Params) == 3 { - verboseTx, ok := r.Params[2].(bool) - if !ok { - return errors.New("third optional parameter verboseTx must be a bool") + if len(r.Params) > 2 { + var verboseTx bool + if err := json.Unmarshal(r.Params[2], &verboseTx); err != nil { + return fmt.Errorf("third optional parameter 'verboseTx' must be a bool: %v", err) } - optArgs = append(optArgs, verboseTx) } @@ -1989,14 +1963,12 @@ func (cmd *GetBlockCountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBlockCountCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getblockcount", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2056,16 +2028,16 @@ func (cmd *GetBlockHashCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBlockHashCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.Index, + } // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getblockhash", - Id: cmd.id, - Params: []interface{}{ - cmd.Index, - }, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2080,12 +2052,13 @@ func (cmd *GetBlockHashCmd) UnmarshalJSON(b []byte) error { if len(r.Params) != 1 { return ErrWrongNumberOfParams } - hash, ok := r.Params[0].(float64) - if !ok { - return errors.New("first parameter hash must be a number") + + var index int64 + if err := json.Unmarshal(r.Params[0], &index); err != nil { + return fmt.Errorf("first parameter 'index' must be an integer: %v", err) } - newCmd, err := NewGetBlockHashCmd(r.Id, int64(hash)) + newCmd, err := NewGetBlockHashCmd(r.Id, index) if err != nil { return err } @@ -2099,7 +2072,7 @@ func (cmd *GetBlockHashCmd) UnmarshalJSON(b []byte) error { // pointer argument to GetBlockTemplateCmd. type TemplateRequest struct { Mode string `json:"mode,omitempty"` - Capabilities []string `json:"capabilities"` + Capabilities []string `json:"capabilities,omitempty"` } // GetBlockTemplateCmd is a type handling custom marshaling and @@ -2145,17 +2118,16 @@ func (cmd *GetBlockTemplateCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBlockTemplateCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getblocktemplate", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 1) if cmd.Request != nil { - raw.Params = append(raw.Params, cmd.Request) + params = append(params, cmd.Request) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -2171,43 +2143,14 @@ func (cmd *GetBlockTemplateCmd) UnmarshalJSON(b []byte) error { if len(r.Params) > 1 { return ErrWrongNumberOfParams } + optArgs := make([]*TemplateRequest, 0, 1) if len(r.Params) > 0 { - rmap, ok := r.Params[0].(map[string]interface{}) - if !ok { - return errors.New("first optional parameter template request must be an object") + var template TemplateRequest + if err := json.Unmarshal(r.Params[0], &template); err != nil { + return fmt.Errorf("first optional parameter 'template' must be a template request JSON object: %v", err) } - - trequest := new(TemplateRequest) - // optional mode string. - mode, ok := rmap["mode"] - if ok { - smode, ok := mode.(string) - if !ok { - return errors.New("TemplateRequest mode must be a string") - } - trequest.Mode = smode - } - - capabilities, ok := rmap["capabilities"] - if ok { - icap, ok := capabilities.([]interface{}) - if !ok { - return errors.New("TemplateRequest mode must be an array") - } - - cap := make([]string, len(icap)) - for i, val := range icap { - cap[i], ok = val.(string) - if !ok { - return errors.New("TemplateRequest mode must be an aray of strings") - } - } - - trequest.Capabilities = cap - } - - optArgs = append(optArgs, trequest) + optArgs = append(optArgs, &template) } newCmd, err := NewGetBlockTemplateCmd(r.Id, optArgs...) @@ -2252,14 +2195,12 @@ func (cmd *GetConnectionCountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetConnectionCountCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getconnectioncount", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2317,14 +2258,12 @@ func (cmd *GetDifficultyCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetDifficultyCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getdifficulty", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2382,14 +2321,12 @@ func (cmd *GetGenerateCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetGenerateCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getgenerate", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2447,14 +2384,12 @@ func (cmd *GetHashesPerSecCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetHashesPerSecCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "gethashespersec", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2512,14 +2447,12 @@ func (cmd *GetInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetInfoCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getinfo", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2577,14 +2510,12 @@ func (cmd *GetMiningInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetMiningInfoCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getmininginfo", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2642,14 +2573,12 @@ func (cmd *GetNetTotalsCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetNetTotalsCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getnettotals", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2725,23 +2654,19 @@ func (cmd *GetNetworkHashPSCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetNetworkHashPSCmd) MarshalJSON() ([]byte, error) { + params := make([]interface{}, 0, 2) + if cmd.Blocks != 120 || cmd.Height != -1 { + params = append(params, cmd.Blocks) + } + if cmd.Height != -1 { + params = append(params, cmd.Height) + } // Fill and marshal a RawCmd. - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getnetworkhashps", - Id: cmd.id, - Params: []interface{}{}, + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } - - if cmd.Blocks != 120 || cmd.Height != -1 { - raw.Params = append(raw.Params, cmd.Blocks) - } - - if cmd.Height != -1 { - raw.Params = append(raw.Params, cmd.Height) - } - return json.Marshal(raw) } @@ -2760,21 +2685,19 @@ func (cmd *GetNetworkHashPSCmd) UnmarshalJSON(b []byte) error { optArgs := make([]int, 0, 2) if len(r.Params) > 0 { - blocks, ok := r.Params[0].(float64) - if !ok { - return errors.New("first optional parameter blocks must be a number") + var blocks int + if err := json.Unmarshal(r.Params[0], &blocks); err != nil { + return fmt.Errorf("first optional parameter 'blocks' must be an integer: %v", err) } - - optArgs = append(optArgs, int(blocks)) + optArgs = append(optArgs, blocks) } if len(r.Params) > 1 { - height, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter height must be a number") + var height int + if err := json.Unmarshal(r.Params[1], &height); err != nil { + return fmt.Errorf("second optional parameter 'height' must be an integer: %v", err) } - - optArgs = append(optArgs, int(height)) + optArgs = append(optArgs, height) } newCmd, err := NewGetNetworkHashPSCmd(r.Id, optArgs...) if err != nil { @@ -2828,16 +2751,15 @@ func (cmd *GetNewAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetNewAddressCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getnewaddress", - Id: cmd.id, - Params: []interface{}{}, + params := make([]interface{}, 0, 1) + if cmd.Account != "" { + params = append(params, cmd.Account) } - if cmd.Account != "" { - raw.Params = append(raw.Params, cmd.Account) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -2857,12 +2779,11 @@ func (cmd *GetNewAddressCmd) UnmarshalJSON(b []byte) error { optArgs := make([]string, 0, 1) if len(r.Params) > 0 { - addr, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter address must be a string") + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first optional parameter 'account' must be a string: %v", err) } - - optArgs = append(optArgs, addr) + optArgs = append(optArgs, account) } newCmd, err := NewGetNewAddressCmd(r.Id, optArgs...) @@ -2907,14 +2828,12 @@ func (cmd *GetPeerInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetPeerInfoCmd) MarshalJSON() ([]byte, error) { - // Fill and marshal a RawCmd. - return json.Marshal(RawCmd{ - Jsonrpc: "1.0", - Method: "getpeerinfo", - Id: cmd.id, - Params: []interface{}{}, - }) + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) } // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of @@ -2982,16 +2901,15 @@ func (cmd *GetRawChangeAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetRawChangeAddressCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getrawchangeaddress", - Id: cmd.id, - Params: []interface{}{}, + params := make([]interface{}, 0, 1) + if cmd.Account != "" { + params = append(params, cmd.Account) } - if cmd.Account != "" { - raw.Params = append(raw.Params, cmd.Account) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -3011,11 +2929,10 @@ func (cmd *GetRawChangeAddressCmd) UnmarshalJSON(b []byte) error { optArgs := make([]string, 0, 1) if len(r.Params) > 0 { - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter account must be a string") + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first optional parameter 'account' must be a string: %v", err) } - optArgs = append(optArgs, account) } @@ -3070,17 +2987,16 @@ func (cmd *GetRawMempoolCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetRawMempoolCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getrawmempool", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 1) if cmd.Verbose { - raw.Params = append(raw.Params, cmd.Verbose) + params = append(params, cmd.Verbose) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -3098,12 +3014,11 @@ func (cmd *GetRawMempoolCmd) UnmarshalJSON(b []byte) error { } optArgs := make([]bool, 0, 1) - if len(r.Params) == 1 { - verbose, ok := r.Params[0].(bool) - if !ok { - return errors.New("first optional parameter verbose must be a bool") + if len(r.Params) > 0 { + var verbose bool + if err := json.Unmarshal(r.Params[0], &verbose); err != nil { + return fmt.Errorf("first optional parameter 'verbose' must be a bool: %v", err) } - optArgs = append(optArgs, verbose) } @@ -3161,18 +3076,16 @@ func (cmd *GetRawTransactionCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetRawTransactionCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getrawtransaction", - Id: cmd.id, - Params: []interface{}{ - cmd.Txid, - }, + params := make([]interface{}, 1, 2) + params[0] = cmd.Txid + if cmd.Verbose != 0 { + params = append(params, cmd.Verbose) } - if cmd.Verbose != 0 { - raw.Params = append(raw.Params, cmd.Verbose) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -3190,19 +3103,18 @@ func (cmd *GetRawTransactionCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - txid, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter txid must be a string") + var txid string + if err := json.Unmarshal(r.Params[0], &txid); err != nil { + return fmt.Errorf("first parameter 'txid' must be a string: %v", err) } optArgs := make([]int, 0, 1) - if len(r.Params) == 2 { - verbose, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter verbose must be a number") + if len(r.Params) > 1 { + var verbose int + if err := json.Unmarshal(r.Params[1], &verbose); err != nil { + return fmt.Errorf("second optional parameter 'verbose' must be an integer: %v", err) } - - optArgs = append(optArgs, int(verbose)) + optArgs = append(optArgs, verbose) } newCmd, err := NewGetRawTransactionCmd(r.Id, txid, optArgs...) @@ -3258,18 +3170,16 @@ func (cmd *GetReceivedByAccountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetReceivedByAccountCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getreceivedbyaccount", - Id: cmd.id, - Params: []interface{}{ - cmd.Account, - }, + params := make([]interface{}, 1, 2) + params[0] = cmd.Account + if cmd.MinConf != 1 { + params = append(params, cmd.MinConf) } - if cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.MinConf) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -3287,19 +3197,18 @@ func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter account must be a string") + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first parameter 'account' must be a string: %v", err) } optArgs := make([]int, 0, 1) if len(r.Params) > 1 { - minconf, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter verbose must be a number") + var minconf int + if err := json.Unmarshal(r.Params[1], &minconf); err != nil { + return fmt.Errorf("second optional parameter 'minconf' must be an integer: %v", err) } - - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } newCmd, err := NewGetReceivedByAccountCmd(r.Id, account, optArgs...) @@ -3355,18 +3264,16 @@ func (cmd *GetReceivedByAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetReceivedByAddressCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getreceivedbyaddress", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - }, + params := make([]interface{}, 1, 2) + params[0] = cmd.Address + if cmd.MinConf != 1 { + params = append(params, cmd.MinConf) } - if cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.MinConf) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -3384,19 +3291,18 @@ func (cmd *GetReceivedByAddressCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be a string") + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } optArgs := make([]int, 0, 1) if len(r.Params) > 1 { - minconf, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter verbose must be a number") + var minconf int + if err := json.Unmarshal(r.Params[1], &minconf); err != nil { + return fmt.Errorf("second optional parameter 'minconf' must be an integer: %v", err) } - - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } newCmd, err := NewGetReceivedByAddressCmd(r.Id, address, optArgs...) @@ -3443,16 +3349,15 @@ func (cmd *GetTransactionCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetTransactionCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "gettransaction", - Id: cmd.id, - Params: []interface{}{ - cmd.Txid, - }, + params := []interface{}{ + cmd.Txid, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -3469,9 +3374,9 @@ func (cmd *GetTransactionCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - txid, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter txid must be a string") + var txid string + if err := json.Unmarshal(r.Params[0], &txid); err != nil { + return fmt.Errorf("first parameter 'txid' must be a string: %v", err) } newCmd, err := NewGetTransactionCmd(r.Id, txid) @@ -3529,21 +3434,18 @@ func (cmd *GetTxOutCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetTxOutCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "gettxout", - Id: cmd.id, - Params: []interface{}{ - cmd.Txid, - cmd.Output, - }, - } - + params := make([]interface{}, 2, 3) + params[0] = cmd.Txid + params[1] = cmd.Output if cmd.IncludeMempool != false { - raw.Params = append(raw.Params, cmd.IncludeMempool) + params = append(params, cmd.IncludeMempool) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -3560,22 +3462,22 @@ func (cmd *GetTxOutCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - txid, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter txid must be a string") + var txid string + if err := json.Unmarshal(r.Params[0], &txid); err != nil { + return fmt.Errorf("first parameter 'txid' must be a string: %v", err) } - output, ok := r.Params[1].(float64) - if !ok { - return errors.New("second parameter output must be a number") + var output int + if err := json.Unmarshal(r.Params[1], &output); err != nil { + return fmt.Errorf("second parameter 'output' must be an integer: %v", err) } + optArgs := make([]bool, 0, 1) - if len(r.Params) == 3 { - mempool, ok := r.Params[2].(bool) - if !ok { - return errors.New("third optional parameter includemempool must be a bool") + if len(r.Params) > 2 { + var mempool bool + if err := json.Unmarshal(r.Params[2], &mempool); err != nil { + return fmt.Errorf("third optional parameter 'includemempool' must be a bool: %v", err) } - optArgs = append(optArgs, mempool) } @@ -3621,14 +3523,11 @@ func (cmd *GetTxOutSetInfoCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetTxOutSetInfoCmd) MarshalJSON() ([]byte, error) { - - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "gettxoutsetinfo", - Id: cmd.id, - Params: []interface{}{}, + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err } - return json.Marshal(raw) } @@ -3697,16 +3596,16 @@ func (cmd *GetWorkCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetWorkCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "getwork", - Id: cmd.id, - Params: []interface{}{}, - } + params := make([]interface{}, 0, 1) if cmd.Data != "" { - raw.Params = append(raw.Params, cmd.Data) + params = append(params, cmd.Data) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -3721,14 +3620,14 @@ func (cmd *GetWorkCmd) UnmarshalJSON(b []byte) error { if len(r.Params) > 1 { return ErrWrongNumberOfParams } + var data string - if len(r.Params) == 1 { - sdata, ok := r.Params[0].(string) - if !ok { - return errors.New("data must be a string") + if len(r.Params) > 0 { + if err := json.Unmarshal(r.Params[0], &data); err != nil { + return fmt.Errorf("first optional parameter 'data' must be a string: %v", err) } - data = sdata } + newCmd, err := NewGetWorkCmd(r.Id, data) if err != nil { return err @@ -3782,15 +3681,15 @@ func (cmd *HelpCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *HelpCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "help", - Id: cmd.id, - Params: []interface{}{}, + params := make([]interface{}, 0, 1) + if cmd.Command != "" { + params = append(params, cmd.Command) } - if cmd.Command != "" { - raw.Params = append(raw.Params, cmd.Command) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -3809,12 +3708,11 @@ func (cmd *HelpCmd) UnmarshalJSON(b []byte) error { } optArgs := make([]string, 0, 1) - if len(r.Params) == 1 { - command, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter command must be a string") + if len(r.Params) > 0 { + var command string + if err := json.Unmarshal(r.Params[0], &command); err != nil { + return fmt.Errorf("first optional parameter 'command' must be a string: %v", err) } - optArgs = append(optArgs, command) } @@ -3886,21 +3784,19 @@ func (cmd *ImportPrivKeyCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ImportPrivKeyCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "importprivkey", - Id: cmd.id, - Params: []interface{}{ - cmd.PrivKey, - }, - } - + params := make([]interface{}, 1, 3) + params[0] = cmd.PrivKey if cmd.Label != "" || !cmd.Rescan { - raw.Params = append(raw.Params, cmd.Label) + params = append(params, cmd.Label) + } + if !cmd.Rescan { + params = append(params, cmd.Rescan) } - if !cmd.Rescan { - raw.Params = append(raw.Params, cmd.Rescan) + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err } return json.Marshal(raw) } @@ -3918,27 +3814,25 @@ func (cmd *ImportPrivKeyCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - privkey, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter privkey must be a string") + var privkey string + if err := json.Unmarshal(r.Params[0], &privkey); err != nil { + return fmt.Errorf("first parameter 'privkey' must be a string: %v", err) } optArgs := make([]interface{}, 0, 2) if len(r.Params) > 1 { - label, ok := r.Params[1].(string) - if !ok { - return errors.New("second optional parameter label must be a string") + var label string + if err := json.Unmarshal(r.Params[1], &label); err != nil { + return fmt.Errorf("second optional parameter 'label' must be a string: %v", err) } - optArgs = append(optArgs, label) } if len(r.Params) > 2 { - rescan, ok := r.Params[2].(bool) - if !ok { - return errors.New("third optional parameter rescan must be a bool") + var rescan bool + if err := json.Unmarshal(r.Params[2], &rescan); err != nil { + return fmt.Errorf("third optional parameter 'rescan' must be a bool: %v", err) } - optArgs = append(optArgs, rescan) } @@ -3987,15 +3881,15 @@ func (cmd *ImportWalletCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ImportWalletCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "importwallet", - Id: cmd.id, - Params: []interface{}{ - cmd.Filename, - }, + params := []interface{}{ + cmd.Filename, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4012,9 +3906,9 @@ func (cmd *ImportWalletCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - filename, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter filename must be a string") + var filename string + if err := json.Unmarshal(r.Params[0], &filename); err != nil { + return fmt.Errorf("first parameter 'filename' must be a string: %v", err) } newCmd, err := NewImportWalletCmd(r.Id, filename) @@ -4071,17 +3965,16 @@ func (cmd *KeyPoolRefillCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *KeyPoolRefillCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "keypoolrefill", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 1) if cmd.NewSize != 0 { - raw.Params = append(raw.Params, cmd.NewSize) + params = append(params, cmd.NewSize) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4100,11 +3993,11 @@ func (cmd *KeyPoolRefillCmd) UnmarshalJSON(b []byte) error { optArgs := make([]uint, 0, 1) if len(r.Params) > 0 { - newsize, ok := r.Params[0].(float64) - if !ok { - return errors.New("first optional parameter newsize must be a number") + var newsize uint + if err := json.Unmarshal(r.Params[0], &newsize); err != nil { + return fmt.Errorf("first optional parameter 'newsize' must be an unsigned integer: %v", err) } - optArgs = append(optArgs, uint(newsize)) + optArgs = append(optArgs, newsize) } newCmd, err := NewKeyPoolRefillCmd(r.Id, optArgs...) @@ -4159,17 +4052,16 @@ func (cmd *ListAccountsCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListAccountsCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listaccounts", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 1) if cmd.MinConf != 1 { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4188,11 +4080,11 @@ func (cmd *ListAccountsCmd) UnmarshalJSON(b []byte) error { optArgs := make([]int, 0, 1) if len(r.Params) == 1 { - minconf, ok := r.Params[0].(float64) - if !ok { - return errors.New("first parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[0], &minconf); err != nil { + return fmt.Errorf("first optional parameter 'minconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } newCmd, err := NewListAccountsCmd(r.Id, optArgs...) @@ -4238,13 +4130,11 @@ func (cmd *ListAddressGroupingsCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListAddressGroupingsCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listaddressgroupings", - Id: cmd.id, - Params: []interface{}{}, + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err } - return json.Marshal(raw) } @@ -4304,13 +4194,11 @@ func (cmd *ListLockUnspentCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListLockUnspentCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listlockunspent", - Id: cmd.id, - Params: []interface{}{}, + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err } - return json.Marshal(raw) } @@ -4395,21 +4283,19 @@ func (cmd *ListReceivedByAccountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListReceivedByAccountCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listreceivedbyaccount", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 2) if cmd.MinConf != 1 || cmd.IncludeEmpty != false { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } - if cmd.IncludeEmpty != false { - raw.Params = append(raw.Params, cmd.IncludeEmpty) + params = append(params, cmd.IncludeEmpty) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4428,16 +4314,16 @@ func (cmd *ListReceivedByAccountCmd) UnmarshalJSON(b []byte) error { optArgs := make([]interface{}, 0, 2) if len(r.Params) > 0 { - minconf, ok := r.Params[0].(float64) - if !ok { - return errors.New("first optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[0], &minconf); err != nil { + return fmt.Errorf("first optional parameter 'minconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } if len(r.Params) > 1 { - includeempty, ok := r.Params[1].(bool) - if !ok { - return errors.New("second optional parameter includeempt must be a bool") + var includeempty bool + if err := json.Unmarshal(r.Params[1], &includeempty); err != nil { + return fmt.Errorf("second optional parameter 'includeempty' must be a bool: %v", err) } optArgs = append(optArgs, includeempty) } @@ -4510,21 +4396,19 @@ func (cmd *ListReceivedByAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListReceivedByAddressCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listreceivedbyaddress", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 2) if cmd.MinConf != 1 || cmd.IncludeEmpty != false { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } - if cmd.IncludeEmpty != false { - raw.Params = append(raw.Params, cmd.IncludeEmpty) + params = append(params, cmd.IncludeEmpty) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4543,16 +4427,16 @@ func (cmd *ListReceivedByAddressCmd) UnmarshalJSON(b []byte) error { optArgs := make([]interface{}, 0, 2) if len(r.Params) > 0 { - minconf, ok := r.Params[0].(float64) - if !ok { - return errors.New("first optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[0], &minconf); err != nil { + return fmt.Errorf("first optional parameter 'minconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } if len(r.Params) > 1 { - includeempty, ok := r.Params[1].(bool) - if !ok { - return errors.New("second optional parameter includeempt must be a bool") + var includeempty bool + if err := json.Unmarshal(r.Params[1], &includeempty); err != nil { + return fmt.Errorf("second optional parameter 'includeempty' must be a bool: %v", err) } optArgs = append(optArgs, includeempty) } @@ -4625,21 +4509,19 @@ func (cmd *ListSinceBlockCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListSinceBlockCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listsinceblock", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 2) if cmd.BlockHash != "" || cmd.TargetConfirmations != 1 { - raw.Params = append(raw.Params, cmd.BlockHash) + params = append(params, cmd.BlockHash) } - if cmd.TargetConfirmations != 1 { - raw.Params = append(raw.Params, cmd.TargetConfirmations) + params = append(params, cmd.TargetConfirmations) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4658,18 +4540,18 @@ func (cmd *ListSinceBlockCmd) UnmarshalJSON(b []byte) error { optArgs := make([]interface{}, 0, 2) if len(r.Params) > 0 { - blockhash, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter blockhash must be a string") + var blockhash string + if err := json.Unmarshal(r.Params[0], &blockhash); err != nil { + return fmt.Errorf("first optional parameter 'blockhash' must be a string: %v", err) } optArgs = append(optArgs, blockhash) } if len(r.Params) > 1 { - targetconfirmations, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter targetconfirmations must be a number") + var targetconfirmations int + if err := json.Unmarshal(r.Params[1], &targetconfirmations); err != nil { + return fmt.Errorf("second optional parameter 'targetconfirmations' must be an integer: %v", err) } - optArgs = append(optArgs, int(targetconfirmations)) + optArgs = append(optArgs, targetconfirmations) } newCmd, err := NewListSinceBlockCmd(r.Id, optArgs...) @@ -4751,24 +4633,22 @@ func (cmd *ListTransactionsCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListTransactionsCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listtransactions", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 3) if cmd.Account != "" || cmd.Count != 10 || cmd.From != 0 { - raw.Params = append(raw.Params, cmd.Account) + params = append(params, cmd.Account) } - if cmd.Count != 10 || cmd.From != 0 { - raw.Params = append(raw.Params, cmd.Count) + params = append(params, cmd.Count) } if cmd.From != 0 { - raw.Params = append(raw.Params, cmd.From) + params = append(params, cmd.From) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4787,25 +4667,25 @@ func (cmd *ListTransactionsCmd) UnmarshalJSON(b []byte) error { optArgs := make([]interface{}, 0, 3) if len(r.Params) > 0 { - account, ok := r.Params[0].(string) - if !ok { - return errors.New("first optional parameter account must be a string") + var account string + if err := json.Unmarshal(r.Params[0], &account); err != nil { + return fmt.Errorf("first optional parameter 'account' must be a string: %v", err) } optArgs = append(optArgs, account) } if len(r.Params) > 1 { - count, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter count must be a number") + var count int + if err := json.Unmarshal(r.Params[1], &count); err != nil { + return fmt.Errorf("second optional parameter 'count' must be an integer: %v", err) } - optArgs = append(optArgs, int(count)) + optArgs = append(optArgs, count) } if len(r.Params) > 2 { - from, ok := r.Params[2].(float64) - if !ok { - return errors.New("third optional parameter from must be a number") + var from int + if err := json.Unmarshal(r.Params[2], &from); err != nil { + return fmt.Errorf("third optional parameter 'from' must be an integer: %v", err) } - optArgs = append(optArgs, int(from)) + optArgs = append(optArgs, from) } newCmd, err := NewListTransactionsCmd(r.Id, optArgs...) @@ -4885,25 +4765,22 @@ func (cmd *ListUnspentCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListUnspentCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "listunspent", - Id: cmd.id, - Params: []interface{}{}, - } - + params := make([]interface{}, 0, 3) if cmd.MinConf != 1 || cmd.MaxConf != 99999 || len(cmd.Addresses) != 0 { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } - if cmd.MaxConf != 99999 || len(cmd.Addresses) != 0 { - raw.Params = append(raw.Params, cmd.MaxConf) + params = append(params, cmd.MaxConf) } - if len(cmd.Addresses) != 0 { - raw.Params = append(raw.Params, cmd.Addresses) + params = append(params, cmd.Addresses) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -4922,34 +4799,25 @@ func (cmd *ListUnspentCmd) UnmarshalJSON(b []byte) error { optArgs := make([]interface{}, 0, 3) if len(r.Params) > 0 { - minconf, ok := r.Params[0].(float64) - if !ok { - return errors.New("first optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[0], &minconf); err != nil { + return fmt.Errorf("first optional parameter 'minconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } if len(r.Params) > 1 { - maxconf, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter maxconf must be a number") + var maxconf int + if err := json.Unmarshal(r.Params[1], &maxconf); err != nil { + return fmt.Errorf("second optional parameter 'maxconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(maxconf)) + optArgs = append(optArgs, maxconf) } if len(r.Params) > 2 { - iaddr, ok := r.Params[2].([]interface{}) - if !ok { - return errors.New("third optional parameter addresses must be an array") + var addrs []string + if err := json.Unmarshal(r.Params[2], &addrs); err != nil { + return fmt.Errorf("third optional parameter 'addresses' must be an array of strings: %v", err) } - - addr := make([]string, len(iaddr)) - for i, val := range iaddr { - addr[i], ok = val.(string) - if !ok { - return errors.New("optional parameter addreses must be an array of strings") - } - } - - optArgs = append(optArgs, addr) + optArgs = append(optArgs, addrs) } newCmd, err := NewListUnspentCmd(r.Id, optArgs...) @@ -5009,19 +4877,17 @@ func (cmd *LockUnspentCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *LockUnspentCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "lockunspent", - Id: cmd.id, - Params: []interface{}{ - cmd.Unlock, - }, - } - + params := make([]interface{}, 1, 2) + params[0] = cmd.Unlock if len(cmd.Transactions) > 0 { - raw.Params = append(raw.Params, cmd.Transactions) + params = append(params, cmd.Transactions) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5038,42 +4904,19 @@ func (cmd *LockUnspentCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - unlock, ok := r.Params[0].(bool) - if !ok { - return errors.New("first parameter unlock must be a bool") + var unlock bool + if err := json.Unmarshal(r.Params[0], &unlock); err != nil { + return fmt.Errorf("first parameter 'unlock' must be a bool: %v", err) } optArgs := make([][]TransactionInput, 0, 1) if len(r.Params) > 1 { - iinputs, ok := r.Params[1].([]map[string]interface{}) - if !ok { - return errors.New("second optional parameter transactions must be an array of objects") + var transactions []TransactionInput + if err := json.Unmarshal(r.Params[0], &transactions); err != nil { + return fmt.Errorf("second optional parameter 'transactions' "+ + "must be a JSON array of transaction input JSON objects: %v", err) } - inputs := make([]TransactionInput, len(iinputs)) - for i, v := range iinputs { - if len(v) != 2 { - return errors.New("input with wrong number of members") - } - txid, ok := v["txid"] - if !ok { - return errors.New("input without txid") - } - inputs[i].Txid, ok = txid.(string) - if !ok { - return errors.New("input txid isn't a string") - } - - vout, ok := v["vout"] - if !ok { - return errors.New("input without vout") - } - fvout, ok := vout.(float64) - if !ok { - return errors.New("input vout not a number") - } - inputs[i].Vout = int(fvout) - } - optArgs = append(optArgs, inputs) + optArgs = append(optArgs, transactions) } newCmd, err := NewLockUnspentCmd(r.Id, unlock, optArgs...) @@ -5151,25 +4994,22 @@ func (cmd *MoveCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *MoveCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "move", - Id: cmd.id, - Params: []interface{}{ - cmd.FromAccount, - cmd.ToAccount, - float64(cmd.Amount) / 1e8, //convert to BTC - }, - } - + params := make([]interface{}, 3, 5) + params[0] = cmd.FromAccount + params[1] = cmd.ToAccount + params[2] = float64(cmd.Amount) / 1e8 //convert to BTC if cmd.MinConf != 1 || cmd.Comment != "" { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } - if cmd.Comment != "" { - raw.Params = append(raw.Params, cmd.Comment) + params = append(params, cmd.Comment) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5186,42 +5026,42 @@ func (cmd *MoveCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - fromaccount, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter fromaccount must be a string") + var fromaccount string + if err := json.Unmarshal(r.Params[0], &fromaccount); err != nil { + return fmt.Errorf("first parameter 'fromaccount' must be a string: %v", err) } - toaccount, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter toaccount must be a string") + var toaccount string + if err := json.Unmarshal(r.Params[1], &toaccount); err != nil { + return fmt.Errorf("second parameter 'toaccount' must be a string: %v", err) } - amount, ok := r.Params[2].(float64) - if !ok { - return errors.New("third parameter toaccount must be a number") + var famount float64 + if err := json.Unmarshal(r.Params[2], &famount); err != nil { + return fmt.Errorf("third parameter 'amount' must be a number: %v", err) } - - samount, err := JSONToAmount(amount) + amount, err := JSONToAmount(famount) if err != nil { return err } + optArgs := make([]interface{}, 0, 2) if len(r.Params) > 3 { - minconf, ok := r.Params[3].(float64) - if !ok { - return errors.New("fourth optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[3], &minconf); err != nil { + return fmt.Errorf("fourth optional parameter 'minconf' must be an integer: %v", err) } - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } if len(r.Params) > 4 { - comment, ok := r.Params[4].(string) - if !ok { - return errors.New("fifth optional parameter comment must be a string") + var comment string + if err := json.Unmarshal(r.Params[4], &comment); err != nil { + return fmt.Errorf("fifth optional parameter 'comment' must be a string: %v", err) } optArgs = append(optArgs, comment) } - newCmd, err := NewMoveCmd(r.Id, fromaccount, toaccount, samount, + newCmd, err := NewMoveCmd(r.Id, fromaccount, toaccount, amount, optArgs...) if err != nil { return err @@ -5265,13 +5105,11 @@ func (cmd *PingCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *PingCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "ping", - Id: cmd.id, - Params: []interface{}{}, + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err } - return json.Marshal(raw) } @@ -5374,29 +5212,25 @@ func (cmd *SendFromCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SendFromCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "sendfrom", - Id: cmd.id, - Params: []interface{}{ - cmd.FromAccount, - cmd.ToAddress, - float64(cmd.Amount) / 1e8, //convert to BTC - }, - } - + params := make([]interface{}, 3, 6) + params[0] = cmd.FromAccount + params[1] = cmd.ToAddress + params[2] = float64(cmd.Amount) / 1e8 //convert to BTC if cmd.MinConf != 1 || cmd.Comment != "" || cmd.CommentTo != "" { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } - if cmd.Comment != "" || cmd.CommentTo != "" { - raw.Params = append(raw.Params, cmd.Comment) + params = append(params, cmd.Comment) } - if cmd.CommentTo != "" { - raw.Params = append(raw.Params, cmd.CommentTo) + params = append(params, cmd.CommentTo) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5413,51 +5247,49 @@ func (cmd *SendFromCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - fromaccount, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter fromaccount must be a string") + var fromaccount string + if err := json.Unmarshal(r.Params[0], &fromaccount); err != nil { + return fmt.Errorf("first parameter 'fromaccount' must be a string: %v", err) } - toaccount, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter toaccount must be a string") + var toaddress string + if err := json.Unmarshal(r.Params[1], &toaddress); err != nil { + return fmt.Errorf("second parameter 'toaddress' must be a string: %v", err) } - amount, ok := r.Params[2].(float64) - if !ok { - return errors.New("third parameter toaccount must be a number") + var famount float64 + if err := json.Unmarshal(r.Params[2], &famount); err != nil { + return fmt.Errorf("third parameter 'amount' must be a number: %v", err) } - - samount, err := JSONToAmount(amount) + amount, err := JSONToAmount(famount) if err != nil { return err } optArgs := make([]interface{}, 0, 3) if len(r.Params) > 3 { - minconf, ok := r.Params[3].(float64) - if !ok { - return errors.New("fourth optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[3], &minconf); err != nil { + return fmt.Errorf("fourth optional parameter 'minconf' must be an integer: %v", err) } - - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } if len(r.Params) > 4 { - comment, ok := r.Params[4].(string) - if !ok { - return errors.New("fifth optional parameter comment must be a string") + var comment string + if err := json.Unmarshal(r.Params[4], &comment); err != nil { + return fmt.Errorf("fifth optional parameter 'comment' must be a string: %v", err) } optArgs = append(optArgs, comment) } if len(r.Params) > 5 { - commentto, ok := r.Params[5].(string) - if !ok { - return errors.New("sixth optional parameter commentto must be a string") + var commentto string + if err := json.Unmarshal(r.Params[5], &commentto); err != nil { + return fmt.Errorf("sixth optional parameter 'commentto' must be a string: %v", err) } optArgs = append(optArgs, commentto) } - newCmd, err := NewSendFromCmd(r.Id, fromaccount, toaccount, samount, + newCmd, err := NewSendFromCmd(r.Id, fromaccount, toaddress, amount, optArgs...) if err != nil { return err @@ -5531,29 +5363,26 @@ func (cmd *SendManyCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SendManyCmd) MarshalJSON() ([]byte, error) { - floatAmount := make(map[string]float64) - + floatAmounts := make(map[string]float64, len(cmd.Amounts)) for k, v := range cmd.Amounts { - floatAmount[k] = float64(v) / 1e8 - } - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "sendmany", - Id: cmd.id, - Params: []interface{}{ - cmd.FromAccount, - floatAmount, - }, + floatAmounts[k] = float64(v) / 1e8 } + params := make([]interface{}, 2, 4) + params[0] = cmd.FromAccount + params[1] = floatAmounts if cmd.MinConf != 1 || cmd.Comment != "" { - raw.Params = append(raw.Params, cmd.MinConf) + params = append(params, cmd.MinConf) } - if cmd.Comment != "" { - raw.Params = append(raw.Params, cmd.Comment) + params = append(params, cmd.Comment) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5570,42 +5399,36 @@ func (cmd *SendManyCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - fromaccount, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter fromaccount must be a string") + var fromaccount string + if err := json.Unmarshal(r.Params[0], &fromaccount); err != nil { + return fmt.Errorf("first parameter 'fromaccount' must be a string: %v", err) } - iamounts, ok := r.Params[1].(map[string]interface{}) - if !ok { - return errors.New("second parameter toaccount must be a JSON object") + var famounts map[string]float64 + if err := json.Unmarshal(r.Params[1], &famounts); err != nil { + return fmt.Errorf("second parameter 'amounts' must be a JSON object of address to amount mappings: %v", err) } - - amounts := make(map[string]int64) - for k, v := range iamounts { - famount, ok := v.(float64) - if !ok { - return errors.New("second parameter toaccount must be a string to number map") - } - var err error - amounts[k], err = JSONToAmount(famount) + amounts := make(map[string]int64, len(famounts)) + for k, v := range famounts { + amount, err := JSONToAmount(v) if err != nil { return err } + amounts[k] = amount } optArgs := make([]interface{}, 0, 2) if len(r.Params) > 2 { - minconf, ok := r.Params[2].(float64) - if !ok { - return errors.New("third optional parameter minconf must be a number") + var minconf int + if err := json.Unmarshal(r.Params[2], &minconf); err != nil { + return fmt.Errorf("third optional parameter 'minconf' must be an integer: %v", err) } - - optArgs = append(optArgs, int(minconf)) + optArgs = append(optArgs, minconf) } if len(r.Params) > 3 { - comment, ok := r.Params[3].(string) - if !ok { - return errors.New("fourth optional parameter comment must be a string") + var comment string + if err := json.Unmarshal(r.Params[3], &comment); err != nil { + return fmt.Errorf("fourth optional parameter 'comment' must be a string: %v", err) } optArgs = append(optArgs, comment) } @@ -5665,19 +5488,17 @@ func (cmd *SendRawTransactionCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SendRawTransactionCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "sendrawtransaction", - Id: cmd.id, - Params: []interface{}{ - cmd.HexTx, - }, - } - + params := make([]interface{}, 1, 2) + params[0] = cmd.HexTx if cmd.AllowHighFees { - raw.Params = append(raw.Params, cmd.AllowHighFees) + params = append(params, cmd.AllowHighFees) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5694,16 +5515,16 @@ func (cmd *SendRawTransactionCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - hextx, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter hextx must be a string") + var hextx string + if err := json.Unmarshal(r.Params[0], &hextx); err != nil { + return fmt.Errorf("first parameter 'hextx' must be a string: %v", err) } optArgs := make([]bool, 0, 1) if len(r.Params) > 1 { - allowHighFees, ok := r.Params[1].(bool) - if !ok { - return errors.New("second optional parameter allowhighfees must be a bool") + var allowHighFees bool + if err := json.Unmarshal(r.Params[1], &allowHighFees); err != nil { + return fmt.Errorf("second optional parameter 'allowhighfees' must be a bool: %v", err) } optArgs = append(optArgs, allowHighFees) } @@ -5781,24 +5602,21 @@ func (cmd *SendToAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SendToAddressCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "sendtoaddress", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - float64(cmd.Amount) / 1e8, //convert to BTC - }, - } - + params := make([]interface{}, 2, 4) + params[0] = cmd.Address + params[1] = float64(cmd.Amount) / 1e8 //convert to BTC if cmd.Comment != "" || cmd.CommentTo != "" { - raw.Params = append(raw.Params, cmd.Comment) + params = append(params, cmd.Comment) } - if cmd.CommentTo != "" { - raw.Params = append(raw.Params, cmd.CommentTo) + params = append(params, cmd.CommentTo) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5815,38 +5633,37 @@ func (cmd *SendToAddressCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - toaccount, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter toaccount must be a string") + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } - amount, ok := r.Params[1].(float64) - if !ok { - return errors.New("second parameter amount must be a number") + var famount float64 + if err := json.Unmarshal(r.Params[1], &famount); err != nil { + return fmt.Errorf("second parameter 'amount' must be a number: %v", err) } - - samount, err := JSONToAmount(amount) + amount, err := JSONToAmount(famount) if err != nil { return err } + optArgs := make([]interface{}, 0, 2) if len(r.Params) > 2 { - comment, ok := r.Params[2].(string) - if !ok { - return errors.New("third optional parameter comment must be a string") + var comment string + if err := json.Unmarshal(r.Params[2], &comment); err != nil { + return fmt.Errorf("third optional parameter 'comment' must be a string: %v", err) } optArgs = append(optArgs, comment) } if len(r.Params) > 3 { - commentto, ok := r.Params[3].(string) - if !ok { - return errors.New("sixth optional parameter commentto must be a string") + var commentto string + if err := json.Unmarshal(r.Params[3], &commentto); err != nil { + return fmt.Errorf("fourth optional parameter 'commentto' must be a string: %v", err) } optArgs = append(optArgs, commentto) } - newCmd, err := NewSendToAddressCmd(r.Id, toaccount, samount, - optArgs...) + newCmd, err := NewSendToAddressCmd(r.Id, address, amount, optArgs...) if err != nil { return err } @@ -5894,16 +5711,16 @@ func (cmd *SetAccountCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SetAccountCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "setaccount", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - cmd.Account, - }, + params := []interface{}{ + cmd.Address, + cmd.Account, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -5920,14 +5737,14 @@ func (cmd *SetAccountCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be a string") + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } - account, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter account must be a string") + var account string + if err := json.Unmarshal(r.Params[1], &account); err != nil { + return fmt.Errorf("second parameter 'account' must be a string: %v", err) } newCmd, err := NewSetAccountCmd(r.Id, address, account) @@ -5986,19 +5803,17 @@ func (cmd *SetGenerateCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SetGenerateCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "setgenerate", - Id: cmd.id, - Params: []interface{}{ - cmd.Generate, - }, - } - + params := make([]interface{}, 1, 2) + params[0] = cmd.Generate if cmd.GenProcLimit != 0 { - raw.Params = append(raw.Params, cmd.GenProcLimit) + params = append(params, cmd.GenProcLimit) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6015,18 +5830,18 @@ func (cmd *SetGenerateCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - generate, ok := r.Params[0].(bool) - if !ok { - return errors.New("first parameter generate must be a bool") + var generate bool + if err := json.Unmarshal(r.Params[0], &generate); err != nil { + return fmt.Errorf("first parameter 'generate' must be a bool: %v", err) } optArgs := make([]int, 0, 1) if len(r.Params) > 1 { - genproclimit, ok := r.Params[1].(float64) - if !ok { - return errors.New("second parameter genproclimit must be a number") + var genproclimit int + if err := json.Unmarshal(r.Params[1], &genproclimit); err != nil { + return fmt.Errorf("second optional parameter 'genproclimit' must be an integer: %v", err) } - optArgs = append(optArgs, int(genproclimit)) + optArgs = append(optArgs, genproclimit) } newCmd, err := NewSetGenerateCmd(r.Id, generate, optArgs...) @@ -6074,15 +5889,15 @@ func (cmd *SetTxFeeCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SetTxFeeCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "settxfee", - Id: cmd.id, - Params: []interface{}{ - float64(cmd.Amount) / 1e8, //convert to BTC - }, + params := []interface{}{ + float64(cmd.Amount) / 1e8, //convert to BTC } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6099,17 +5914,16 @@ func (cmd *SetTxFeeCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - amount, ok := r.Params[0].(float64) - if !ok { - return errors.New("first parameter amount must be a number") + var famount float64 + if err := json.Unmarshal(r.Params[0], &famount); err != nil { + return fmt.Errorf("first parameter 'amount' must be a number: %v", err) } - - samount, err := JSONToAmount(amount) + amount, err := JSONToAmount(famount) if err != nil { return err } - newCmd, err := NewSetTxFeeCmd(r.Id, samount) + newCmd, err := NewSetTxFeeCmd(r.Id, amount) if err != nil { return err } @@ -6156,16 +5970,16 @@ func (cmd *SignMessageCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SignMessageCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "signmessage", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - cmd.Message, - }, + params := []interface{}{ + cmd.Address, + cmd.Message, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6182,14 +5996,14 @@ func (cmd *SignMessageCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be a string") + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } - message, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter message must be a string") + var message string + if err := json.Unmarshal(r.Params[1], &message); err != nil { + return fmt.Errorf("second parameter 'message' must be a string: %v", err) } newCmd, err := NewSignMessageCmd(r.Id, address, message) @@ -6281,25 +6095,23 @@ func (cmd *SignRawTransactionCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SignRawTransactionCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "signrawtransaction", - Id: cmd.id, - Params: []interface{}{ - cmd.RawTx, - }, - } - + params := make([]interface{}, 1, 4) + params[0] = cmd.RawTx if len(cmd.Inputs) > 0 || len(cmd.PrivKeys) > 0 || cmd.Flags != "" { - raw.Params = append(raw.Params, cmd.Inputs) + params = append(params, cmd.Inputs) } if len(cmd.PrivKeys) > 0 || cmd.Flags != "" { - raw.Params = append(raw.Params, cmd.PrivKeys) + params = append(params, cmd.PrivKeys) } if cmd.Flags != "" { - raw.Params = append(raw.Params, cmd.Flags) + params = append(params, cmd.Flags) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6316,81 +6128,33 @@ func (cmd *SignRawTransactionCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - rawtx, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter rawtx must be a string") + var rawtx string + if err := json.Unmarshal(r.Params[0], &rawtx); err != nil { + return fmt.Errorf("first parameter 'rawtx' must be a string: %v", err) } optArgs := make([]interface{}, 0, 3) if len(r.Params) > 1 { - ip, ok := r.Params[1].([]interface{}) - if !ok { - return errors.New("second optional parameter inputs must be an array") - } - inputs := make([]RawTxInput, len(ip)) - for i, val := range ip { - mip, ok := val.(map[string]interface{}) - if !ok { - return errors.New("second optional parameter inputs must be an array of objects") - } - txid, ok := mip["txid"] - if !ok { - return errors.New("txid missing in input object") - } - - inputs[i].Txid, ok = txid.(string) - if !ok { - return errors.New("txid not a string in input object") - } - - vout, ok := mip["vout"] - if !ok { - return errors.New("vout missing in input object") - } - fvout, ok := vout.(float64) - if !ok { - return errors.New("vout not a number in input object") - } - inputs[i].Vout = int(fvout) - - scriptpubkey, ok := mip["scriptpubkey"] - if !ok { - return errors.New("scriptpubkey missing in input object") - } - - inputs[i].ScriptPubKey, ok = scriptpubkey.(string) - if !ok { - return errors.New("scriptpubkey not a string in input object") - } - - redeemScript, ok := mip["redeemScript"] - if !ok { - return errors.New("redeemScript missing in input object") - } - - inputs[i].RedeemScript, ok = redeemScript.(string) - if !ok { - return errors.New("redeemScript not a string in input object") - } - + var inputs []RawTxInput + if err := json.Unmarshal(r.Params[1], &inputs); err != nil { + return fmt.Errorf("second optional parameter 'inputs' "+ + "must be a JSON array of raw transaction input JSON objects: %v", err) } optArgs = append(optArgs, inputs) } if len(r.Params) > 2 { - privkeys, ok := r.Params[2].([]string) - if !ok { - return errors.New("third optional parameter privkeys is not an array of strings") + var privkeys []string + if err := json.Unmarshal(r.Params[2], &privkeys); err != nil { + return fmt.Errorf("third optional parameter 'privkeys' must be an array of strings: %v", err) } - optArgs = append(optArgs, privkeys) } if len(r.Params) > 3 { - flags, ok := r.Params[3].([]string) - if !ok { - return errors.New("fourth optional parameter flags is not a string") + var flags string + if err := json.Unmarshal(r.Params[3], &flags); err != nil { + return fmt.Errorf("fourth optional parameter 'flags' must be a string: %v", err) } - optArgs = append(optArgs, flags) } @@ -6438,13 +6202,11 @@ func (cmd *StopCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *StopCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "stop", - Id: cmd.id, - Params: []interface{}{}, + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err } - return json.Marshal(raw) } @@ -6523,19 +6285,17 @@ func (cmd *SubmitBlockCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *SubmitBlockCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "submitblock", - Id: cmd.id, - Params: []interface{}{ - cmd.HexBlock, - }, - } - + params := make([]interface{}, 1, 2) + params[0] = cmd.HexBlock if cmd.Options != nil { - raw.Params = append(raw.Params, cmd.Options) + params = append(params, cmd.Options) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6552,29 +6312,19 @@ func (cmd *SubmitBlockCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - hexblock, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter hexblock must be a string") + var hexblock string + if err := json.Unmarshal(r.Params[0], &hexblock); err != nil { + return fmt.Errorf("first parameter 'hexblock' must be a string: %v", err) } optArgs := make([]*SubmitBlockOptions, 0, 1) if len(r.Params) == 2 { - obj, ok := r.Params[1].(map[string]interface{}) - if !ok { - return errors.New("second optioanl parameter options must be an object") + var options SubmitBlockOptions + if err := json.Unmarshal(r.Params[1], &options); err != nil { + return fmt.Errorf("second optional parameter 'options' must "+ + "be a JSON object of submit block options: %v", err) } - options := new(SubmitBlockOptions) - - // workid is optional - iworkid, ok := obj["workid"] - if ok { - workid, ok := iworkid.(string) - if !ok { - return errors.New("object member workid must be a string") - } - options.WorkId = workid - } - optArgs = append(optArgs, options) + optArgs = append(optArgs, &options) } newCmd, err := NewSubmitBlockCmd(r.Id, hexblock, optArgs...) @@ -6623,15 +6373,15 @@ func (cmd *ValidateAddressCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ValidateAddressCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "validateaddress", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - }, + params := []interface{}{ + cmd.Address, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6648,9 +6398,9 @@ func (cmd *ValidateAddressCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be a string") + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } newCmd, err := NewValidateAddressCmd(r.Id, address) @@ -6715,22 +6465,20 @@ func (cmd *VerifyChainCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *VerifyChainCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "verifychain", - Id: cmd.id, - Params: []interface{}{}, - } - // XXX(oga) magic numbers + params := make([]interface{}, 0, 2) if cmd.CheckLevel != 3 || cmd.CheckDepth != 288 { - raw.Params = append(raw.Params, cmd.CheckLevel) + params = append(params, cmd.CheckLevel) } - if cmd.CheckDepth != 288 { - raw.Params = append(raw.Params, cmd.CheckDepth) + params = append(params, cmd.CheckDepth) } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6749,21 +6497,19 @@ func (cmd *VerifyChainCmd) UnmarshalJSON(b []byte) error { optArgs := make([]int32, 0, 2) if len(r.Params) > 0 { - checklevel, ok := r.Params[0].(float64) - if !ok { - return errors.New("first optional parameter checklevel must be a number") + var checklevel int32 + if err := json.Unmarshal(r.Params[0], &checklevel); err != nil { + return fmt.Errorf("first optional parameter 'checklevel' must be a 32-bit integer: %v", err) } - - optArgs = append(optArgs, int32(checklevel)) + optArgs = append(optArgs, checklevel) } if len(r.Params) > 1 { - checkdepth, ok := r.Params[1].(float64) - if !ok { - return errors.New("second optional parameter checkdepth must be a number") + var checkdepth int32 + if err := json.Unmarshal(r.Params[1], &checkdepth); err != nil { + return fmt.Errorf("second optional parameter 'checkdepth' must be a 32-bit integer: %v", err) } - - optArgs = append(optArgs, int32(checkdepth)) + optArgs = append(optArgs, checkdepth) } newCmd, err := NewVerifyChainCmd(r.Id, optArgs...) @@ -6817,17 +6563,17 @@ func (cmd *VerifyMessageCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *VerifyMessageCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "verifymessage", - Id: cmd.id, - Params: []interface{}{ - cmd.Address, - cmd.Signature, - cmd.Message, - }, + params := []interface{}{ + cmd.Address, + cmd.Signature, + cmd.Message, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -6844,19 +6590,19 @@ func (cmd *VerifyMessageCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - address, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter address must be a string") + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) } - signature, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter signature must be a string") + var signature string + if err := json.Unmarshal(r.Params[1], &signature); err != nil { + return fmt.Errorf("second parameter 'signature' must be a string: %v", err) } - message, ok := r.Params[2].(string) - if !ok { - return errors.New("third parameter message must be a string") + var message string + if err := json.Unmarshal(r.Params[2], &message); err != nil { + return fmt.Errorf("third parameter 'message' must be a string: %v", err) } newCmd, err := NewVerifyMessageCmd(r.Id, address, signature, message) @@ -6903,13 +6649,11 @@ func (cmd *WalletLockCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *WalletLockCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "walletlock", - Id: cmd.id, - Params: []interface{}{}, + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err } - return json.Marshal(raw) } @@ -6974,16 +6718,16 @@ func (cmd *WalletPassphraseCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *WalletPassphraseCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "walletpassphrase", - Id: cmd.id, - Params: []interface{}{ - cmd.Passphrase, - cmd.Timeout, - }, + params := []interface{}{ + cmd.Passphrase, + cmd.Timeout, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -7000,17 +6744,17 @@ func (cmd *WalletPassphraseCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - passphrase, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter passphrase must be a string") + var passphrase string + if err := json.Unmarshal(r.Params[0], &passphrase); err != nil { + return fmt.Errorf("first parameter 'passphrase' must be a string: %v", err) } - timeout, ok := r.Params[1].(float64) - if !ok { - return errors.New("second parameter timeout must be a number") + var timeout int64 + if err := json.Unmarshal(r.Params[1], &timeout); err != nil { + return fmt.Errorf("second parameter 'timeout' must be an integer: %v", err) } - newCmd, err := NewWalletPassphraseCmd(r.Id, passphrase, int64(timeout)) + newCmd, err := NewWalletPassphraseCmd(r.Id, passphrase, timeout) if err != nil { return err } @@ -7058,16 +6802,16 @@ func (cmd *WalletPassphraseChangeCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *WalletPassphraseChangeCmd) MarshalJSON() ([]byte, error) { - raw := RawCmd{ - Jsonrpc: "1.0", - Method: "walletpassphrasechange", - Id: cmd.id, - Params: []interface{}{ - cmd.OldPassphrase, - cmd.NewPassphrase, - }, + params := []interface{}{ + cmd.OldPassphrase, + cmd.NewPassphrase, } + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } return json.Marshal(raw) } @@ -7084,14 +6828,14 @@ func (cmd *WalletPassphraseChangeCmd) UnmarshalJSON(b []byte) error { return ErrWrongNumberOfParams } - oldpassphrase, ok := r.Params[0].(string) - if !ok { - return errors.New("first parameter oldpassphrase must be a string") + var oldpassphrase string + if err := json.Unmarshal(r.Params[0], &oldpassphrase); err != nil { + return fmt.Errorf("first parameter 'oldpassphrase' must be a string: %v", err) } - newpassphrase, ok := r.Params[1].(string) - if !ok { - return errors.New("second parameter newpassphrase must be a string") + var newpassphrase string + if err := json.Unmarshal(r.Params[1], &newpassphrase); err != nil { + return fmt.Errorf("second parameter 'newpassphrase' must be a string: %v", err) } newCmd, err := NewWalletPassphraseChangeCmd(r.Id, oldpassphrase, newpassphrase) diff --git a/test_coverage.txt b/test_coverage.txt index 76280274..df9633d6 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,75 +1,15 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 100.00% (9/9) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 100.00% (8/8) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 100.00% (8/8) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 100.00% (8/8) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 100.00% (6/6) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 100.00% (4/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 100.00% (4/4) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 100.00% (2/2) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) @@ -77,62 +17,65 @@ github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) @@ -264,202 +207,259 @@ github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.77% (79/88) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 79.41% (27/34) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 77.42% (24/31) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.00% (27/36) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 73.08% (19/26) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) -github.com/conformal/btcjson/jsoncmd.go ConvertCreateRawTxParams 72.22% (26/36) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 72.22% (13/18) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 71.43% (15/21) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) +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/jsonfxns.go jsonRpcSend 62.50% (10/16) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 62.50% (5/8) 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/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 57.38% (70/122) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.MarshalJSON 57.14% (4/7) 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) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 44.83% (13/29) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 30.56% (11/36) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 22.03% (13/59) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/2) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmdGenerator 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.11% (2209/2828) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.71% (2333/2964) From d211c4c6c8de00052ccf5e836132c794d873d2c2 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 10 Apr 2014 22:26:23 -0500 Subject: [PATCH 138/229] Correct TxID JSON key of ListTransactionsResult. --- jsonapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi.go b/jsonapi.go index d3837461..d889e9ec 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -125,7 +125,7 @@ type ListTransactionsResult struct { BlockHash string `json:"blockhash,omitempty"` BlockIndex int64 `json:"blockindex,omitempty"` BlockTime int64 `json:"blocktime,omitempty"` - TxID string `json:"amount"` + TxID string `json:"txid"` WalletConflicts []string `json:"walletconflicts"` Time int64 `json:"time"` TimeReceived int64 `json:"timereceived"` From 75a237bc0d34439c4b4a4761aaf46fe53d4d2cd3 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 11 Apr 2014 09:39:08 -0400 Subject: [PATCH 139/229] Add support for GetTransactionResult. ok @jcvernaleo --- jsonapi.go | 31 +++++++++++++++++++++++++++++++ jsonapi_test.go | 2 ++ test_coverage.txt | 6 +++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index d889e9ec..808f505f 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -113,6 +113,31 @@ type GetRawMempoolResult struct { Depends []string `json:"depends"` } +// GetTransactionDetailsResult models the details data from the gettransaction command. +type GetTransactionDetailsResult struct { + Account string `json:"account"` + Address string `json:"address"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee,omitempty"` +} + +// GetTransactionResult models the data from the gettransaction command. +type GetTransactionResult struct { + Amount float64 `json:"amount"` + Fee float64 `json:"fee,omitempty"` + Confirmations int64 `json:"confirmations"` + BlockHash string `json:"blockhash"` + BlockIndex int64 `json:"blockindex"` + BlockTime int64 `json:"blocktime"` + TxID string `json:"txid"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Details []GetTransactionDetailsResult `json:"details"` + Hex string `json:"hex"` +} + // ListTransactionsResult models the data from the listtransactions command. type ListTransactionsResult struct { Account string `json:"account"` @@ -1027,6 +1052,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } } + case "gettransaction": + var res GetTransactionResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getwork": // getwork can either return a JSON object or a boolean // depending on whether or not data was provided. Choose the diff --git a/jsonapi_test.go b/jsonapi_test.go index a78cbe60..8ceab3eb 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -342,6 +342,8 @@ var resulttests = []struct { {"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, + {"gettransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"gettransaction", []byte(`{"error":null,"id":1,"result":{"Amount":0.0}}`), false, true}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, diff --git a/test_coverage.txt b/test_coverage.txt index df9633d6..baeae148 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -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/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsonapi.go ReadResultCmd 58.73% (74/126) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 57.38% (70/122) 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) @@ -461,5 +461,5 @@ github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.71% (2333/2964) +github.com/conformal/btcjson --------------------------------------- 78.75% (2338/2969) From 0512ddd8f828f6f3350049d97e2f93242a843111 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 10 Apr 2014 23:00:15 -0500 Subject: [PATCH 140/229] Correct ListTransactionsResult. This commit tweaks the ListTransactions result a bit so it is compatible with the reference implementation. --- jsonapi.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 808f505f..bd21971c 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -146,7 +146,7 @@ type ListTransactionsResult struct { Amount float64 `json:"amount"` Fee float64 `json:"fee"` Confirmations int64 `json:"confirmations"` - Generated bool `json:"generated"` + Generated bool `json:"generated,omitempty"` BlockHash string `json:"blockhash,omitempty"` BlockIndex int64 `json:"blockindex,omitempty"` BlockTime int64 `json:"blocktime,omitempty"` @@ -155,7 +155,7 @@ type ListTransactionsResult struct { Time int64 `json:"time"` TimeReceived int64 `json:"timereceived"` Comment string `json:"comment,omitempty"` - OtherAccount float64 `json:"otheraccount"` + OtherAccount string `json:"otheraccount"` } // TxRawResult models the data from the getrawtransaction command. From 1ff465ae88357aed20ae7ba42dbb417769de371d Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 09:14:08 -0500 Subject: [PATCH 141/229] Remove RegisterCustomCmdGenerator. This is no longer required since the RawCmd params now consist of a slice of raw JSON messages which the registered parser can directly unmarshal. ok @jcvernaleo --- jsoncmd.go | 16 ---- test_coverage.txt | 225 +++++++++++++++++++++++----------------------- 2 files changed, 112 insertions(+), 129 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index e8621ef6..39913821 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -76,18 +76,6 @@ func RegisterCustomCmd(method string, parser RawCmdParser, helpString string) { customCmds[method] = cmd{parser: parser, helpString: helpString} } -// CmdGenerator is a function that returns a new concrete Cmd of -// the appropriate type for a non-standard Bitcoin command. -type CmdGenerator func() Cmd - -var customCmdGenerators = make(map[string]CmdGenerator) - -// RegisterCustomCmdGenerator registers a custom CmdGenerator func for -// a non-standard Bitcoin command. -func RegisterCustomCmdGenerator(method string, generator CmdGenerator) { - customCmdGenerators[method] = generator -} - // ParseMarshaledCmd parses a raw command and unmarshals as a Cmd. // Code that reads and handles commands should switch on the type and // type assert as the particular commands supported by the program. @@ -329,10 +317,6 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { if c, ok := customCmds[r.Method]; ok { return c.parser(&r) } - - if g, ok := customCmdGenerators[r.Method]; ok { - cmd = g() - } } if cmd == nil { diff --git a/test_coverage.txt b/test_coverage.txt index baeae148..6af7bdb3 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,10 +6,10 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) @@ -206,7 +206,6 @@ github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) @@ -262,183 +261,184 @@ github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 89.77% (79/88) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) github.com/conformal/btcjson/jsonapi.go ReadResultCmd 58.73% (74/126) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19) @@ -451,15 +451,14 @@ github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmdGenerator 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.75% (2338/2969) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.82% (2337/2965) From 351365493395d43392a33485a62120ac56efe71e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 10:37:37 -0500 Subject: [PATCH 142/229] Add new (Tls)RpcSend funcs to send a Cmd. The existing RpcCommand and TlsRpcCommand were build with CreateMessage(WithID) in mind since they return an already marshalled command. The approach was changed to use concrete commands created via the NewCmd family of functions. However, this means the caller had to manually marshal the command before calling (Tls)RpcCommand which was not very user friendly. This commit adds two new functions named RpcSend and TlsRpcSend which directly accepts a btcjson.Cmd and handles the marshalling itself. ok @jcvernaleo --- jsonapi.go | 27 +++++++ test_coverage.txt | 194 +++++++++++++++++++++++----------------------- 2 files changed, 125 insertions(+), 96 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index bd21971c..9e0f5c99 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -1229,6 +1229,33 @@ func rpcRawCommand(user string, password string, server string, return result, err } +// RpcSend sends the passed command to the provided server using the provided +// authentication details, waits for a reply, and returns a Go struct with the +// result. +func RpcSend(user string, password string, server string, cmd Cmd) (Reply, error) { + msg, err := cmd.MarshalJSON() + if err != nil { + return Reply{}, err + } + + return RpcCommand(user, password, server, msg) +} + +// TlsRpcSend sends the passed command to the provided server using the provided +// authentication details and PEM encoded certificate chain, waits for a reply, +// and returns a Go struct with the result. +func TlsRpcSend(user string, password string, server string, cmd Cmd, + certificates []byte, skipVerify bool) (Reply, error) { + + msg, err := cmd.MarshalJSON() + if err != nil { + return Reply{}, err + } + + return TlsRpcCommand(user, password, server, msg, certificates, + skipVerify) +} + // IsValidIdType checks that the Id field (which can go in any of the json // messages) is valid. json rpc 1.0 allows any (json) type, but we still need // to prevent values that cannot be marshalled from going in. json rpc 2.0 diff --git a/test_coverage.txt b/test_coverage.txt index 6af7bdb3..42437452 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -8,7 +8,9 @@ github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) @@ -78,7 +80,7 @@ github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) @@ -110,7 +112,7 @@ github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) @@ -225,6 +227,7 @@ github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1 github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) @@ -259,88 +262,85 @@ github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1 github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) @@ -350,38 +350,38 @@ github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) @@ -395,43 +395,43 @@ github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 66.67% (8/12) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) @@ -450,15 +450,17 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) +github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) +github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.82% (2337/2965) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.61% (2337/2973) From 95f8e5d6d8c117c91fbd93dc0ffffe98c96fd274 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 10:45:20 -0500 Subject: [PATCH 143/229] Deprecate CreateMessage(WithId) and update docs. This commit marks the CreateMessage and CreateMessageWithId functions as deprecated as they are no longer maintained due to the new concrete command approach. It also updates the package documentation to show the new preferred method as well as add details about btcd. ok @jcvernaleo --- doc.go | 29 +++++++++++++++++------------ jsonapi.go | 8 ++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/doc.go b/doc.go index 30fca096..c738ad13 100644 --- a/doc.go +++ b/doc.go @@ -14,7 +14,7 @@ https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list. This package provides data structures and code for marshalling and unmarshalling json for communicating with a running instance of btcd or bitcoind/bitcoin-qt. It also provides code for sending those -message. It does not provide any code for the client to actually deal +messages. It does not provide any code for the client to actually deal with the messages. Although it is meant primarily for btcd, it is possible to use this code elsewhere for interacting with a bitcoin client programatically. @@ -30,7 +30,7 @@ different method (or command) being sent. Replies will vary in form for the different commands. The basic form is: - {"result":SOMETHING,"error":null,"id":"btcd"} + {"result":SOMETHING,"error":null,"id":"SOMEID"} The result field can be as simple as an int, or a complex structure containing many nested fields. For cases where we have already worked @@ -51,8 +51,10 @@ RPC Server Authentication All RPC calls must be authenticated with a username and password. The specifics on how to configure the RPC server varies depending on the specific bitcoin implementation. For bitcoind, this is accomplished by setting rpcuser and -rpcpassword in the file ~/.bitcoin/bitcoin.conf. The default local address -of bitcoind is 127.0.0.1:8332. +rpcpassword in the file ~/.bitcoin/bitcoin.conf. For btcd, this is accomplished +by setting rpcuser and rpcpass in the file ~/.btcd/btcd.conf. The default local +address of bitcoind is 127.0.0.1:8332 and the default local address of btcd is +127.0.0.1:8334 Usage @@ -64,16 +66,18 @@ For commands where the reply structure is known, such as getinfo, one can directly access the fields in the Reply structure by type asserting the reply to the appropriate concrete type. - // Create a getinfo message. - msg, err := btcjson.CreateMessage("getinfo") + // Create a getinfo command. + id := 1 + cmd, err := btcjson.NewGetInfoCmd(id) if err != nil { // Log and handle error. } // Send the message to server using the appropriate username and // password. - reply, err := btcjson.RpcCommand(user, password, server, msg) + reply, err := btcjson.RpcSend(user, password, server, cmd) if err != nil { + fmt.Println(err) // Log and handle error. } @@ -88,22 +92,23 @@ For other commands where this package does not yet provide a concrete implementation for the reply, such as getrawmempool, the reply uses a generic interface so one can access individual items as follows: - // Create a getrawmempool message. - msg, err := btcjson.CreateMessage("getrawmempool") + // Create a getrawmempool command. + id := 1 + cmd, err := btcjson.NewGetRawMempoolCmd(id) if err != nil { // Log and handle error. } // Send the message to server using the appropriate username and // password. - reply, err := btcjson.RpcCommand(user, password, server, msg) + reply, err := btcjson.RpcSend(user, password, server, cmd) if err != nil { // Log and handle error. } - // Ensure there is a result and type assert it to an interface slice. + // Ensure there is a result and type assert it to a string slice. if reply.Result != nil { - if mempool, ok := reply.Result.([]interface{}); ok { + if mempool, ok := reply.Result.([]string); ok { fmt.Println("num mempool entries =", len(mempool)) } } diff --git a/jsonapi.go b/jsonapi.go index 9e0f5c99..1fbbc1f8 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -356,6 +356,10 @@ func jsonWithArgs(command string, id interface{}, args interface{}) ([]byte, err // It is capable of handeling all of the commands from the standard client, // described at: // https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list +// +// WARNING: This method is deprecated and may be removed in a future version. +// Do NOT use this as it does not work for all commands. Instead, use one of +// the NewCmd functions to create a specific command. func CreateMessage(message string, args ...interface{}) ([]byte, error) { finalMessage, err := CreateMessageWithId(message, "btcd", args...) return finalMessage, err @@ -366,6 +370,10 @@ func CreateMessage(message string, args ...interface{}) ([]byte, error) { // message ready to send off to the daemon or server. It is capable of handling // all of the commands from the standard client, described at: // https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list +// +// WARNING: This method is deprecated and may be removed in a future version. +// Do NOT use this as it does not work for all commands. Instead, use one of +// the NewCmd functions to create a specific command. func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([]byte, error) { var finalMessage []byte var err error From 48bcbc5a22141519d9a0d229d5a1b97d81d5e956 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 02:15:10 -0500 Subject: [PATCH 144/229] Move result structs and funcs to jsonresults.go. This commit moves all of the structs which deal with command results and related functions to a new file named jsonresults.go. This is in preparation of allowing custom results to be registered. ok @jcvernaleo --- jsonapi.go | 517 ------------------------- jsonapi_test.go | 73 ---- jsonresult_test.go | 82 ++++ jsonresults.go | 496 ++++++++++++++++++++++++ test_coverage.txt | 928 ++++++++++++++++++++++----------------------- 5 files changed, 1042 insertions(+), 1054 deletions(-) create mode 100644 jsonresult_test.go create mode 100644 jsonresults.go diff --git a/jsonapi.go b/jsonapi.go index 1fbbc1f8..db79ade8 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -7,7 +7,6 @@ package btcjson import ( "encoding/json" "fmt" - "strings" ) // Message contains a message to be sent to the bitcoin client. @@ -28,299 +27,6 @@ type Reply struct { Id *interface{} `json:"id"` } -// InfoResult contains the data returned by the getinfo command. -type InfoResult struct { - Version int `json:"version,omitempty"` - ProtocolVersion int `json:"protocolversion,omitempty"` - WalletVersion int `json:"walletversion,omitempty"` - Balance float64 `json:"balance,omitempty"` - Blocks int `json:"blocks,omitempty"` - TimeOffset int64 `json:"timeoffset,omitempty"` - Connections int `json:"connections,omitempty"` - Proxy string `json:"proxy,omitempty"` - Difficulty float64 `json:"difficulty,omitempty"` - TestNet bool `json:"testnet,omitempty"` - KeypoolOldest int64 `json:"keypoololdest,omitempty"` - KeypoolSize int `json:"keypoolsize,omitempty"` - PaytxFee float64 `json:"paytxfee,omitempty"` - RelayFee float64 `json:"relayfee,omitempty"` - Errors string `json:"errors,omitempty"` -} - -// BlockResult models the data from the getblock command when the verbose flag -// is set. When the verbose flag is not set, getblock return a hex-encoded -// string. -type BlockResult struct { - Hash string `json:"hash"` - Confirmations uint64 `json:"confirmations"` - Size int `json:"size"` - Height int64 `json:"height"` - Version uint32 `json:"version"` - MerkleRoot string `json:"merkleroot"` - Tx []string `json:"tx,omitempty"` - RawTx []TxRawResult `json:"rawtx,omitempty"` - Time int64 `json:"time"` - Nonce uint32 `json:"nonce"` - Bits string `json:"bits"` - Difficulty float64 `json:"difficulty"` - PreviousHash string `json:"previousblockhash"` - NextHash string `json:"nextblockhash"` -} - -// CreateMultiSigResult models the data returned from the createmultisig command. -type CreateMultiSigResult struct { - Address string `json:"address"` - RedeemScript string `json:"redeemScript"` -} - -// DecodeScriptResult models the data returned from the decodescript command. -type DecodeScriptResult struct { - Asm string `json:"asm"` - ReqSigs int `json:"reqSigs,omitempty"` - Type string `json:"type"` - Addresses []string `json:"addresses,omitempty"` - P2sh string `json:"p2sh"` -} - -// GetPeerInfoResult models the data returned from the getpeerinfo command. -type GetPeerInfoResult struct { - Addr string `json:"addr"` - AddrLocal string `json:"addrlocal,omitempty"` - Services string `json:"services"` - LastSend int64 `json:"lastsend"` - LastRecv int64 `json:"lastrecv"` - BytesSent uint64 `json:"bytessent"` - BytesRecv uint64 `json:"bytesrecv"` - PingTime int64 `json:"pingtime"` - PingWait int64 `json:"pingwait,omitempty"` - ConnTime int64 `json:"conntime"` - Version uint32 `json:"version"` - SubVer string `json:"subver"` - Inbound bool `json:"inbound"` - StartingHeight int32 `json:"startingheight"` - BanScore int `json:"banscore,omitempty"` - SyncNode bool `json:"syncnode"` -} - -// GetRawMempoolResult models the data returned from the getrawmempool command. -type GetRawMempoolResult struct { - Size int `json:"size"` - Fee float64 `json:"fee"` - Time int64 `json:"time"` - Height int64 `json:"height"` - StartingPriority int `json:"startingpriority"` - CurrentPriority int `json:"currentpriority"` - Depends []string `json:"depends"` -} - -// GetTransactionDetailsResult models the details data from the gettransaction command. -type GetTransactionDetailsResult struct { - Account string `json:"account"` - Address string `json:"address"` - Category string `json:"category"` - Amount float64 `json:"amount"` - Fee float64 `json:"fee,omitempty"` -} - -// GetTransactionResult models the data from the gettransaction command. -type GetTransactionResult struct { - Amount float64 `json:"amount"` - Fee float64 `json:"fee,omitempty"` - Confirmations int64 `json:"confirmations"` - BlockHash string `json:"blockhash"` - BlockIndex int64 `json:"blockindex"` - BlockTime int64 `json:"blocktime"` - TxID string `json:"txid"` - WalletConflicts []string `json:"walletconflicts"` - Time int64 `json:"time"` - TimeReceived int64 `json:"timereceived"` - Details []GetTransactionDetailsResult `json:"details"` - Hex string `json:"hex"` -} - -// ListTransactionsResult models the data from the listtransactions command. -type ListTransactionsResult struct { - Account string `json:"account"` - Address string `json:"address,omitempty"` - Category string `json:"category"` - Amount float64 `json:"amount"` - Fee float64 `json:"fee"` - Confirmations int64 `json:"confirmations"` - Generated bool `json:"generated,omitempty"` - BlockHash string `json:"blockhash,omitempty"` - BlockIndex int64 `json:"blockindex,omitempty"` - BlockTime int64 `json:"blocktime,omitempty"` - TxID string `json:"txid"` - WalletConflicts []string `json:"walletconflicts"` - Time int64 `json:"time"` - TimeReceived int64 `json:"timereceived"` - Comment string `json:"comment,omitempty"` - OtherAccount string `json:"otheraccount"` -} - -// TxRawResult models the data from the getrawtransaction command. -type TxRawResult struct { - Hex string `json:"hex"` - Txid string `json:"txid"` - Version uint32 `json:"version"` - LockTime uint32 `json:"locktime"` - Vin []Vin `json:"vin"` - Vout []Vout `json:"vout"` - BlockHash string `json:"blockhash,omitempty"` - Confirmations uint64 `json:"confirmations,omitempty"` - Time int64 `json:"time,omitempty"` - Blocktime int64 `json:"blocktime,omitempty"` -} - -// TxRawDecodeResult models the data from the decoderawtransaction command. -type TxRawDecodeResult struct { - Txid string `json:"txid"` - Version uint32 `json:"version"` - Locktime uint32 `json:"locktime"` - Vin []Vin `json:"vin"` - Vout []Vout `json:"vout"` -} - -// GetNetTotalsResult models the data returned from the getnettotals command. -type GetNetTotalsResult struct { - TotalBytesRecv uint64 `json:"totalbytesrecv"` - TotalBytesSent uint64 `json:"totalbytessent"` - TimeMillis int64 `json:"timemillis"` -} - -// ScriptSig models a signature script. It is defined seperately since it only -// applies to non-coinbase. Therefore the field in the Vin structure needs -// to be a pointer. -type ScriptSig struct { - Asm string `json:"asm"` - Hex string `json:"hex"` -} - -// Vin models parts of the tx data. It is defined seperately since both -// getrawtransaction and decoderawtransaction use the same structure. -type Vin struct { - Coinbase string `json:"coinbase"` - Txid string `json:"txid"` - Vout int `json:"vout"` - ScriptSig *ScriptSig `json:"scriptSig"` - Sequence uint32 `json:"sequence"` -} - -// IsCoinBase returns a bool to show if a Vin is a Coinbase one or not. -func (v *Vin) IsCoinBase() bool { - return len(v.Coinbase) > 0 -} - -// MarshalJSON provides a custom Marshal method for Vin. -func (v *Vin) MarshalJSON() ([]byte, error) { - if v.IsCoinBase() { - coinbaseStruct := struct { - Coinbase string `json:"coinbase"` - Sequence uint32 `json:"sequence"` - }{ - Coinbase: v.Coinbase, - Sequence: v.Sequence, - } - return json.Marshal(coinbaseStruct) - } - - txStruct := struct { - Txid string `json:"txid"` - Vout int `json:"vout"` - ScriptSig *ScriptSig `json:"scriptSig"` - Sequence uint32 `json:"sequence"` - }{ - Txid: v.Txid, - Vout: v.Vout, - ScriptSig: v.ScriptSig, - Sequence: v.Sequence, - } - return json.Marshal(txStruct) -} - -// Vout models parts of the tx data. It is defined seperately since both -// getrawtransaction and decoderawtransaction use the same structure. -type Vout struct { - Value float64 `json:"value"` - N int `json:"n"` - ScriptPubKey struct { - Asm string `json:"asm"` - Hex string `json:"hex"` - ReqSigs int `json:"reqSigs,omitempty"` - Type string `json:"type"` - Addresses []string `json:"addresses,omitempty"` - } `json:"scriptPubKey"` -} - -// GetMiningInfoResult models the data from the getmininginfo command. -type GetMiningInfoResult struct { - CurrentBlockSize float64 `json:"currentblocksize"` - Difficulty float64 `json:"difficulty"` - Errors string `json:"errors"` - Generate bool `json:"generate"` - GenProcLimit float64 `json:"genproclimit"` - PooledTx float64 `json:"pooledtx"` - Testnet bool `json:"testnet"` - Blocks float64 `json:"blocks"` - CurrentBlockTx float64 `json:"currentblocktx"` - HashesPerSec float64 `json:"hashespersec"` -} - -// GetWorkResult models the data from the getwork command. -type GetWorkResult struct { - Data string `json:"data"` - Hash1 string `json:"hash1"` - Midstate string `json:"midstate"` - Target string `json:"target"` -} - -// ValidateAddressResult models the data from the validateaddress command. -type ValidateAddressResult struct { - IsValid bool `json:"isvalid"` - Address string `json:"address,omitempty"` - IsMine bool `json:"ismine,omitempty"` - IsScript bool `json:"isscript,omitempty"` - PubKey string `json:"pubkey,omitempty"` - IsCompressed bool `json:"iscompressed,omitempty"` - Account string `json:"account,omitempty"` - Addresses []string `json:"addresses,omitempty"` - Hex string `json:"hex,omitempty"` - Script string `json:"script,omitempty"` - SigsRequired int `json:"sigsrequired,omitempty"` -} - -// SignRawTransactionResult models the data from the signrawtransaction -// command. -type SignRawTransactionResult struct { - Hex string `json:"hex"` - Complete bool `json:"complete"` -} - -// ListUnSpentResult models the data from the ListUnSpentResult command. -type ListUnSpentResult struct { - TxId string `json:"txid"` - Vout float64 `json:"vout"` - Address string `json:"address"` - Account string `json:"account"` - ScriptPubKey string `json:"scriptPubKey"` - Amount float64 `json:"amount"` - Confirmations float64 `json:"confirmations"` -} - -// GetAddedNodeInfoResultAddr models the data of the addresses portion of the -// getaddednodeinfo command. -type GetAddedNodeInfoResultAddr struct { - Address string `json:"address"` - Connected string `json:"connected"` -} - -// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. -type GetAddedNodeInfoResult struct { - AddedNode string `json:"addednode"` - Connected *bool `json:"connected,omitempty"` - Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` -} - // Error models the error field of the json returned by a bitcoin client. When // there is no error, this should be a nil pointer to produce the null in the // json that bitcoind produces. @@ -910,229 +616,6 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ return finalMessage, err } -// ReadResultCmd unmarshalls the json reply with data struct for specific -// commands or an interface if it is not a command where we already have a -// struct ready. -func ReadResultCmd(cmd string, message []byte) (Reply, error) { - var result Reply - var err error - var objmap map[string]json.RawMessage - err = json.Unmarshal(message, &objmap) - if err != nil { - if strings.Contains(string(message), "401 Unauthorized.") { - err = fmt.Errorf("Authentication error.") - } else { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - } - return result, err - } - // Take care of the parts that are the same for all replies. - var jsonErr Error - var id interface{} - err = json.Unmarshal(objmap["error"], &jsonErr) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err - } - err = json.Unmarshal(objmap["id"], &id) - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err - } - - // If it is a command where we have already worked out the reply, - // generate put the results in the proper structure. - // We handle the error condition after the switch statement. - switch cmd { - case "createmultisig": - var res CreateMultiSigResult - 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 - // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { - var res []GetAddedNodeInfoResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } else { - var res []string - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } - case "getinfo": - var res InfoResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getblock": - // getblock can either return a JSON object or a hex-encoded - // string depending on the verbose flag. Choose the right form - // accordingly. - if strings.Contains(string(objmap["result"]), "{") { - var res BlockResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } else { - var res string - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } - case "getnettotals": - var res GetNetTotalsResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getnetworkhashps": - var res int64 - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getpeerinfo": - var res []GetPeerInfoResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getrawtransaction": - // getrawtransaction can either return a JSON object or a - // hex-encoded string depending on the verbose flag. Choose the - // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { - var res TxRawResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } else { - var res string - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } - case "decoderawtransaction": - var res TxRawDecodeResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getaddressesbyaccount": - var res []string - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getmininginfo": - var res GetMiningInfoResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getrawmempool": - // getrawmempool can either return a map of JSON objects or - // an array of strings depending on the verbose flag. Choose - // the right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { - var res map[string]GetRawMempoolResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } else { - var res []string - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } - case "gettransaction": - var res GetTransactionResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "getwork": - // getwork can either return a JSON object or a boolean - // depending on whether or not data was provided. Choose the - // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { - var res GetWorkResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } else { - var res bool - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - } - case "validateaddress": - var res ValidateAddressResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "signrawtransaction": - var res SignRawTransactionResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "listtransactions": - var res []ListTransactionsResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - case "listunspent": - var res []ListUnSpentResult - err = json.Unmarshal(objmap["result"], &res) - if err == nil { - result.Result = res - } - // For commands that return a single item (or no items), we get it with - // the correct concrete type for free (but treat them separately - // for clarity). - case "getblockcount", "getbalance", "getblocknumber", "getgenerate", - "getconnetioncount", "getdifficulty", "gethashespersec", - "setgenerate", "stop", "settxfee", "getaccount", - "getnewaddress", "sendtoaddress", "createrawtransaction", - "sendrawtransaction", "getbestblockhash", "getrawchangeaddress": - err = json.Unmarshal(message, &result) - // For anything else put it in an interface. All the data is still - // there, just a little less convenient to deal with. - default: - err = json.Unmarshal(message, &result) - } - if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) - return result, err - } - // Only want the error field when there is an actual error to report. - if jsonErr.Code != 0 { - result.Error = &jsonErr - } - result.Id = &id - return result, err -} - // JSONGetMethod takes a message and tries to find the bitcoin command that it // is in reply to so it can be processed further. func JSONGetMethod(message []byte) (string, error) { diff --git a/jsonapi_test.go b/jsonapi_test.go index 8ceab3eb..7a9376a4 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -6,7 +6,6 @@ package btcjson_test import ( "bytes" - "encoding/json" "fmt" "github.com/conformal/btcjson" "io" @@ -320,78 +319,6 @@ func TestJSONtoAmount(t *testing.T) { return } -var resulttests = []struct { - cmd string - msg []byte - comp bool - pass bool -}{ - // Generate a fake message to make sure we can encode and decode it and - // get the same thing back. - {"getblockcount", - []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`), - true, true}, - // Generate a fake message to make sure we don't make a command from it. - {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, - {"anycommand", []byte(`{some junk}`), false, false}, - {"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}, - {"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}, - {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, - {"gettransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"gettransaction", []byte(`{"error":null,"id":1,"result":{"Amount":0.0}}`), false, true}, - {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, - {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, - {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, - {"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}, - {"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}, - {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, - {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, - {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, -} - -// TestReadResultCmd tests that readResultCmd can properly unmarshall the -// returned []byte that contains a json reply for both known and unknown -// messages. -func TestReadResultCmd(t *testing.T) { - for i, tt := range resulttests { - result, err := btcjson.ReadResultCmd(tt.cmd, tt.msg) - if tt.pass { - if err != nil { - t.Errorf("Should read result: %d %v", i, err) - } - // Due to the pointer for the Error and other structs, - // we can't always guarantee byte for byte comparison. - if tt.comp { - msg2, err := json.Marshal(result) - if err != nil { - t.Errorf("Should unmarshal result: %d %v", i, err) - } - if !bytes.Equal(tt.msg, msg2) { - t.Errorf("json byte arrays differ. %d %v %v", i, tt.msg, msg2) - } - } - - } else { - if err == nil { - t.Errorf("Should fail: %d, %s", i, tt.msg) - } - } - } - - return -} - // TestErrorInterface tests that the Error type satisifies the builtin // error interface and tests that the error string is created in the form // "code: message". diff --git a/jsonresult_test.go b/jsonresult_test.go new file mode 100644 index 00000000..4d1f4cb2 --- /dev/null +++ b/jsonresult_test.go @@ -0,0 +1,82 @@ +// Copyright (c) 2013-2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "github.com/conformal/btcjson" + "testing" +) + +var resulttests = []struct { + cmd string + msg []byte + comp bool + pass bool +}{ + // Generate a fake message to make sure we can encode and decode it and + // get the same thing back. + {"getblockcount", + []byte(`{"result":226790,"error":{"code":1,"message":"No Error"},"id":"btcd"}`), + true, true}, + // Generate a fake message to make sure we don't make a command from it. + {"anycommand", []byte(`{"result":"test","id":1}`), false, false}, + {"anycommand", []byte(`{some junk}`), false, false}, + {"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}, + {"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}, + {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, + {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"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}, + {"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}, + {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, + {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, + {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, +} + +// TestReadResultCmd tests that readResultCmd can properly unmarshall the +// returned []byte that contains a json reply for both known and unknown +// messages. +func TestReadResultCmd(t *testing.T) { + for i, tt := range resulttests { + result, err := btcjson.ReadResultCmd(tt.cmd, tt.msg) + if tt.pass { + if err != nil { + t.Errorf("Should read result: %d %v", i, err) + } + // Due to the pointer for the Error and other structs, + // we can't always guarantee byte for byte comparison. + if tt.comp { + msg2, err := json.Marshal(result) + if err != nil { + t.Errorf("Should unmarshal result: %d %v", i, err) + } + if !bytes.Equal(tt.msg, msg2) { + t.Errorf("json byte arrays differ. %d %v %v", i, tt.msg, msg2) + } + } + + } else { + if err == nil { + t.Errorf("Should fail: %d, %s", i, tt.msg) + } + } + } + + return +} diff --git a/jsonresults.go b/jsonresults.go new file mode 100644 index 00000000..c475b01c --- /dev/null +++ b/jsonresults.go @@ -0,0 +1,496 @@ +// Copyright (c) 2013-2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "encoding/json" + "fmt" + "strings" +) + +// InfoResult contains the data returned by the getinfo command. +type InfoResult struct { + Version int `json:"version,omitempty"` + ProtocolVersion int `json:"protocolversion,omitempty"` + WalletVersion int `json:"walletversion,omitempty"` + Balance float64 `json:"balance,omitempty"` + Blocks int `json:"blocks,omitempty"` + TimeOffset int64 `json:"timeoffset,omitempty"` + Connections int `json:"connections,omitempty"` + Proxy string `json:"proxy,omitempty"` + Difficulty float64 `json:"difficulty,omitempty"` + TestNet bool `json:"testnet,omitempty"` + KeypoolOldest int64 `json:"keypoololdest,omitempty"` + KeypoolSize int `json:"keypoolsize,omitempty"` + PaytxFee float64 `json:"paytxfee,omitempty"` + RelayFee float64 `json:"relayfee,omitempty"` + Errors string `json:"errors,omitempty"` +} + +// BlockResult models the data from the getblock command when the verbose flag +// is set. When the verbose flag is not set, getblock return a hex-encoded +// string. +type BlockResult struct { + Hash string `json:"hash"` + Confirmations uint64 `json:"confirmations"` + Size int `json:"size"` + Height int64 `json:"height"` + Version uint32 `json:"version"` + MerkleRoot string `json:"merkleroot"` + Tx []string `json:"tx,omitempty"` + RawTx []TxRawResult `json:"rawtx,omitempty"` + Time int64 `json:"time"` + Nonce uint32 `json:"nonce"` + Bits string `json:"bits"` + Difficulty float64 `json:"difficulty"` + PreviousHash string `json:"previousblockhash"` + NextHash string `json:"nextblockhash"` +} + +// CreateMultiSigResult models the data returned from the createmultisig command. +type CreateMultiSigResult struct { + Address string `json:"address"` + RedeemScript string `json:"redeemScript"` +} + +// DecodeScriptResult models the data returned from the decodescript command. +type DecodeScriptResult struct { + Asm string `json:"asm"` + ReqSigs int `json:"reqSigs,omitempty"` + Type string `json:"type"` + Addresses []string `json:"addresses,omitempty"` + P2sh string `json:"p2sh"` +} + +// GetPeerInfoResult models the data returned from the getpeerinfo command. +type GetPeerInfoResult struct { + Addr string `json:"addr"` + AddrLocal string `json:"addrlocal,omitempty"` + Services string `json:"services"` + LastSend int64 `json:"lastsend"` + LastRecv int64 `json:"lastrecv"` + BytesSent uint64 `json:"bytessent"` + BytesRecv uint64 `json:"bytesrecv"` + PingTime int64 `json:"pingtime"` + PingWait int64 `json:"pingwait,omitempty"` + ConnTime int64 `json:"conntime"` + Version uint32 `json:"version"` + SubVer string `json:"subver"` + Inbound bool `json:"inbound"` + StartingHeight int32 `json:"startingheight"` + BanScore int `json:"banscore,omitempty"` + SyncNode bool `json:"syncnode"` +} + +// GetRawMempoolResult models the data returned from the getrawmempool command. +type GetRawMempoolResult struct { + Size int `json:"size"` + Fee float64 `json:"fee"` + Time int64 `json:"time"` + Height int64 `json:"height"` + StartingPriority int `json:"startingpriority"` + CurrentPriority int `json:"currentpriority"` + Depends []string `json:"depends"` +} + +// ListTransactionsResult models the data from the listtransactions command. +type ListTransactionsResult struct { + Account string `json:"account"` + Address string `json:"address,omitempty"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee"` + Confirmations int64 `json:"confirmations"` + Generated bool `json:"generated"` + BlockHash string `json:"blockhash,omitempty"` + BlockIndex int64 `json:"blockindex,omitempty"` + BlockTime int64 `json:"blocktime,omitempty"` + TxID string `json:"amount"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Comment string `json:"comment,omitempty"` + OtherAccount float64 `json:"otheraccount"` +} + +// TxRawResult models the data from the getrawtransaction command. +type TxRawResult struct { + Hex string `json:"hex"` + Txid string `json:"txid"` + Version uint32 `json:"version"` + LockTime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` + BlockHash string `json:"blockhash,omitempty"` + Confirmations uint64 `json:"confirmations,omitempty"` + Time int64 `json:"time,omitempty"` + Blocktime int64 `json:"blocktime,omitempty"` +} + +// TxRawDecodeResult models the data from the decoderawtransaction command. +type TxRawDecodeResult struct { + Txid string `json:"txid"` + Version uint32 `json:"version"` + Locktime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` +} + +// GetNetTotalsResult models the data returned from the getnettotals command. +type GetNetTotalsResult struct { + TotalBytesRecv uint64 `json:"totalbytesrecv"` + TotalBytesSent uint64 `json:"totalbytessent"` + TimeMillis int64 `json:"timemillis"` +} + +// ScriptSig models a signature script. It is defined seperately since it only +// applies to non-coinbase. Therefore the field in the Vin structure needs +// to be a pointer. +type ScriptSig struct { + Asm string `json:"asm"` + Hex string `json:"hex"` +} + +// Vin models parts of the tx data. It is defined seperately since both +// getrawtransaction and decoderawtransaction use the same structure. +type Vin struct { + Coinbase string `json:"coinbase"` + Txid string `json:"txid"` + Vout int `json:"vout"` + ScriptSig *ScriptSig `json:"scriptSig"` + Sequence uint32 `json:"sequence"` +} + +// IsCoinBase returns a bool to show if a Vin is a Coinbase one or not. +func (v *Vin) IsCoinBase() bool { + return len(v.Coinbase) > 0 +} + +// MarshalJSON provides a custom Marshal method for Vin. +func (v *Vin) MarshalJSON() ([]byte, error) { + if v.IsCoinBase() { + coinbaseStruct := struct { + Coinbase string `json:"coinbase"` + Sequence uint32 `json:"sequence"` + }{ + Coinbase: v.Coinbase, + Sequence: v.Sequence, + } + return json.Marshal(coinbaseStruct) + } + + txStruct := struct { + Txid string `json:"txid"` + Vout int `json:"vout"` + ScriptSig *ScriptSig `json:"scriptSig"` + Sequence uint32 `json:"sequence"` + }{ + Txid: v.Txid, + Vout: v.Vout, + ScriptSig: v.ScriptSig, + Sequence: v.Sequence, + } + return json.Marshal(txStruct) +} + +// Vout models parts of the tx data. It is defined seperately since both +// getrawtransaction and decoderawtransaction use the same structure. +type Vout struct { + Value float64 `json:"value"` + N int `json:"n"` + ScriptPubKey struct { + Asm string `json:"asm"` + Hex string `json:"hex"` + ReqSigs int `json:"reqSigs,omitempty"` + Type string `json:"type"` + Addresses []string `json:"addresses,omitempty"` + } `json:"scriptPubKey"` +} + +// GetMiningInfoResult models the data from the getmininginfo command. +type GetMiningInfoResult struct { + CurrentBlockSize float64 `json:"currentblocksize"` + Difficulty float64 `json:"difficulty"` + Errors string `json:"errors"` + Generate bool `json:"generate"` + GenProcLimit float64 `json:"genproclimit"` + PooledTx float64 `json:"pooledtx"` + Testnet bool `json:"testnet"` + Blocks float64 `json:"blocks"` + CurrentBlockTx float64 `json:"currentblocktx"` + HashesPerSec float64 `json:"hashespersec"` +} + +// GetWorkResult models the data from the getwork command. +type GetWorkResult struct { + Data string `json:"data"` + Hash1 string `json:"hash1"` + Midstate string `json:"midstate"` + Target string `json:"target"` +} + +// ValidateAddressResult models the data from the validateaddress command. +type ValidateAddressResult struct { + IsValid bool `json:"isvalid"` + Address string `json:"address,omitempty"` + IsMine bool `json:"ismine,omitempty"` + IsScript bool `json:"isscript,omitempty"` + PubKey string `json:"pubkey,omitempty"` + IsCompressed bool `json:"iscompressed,omitempty"` + Account string `json:"account,omitempty"` + Addresses []string `json:"addresses,omitempty"` + Hex string `json:"hex,omitempty"` + Script string `json:"script,omitempty"` + SigsRequired int `json:"sigsrequired,omitempty"` +} + +// SignRawTransactionResult models the data from the signrawtransaction +// command. +type SignRawTransactionResult struct { + Hex string `json:"hex"` + Complete bool `json:"complete"` +} + +// ListUnSpentResult models the data from the ListUnSpentResult command. +type ListUnSpentResult struct { + TxId string `json:"txid"` + Vout float64 `json:"vout"` + Address string `json:"address"` + Account string `json:"account"` + ScriptPubKey string `json:"scriptPubKey"` + Amount float64 `json:"amount"` + Confirmations float64 `json:"confirmations"` +} + +// GetAddedNodeInfoResultAddr models the data of the addresses portion of the +// getaddednodeinfo command. +type GetAddedNodeInfoResultAddr struct { + Address string `json:"address"` + Connected string `json:"connected"` +} + +// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. +type GetAddedNodeInfoResult struct { + AddedNode string `json:"addednode"` + Connected *bool `json:"connected,omitempty"` + Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` +} + +// ReadResultCmd unmarshalls the json reply with data struct for specific +// commands or an interface if it is not a command where we already have a +// struct ready. +func ReadResultCmd(cmd string, message []byte) (Reply, error) { + var result Reply + var err error + var objmap map[string]json.RawMessage + err = json.Unmarshal(message, &objmap) + if err != nil { + if strings.Contains(string(message), "401 Unauthorized.") { + err = fmt.Errorf("Authentication error.") + } else { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + } + return result, err + } + // Take care of the parts that are the same for all replies. + var jsonErr Error + var id interface{} + err = json.Unmarshal(objmap["error"], &jsonErr) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + err = json.Unmarshal(objmap["id"], &id) + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + + // If it is a command where we have already worked out the reply, + // generate put the results in the proper structure. + // We handle the error condition after the switch statement. + switch cmd { + case "createmultisig": + var res CreateMultiSigResult + 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 + // right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res []GetAddedNodeInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } + case "getinfo": + var res InfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getblock": + // getblock can either return a JSON object or a hex-encoded + // string depending on the verbose flag. Choose the right form + // accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res BlockResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } + case "getnettotals": + var res GetNetTotalsResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getnetworkhashps": + var res int64 + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getpeerinfo": + var res []GetPeerInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getrawtransaction": + // getrawtransaction can either return a JSON object or a + // hex-encoded string depending on the verbose flag. Choose the + // right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res TxRawResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } + case "decoderawtransaction": + var res TxRawDecodeResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getaddressesbyaccount": + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getmininginfo": + var res GetMiningInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "getrawmempool": + // getrawmempool can either return a map of JSON objects or + // an array of strings depending on the verbose flag. Choose + // the right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res map[string]GetRawMempoolResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } + case "getwork": + // getwork can either return a JSON object or a boolean + // depending on whether or not data was provided. Choose the + // right form accordingly. + if strings.Contains(string(objmap["result"]), "{") { + var res GetWorkResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res bool + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } + case "validateaddress": + var res ValidateAddressResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "signrawtransaction": + var res SignRawTransactionResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "listtransactions": + var res []ListTransactionsResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + case "listunspent": + var res []ListUnSpentResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + // For commands that return a single item (or no items), we get it with + // the correct concrete type for free (but treat them separately + // for clarity). + case "getblockcount", "getbalance", "getblocknumber", "getgenerate", + "getconnetioncount", "getdifficulty", "gethashespersec", + "setgenerate", "stop", "settxfee", "getaccount", + "getnewaddress", "sendtoaddress", "createrawtransaction", + "sendrawtransaction", "getbestblockhash", "getrawchangeaddress": + err = json.Unmarshal(message, &result) + // For anything else put it in an interface. All the data is still + // there, just a little less convenient to deal with. + default: + err = json.Unmarshal(message, &result) + } + if err != nil { + err = fmt.Errorf("Error unmarshalling json reply: %v", err) + return result, err + } + // Only want the error field when there is an actual error to report. + if jsonErr.Code != 0 { + result.Error = &jsonErr + } + result.Id = &id + return result, err +} diff --git a/test_coverage.txt b/test_coverage.txt index 42437452..c0e82da7 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,466 +1,466 @@ -github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) -github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) -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/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/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) -github.com/conformal/btcjson/jsonapi.go ReadResultCmd 58.73% (74/126) -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) -github.com/conformal/btcjson/cmdhelp.go GetHelpString 50.00% (3/6) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 44.83% (13/29) -github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsonapi.go Vin.MarshalJSON 0.00% (0/5) -github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) -github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.61% (2337/2973) +github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) +github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) +github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) +github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) +github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) +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/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/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.38% (70/122) +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) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 44.83% (13/29) +github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) +github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) +github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +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.58% (2333/2969) From fbe04b73ab2af52dd3cb3415aafed546f3d4f1bd Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 11:11:42 -0500 Subject: [PATCH 145/229] Rename jsonresult_test.go -> jsonresults_test.go. This matches the name of the file that contains the code it is testing. --- jsonresult_test.go => jsonresults_test.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jsonresult_test.go => jsonresults_test.go (100%) diff --git a/jsonresult_test.go b/jsonresults_test.go similarity index 100% rename from jsonresult_test.go rename to jsonresults_test.go From c6149949a2115c12f08b6daa6df9b7225ce66ef5 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 11 Apr 2014 12:39:18 -0500 Subject: [PATCH 146/229] Redo the ListTransactionsResult amount->txid fix. This likely got lost in a merge or the move to the jsonresults.go file. --- jsonresults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index c475b01c..b9959a76 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -107,7 +107,7 @@ type ListTransactionsResult struct { BlockHash string `json:"blockhash,omitempty"` BlockIndex int64 `json:"blockindex,omitempty"` BlockTime int64 `json:"blocktime,omitempty"` - TxID string `json:"amount"` + TxID string `json:"txid"` WalletConflicts []string `json:"walletconflicts"` Time int64 `json:"time"` TimeReceived int64 `json:"timereceived"` From c2dd398b1e148a7ee247ae3e4a2548336ebbae20 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 11 Apr 2014 14:06:44 -0400 Subject: [PATCH 147/229] Add support for GetTransactionResult. ok @jcvernaleo --- jsonresults.go | 31 +++++++++++++++++++++++++++++++ jsonresults_test.go | 2 ++ test_coverage.txt | 6 +++--- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index b9959a76..c767908c 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -95,6 +95,31 @@ type GetRawMempoolResult struct { Depends []string `json:"depends"` } +// GetTransactionDetailsResult models the details data from the gettransaction command. +type GetTransactionDetailsResult struct { + Account string `json:"account"` + Address string `json:"address,omitempty"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee,omitempty"` +} + +// GetTransactionResult models the data from the gettransaction command. +type GetTransactionResult struct { + Amount float64 `json:"amount"` + Fee float64 `json:"fee,omitempty"` + Confirmations int64 `json:"confirmations"` + BlockHash string `json:"blockhash"` + BlockIndex int64 `json:"blockindex"` + BlockTime int64 `json:"blocktime"` + TxID string `json:"txid"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Details []GetTransactionDetailsResult `json:"details"` + Hex string `json:"hex"` +} + // ListTransactionsResult models the data from the listtransactions command. type ListTransactionsResult struct { Account string `json:"account"` @@ -428,6 +453,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } } + case "gettransaction": + var res GetTransactionResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getwork": // getwork can either return a JSON object or a boolean // depending on whether or not data was provided. Choose the diff --git a/jsonresults_test.go b/jsonresults_test.go index 4d1f4cb2..adbfc11b 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -35,6 +35,8 @@ var resulttests = []struct { {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, + {"gettransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"gettransaction", []byte(`{"error":null,"id":1,"result":{"Amount":0.0}}`), false, true}, {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, diff --git a/test_coverage.txt b/test_coverage.txt index c0e82da7..ac28070a 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -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/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) +github.com/conformal/btcjson/jsonresults.go ReadResultCmd 58.73% (74/126) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19) -github.com/conformal/btcjson/jsonresults.go ReadResultCmd 57.38% (70/122) 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.58% (2333/2969) +github.com/conformal/btcjson --------------------------------------- 78.61% (2338/2974) From 31a354e58581b8c659eae665e1346360867403af Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 13:57:31 -0500 Subject: [PATCH 148/229] Add support for registering custom reply parsers. This commit extends the RegisterCustomCmd function to also accept a reply parser which will be invoked for replies to the custom command via ReadResultCmd. This allows replies to custom commands to be returned a concrete structs instead of map[string]interface{}. ok @jcvernaleo, @jrick --- jsoncmd.go | 21 +++++++++++++++------ jsonresults.go | 17 ++++++++++++++--- test_coverage.txt | 6 +++--- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 39913821..130898db 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -63,17 +63,26 @@ func NewRawCmd(id interface{}, method string, params []interface{}) (*RawCmd, er // RawCmdParser is a function to create a custom Cmd from a RawCmd. type RawCmdParser func(*RawCmd) (Cmd, error) +// ReplyParser is a function a custom Cmd can use to unmarshal the results of a +// reply into a concrete struct. +type ReplyParser func(json.RawMessage) (interface{}, error) + type cmd struct { - parser RawCmdParser - helpString string + parser RawCmdParser + replyParser ReplyParser + helpString string } var customCmds = make(map[string]cmd) -// RegisterCustomCmd registers a custom RawCmd parsing func for a -// non-standard Bitcoin command. -func RegisterCustomCmd(method string, parser RawCmdParser, helpString string) { - customCmds[method] = cmd{parser: parser, helpString: helpString} +// RegisterCustomCmd registers a custom RawCmd parsing func, reply parsing func, +// and help text for a non-standard Bitcoin command. +func RegisterCustomCmd(method string, parser RawCmdParser, replyParser ReplyParser, helpString string) { + customCmds[method] = cmd{ + parser: parser, + replyParser: replyParser, + helpString: helpString, + } } // ParseMarshaledCmd parses a raw command and unmarshals as a Cmd. diff --git a/jsonresults.go b/jsonresults.go index c767908c..095cfb7e 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -509,10 +509,21 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { "getnewaddress", "sendtoaddress", "createrawtransaction", "sendrawtransaction", "getbestblockhash", "getrawchangeaddress": err = json.Unmarshal(message, &result) - // For anything else put it in an interface. All the data is still - // there, just a little less convenient to deal with. default: - err = json.Unmarshal(message, &result) + // None of the standard Bitcoin RPC methods matched. Try + // registered custom command reply parsers. + if c, ok := customCmds[cmd]; ok && c.replyParser != nil { + var res interface{} + res, err = c.replyParser(objmap["result"]) + if err == nil { + result.Result = res + } + } else { + // For anything else put it in an interface. All the + // data is still there, just a little less convenient + // to deal with. + err = json.Unmarshal(message, &result) + } } if err != nil { err = fmt.Errorf("Error unmarshalling json reply: %v", err) diff --git a/test_coverage.txt b/test_coverage.txt index ac28070a..4ed5f54e 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -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/jsoncmd.go GetTxOutCmd.UnmarshalJSON 59.09% (13/22) -github.com/conformal/btcjson/jsonresults.go ReadResultCmd 58.73% (74/126) 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.61% (2338/2974) +github.com/conformal/btcjson --------------------------------------- 78.51% (2338/2978) From 0a14b19276a20aa857dbef274b18c0c36d7af973 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 14:56:55 -0500 Subject: [PATCH 149/229] Redo ListTransactionsResult fix. This was also lost in the move to jsonresults.go. --- jsonresults.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 095cfb7e..d88a3755 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -128,7 +128,7 @@ type ListTransactionsResult struct { Amount float64 `json:"amount"` Fee float64 `json:"fee"` Confirmations int64 `json:"confirmations"` - Generated bool `json:"generated"` + Generated bool `json:"generated,omitempty"` BlockHash string `json:"blockhash,omitempty"` BlockIndex int64 `json:"blockindex,omitempty"` BlockTime int64 `json:"blocktime,omitempty"` @@ -137,7 +137,7 @@ type ListTransactionsResult struct { Time int64 `json:"time"` TimeReceived int64 `json:"timereceived"` Comment string `json:"comment,omitempty"` - OtherAccount float64 `json:"otheraccount"` + OtherAccount string `json:"otheraccount"` } // TxRawResult models the data from the getrawtransaction command. From e6dca4de6f67556c5039a38aa1790d5630f580a5 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 11 Apr 2014 18:59:10 -0400 Subject: [PATCH 150/229] Add UnlockedUntil to InfoResult. --- jsonresults.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonresults.go b/jsonresults.go index d88a3755..df2e086f 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -24,6 +24,7 @@ type InfoResult struct { TestNet bool `json:"testnet,omitempty"` KeypoolOldest int64 `json:"keypoololdest,omitempty"` KeypoolSize int `json:"keypoolsize,omitempty"` + UnlockedUntil int64 `json:"unlocked_until,omitempty"` PaytxFee float64 `json:"paytxfee,omitempty"` RelayFee float64 `json:"relayfee,omitempty"` Errors string `json:"errors,omitempty"` From 372e8c19262441519620cf341317fc195090e769 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 11 Apr 2014 20:17:21 -0400 Subject: [PATCH 151/229] Add support for ListSinceBlockResult ok @davecgh --- jsonresults.go | 15 +++++++++++++++ jsonresults_test.go | 2 ++ test_coverage.txt | 6 +++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index df2e086f..5aaf31d0 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -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) diff --git a/jsonresults_test.go b/jsonresults_test.go index adbfc11b..6d30fad0 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -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}, diff --git a/test_coverage.txt b/test_coverage.txt index 4ed5f54e..7e6c1d5d 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -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) From 0ca3d386ed9bb1aed103effc7347a4ba8bc0c77b Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 12 Apr 2014 02:39:48 -0500 Subject: [PATCH 152/229] Add support for listaccounts concrete result. --- jsonresults.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jsonresults.go b/jsonresults.go index 5aaf31d0..25eefc79 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -495,6 +495,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "listaccounts": + var res map[string]float64 + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "listsinceblock": var res ListSinceBlockResult err = json.Unmarshal(objmap["result"], &res) From ea7947f74e462c51b4095392e62644c055c4e1f3 Mon Sep 17 00:00:00 2001 From: David Hill Date: Sat, 12 Apr 2014 10:41:32 -0400 Subject: [PATCH 153/229] Add support for decodescript concrete result. --- jsonresults.go | 6 ++++++ jsonresults_test.go | 2 ++ test_coverage.txt | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 25eefc79..26f41b88 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -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 diff --git a/jsonresults_test.go b/jsonresults_test.go index 6d30fad0..de434589 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -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}, diff --git a/test_coverage.txt b/test_coverage.txt index 7e6c1d5d..8395c2a3 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -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) From 997d98bddf87d95e0d3f71a2aa34ec42bce8a599 Mon Sep 17 00:00:00 2001 From: David Hill Date: Sat, 12 Apr 2014 10:47:07 -0400 Subject: [PATCH 154/229] add a few missing and fix misspelled commands. --- jsonresults.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 26f41b88..dbe38113 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -531,11 +531,13 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // For commands that return a single item (or no items), we get it with // the correct concrete type for free (but treat them separately // for clarity). - case "getblockcount", "getbalance", "getblocknumber", "getgenerate", - "getconnetioncount", "getdifficulty", "gethashespersec", + case "getblockcount", "getbalance", "getblockhash", "getgenerate", + "getconnectioncount", "getdifficulty", "gethashespersec", "setgenerate", "stop", "settxfee", "getaccount", "getnewaddress", "sendtoaddress", "createrawtransaction", - "sendrawtransaction", "getbestblockhash", "getrawchangeaddress": + "sendrawtransaction", "getbestblockhash", "getrawchangeaddress", + "sendfrom", "sendmany", "addmultisigaddress", "getunconfirmedbalance", + "getaccountaddress": err = json.Unmarshal(message, &result) default: // None of the standard Bitcoin RPC methods matched. Try From 1349f96d8ef3c3328e9ba498c384884c821a4099 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 18 Apr 2014 12:35:37 -0500 Subject: [PATCH 155/229] Correct GetRawMempoolResult types. The StartingPriority and CurrentPriority fields of the GetRawMempoolResult are float64s instead of ints. --- jsonresults.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index dbe38113..7d1d6d4a 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -91,8 +91,8 @@ type GetRawMempoolResult struct { Fee float64 `json:"fee"` Time int64 `json:"time"` Height int64 `json:"height"` - StartingPriority int `json:"startingpriority"` - CurrentPriority int `json:"currentpriority"` + StartingPriority float64 `json:"startingpriority"` + CurrentPriority float64 `json:"currentpriority"` Depends []string `json:"depends"` } From 4595c9d90da28eb3d4b29cf8911ff458a140a0aa Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 23 Apr 2014 15:42:29 -0500 Subject: [PATCH 156/229] Add listreceivedbyaccount concrete result. ok @jcvernaleo. --- jsonresults.go | 14 ++++++++++++++ test_coverage.txt | 6 +++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 7d1d6d4a..2bc6a45e 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -279,6 +279,14 @@ type SignRawTransactionResult struct { Complete bool `json:"complete"` } +// ListReceivedByAccountResult models the data from the listreceivedbyaccount +// command. +type ListReceivedByAccountResult struct { + Account string `json: "account"` + Amount float64 `json:"amount"` + Confirmations uint64 `json:"confirmations"` +} + // ListSinceBlockResult models the data from the listsinceblock command. type ListSinceBlockResult struct { Transactions []ListTransactionsResult `json:"transactions"` @@ -507,6 +515,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "listreceivedbyaccount": + var res []ListReceivedByAccountResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "listsinceblock": var res ListSinceBlockResult err = json.Unmarshal(objmap["result"], &res) diff --git a/test_coverage.txt b/test_coverage.txt index 8395c2a3..1f15ea0c 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -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/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/jsonresults.go ReadResultCmd 57.05% (85/149) 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.48% (2349/2993) +github.com/conformal/btcjson --------------------------------------- 78.37% (2348/2996) From 3fd59048591784997016540df555baf65221726d Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 25 Apr 2014 00:37:44 -0500 Subject: [PATCH 157/229] Always return unparsableCmds when possible. This change overrides the cmd return value of custom registered methods to always return an unparsableCmd if the marshaling as a JSON-RPC request succeeded, but the request was an invalid structure for the custom method. --- jsoncmd.go | 7 ++++++- test_coverage.txt | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 130898db..f6e8f4bf 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -324,7 +324,12 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { // None of the standard Bitcoin RPC methods matched. Try // registered custom commands. if c, ok := customCmds[r.Method]; ok { - return c.parser(&r) + cmd, err := c.parser(&r) + if err != nil { + cmd = newUnparsableCmd(r.Id, r.Method) + return cmd, err + } + return cmd, nil } } diff --git a/test_coverage.txt b/test_coverage.txt index 1f15ea0c..7f95a4c5 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -263,39 +263,39 @@ github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 91.86% (79/86) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.78% (79/90) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/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.37% (2348/2996) +github.com/conformal/btcjson --------------------------------------- 78.27% (2348/3000) From d0a2506a968d8907b995c9a457147c214cdc7bed Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 3 May 2014 12:19:40 -0500 Subject: [PATCH 158/229] Improve GetMiningInfoResult. This commit modifies the types of the GetMiningInfoResult to better match their underlying types. While the information was all available and accurate, it's nicer to treat numeric values as proper types instead of all float64s. Also, a new networkhashps field has been added for compatibility with the reference implementation. --- jsonresults.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 2bc6a45e..1e470f2a 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -237,16 +237,17 @@ type Vout struct { // GetMiningInfoResult models the data from the getmininginfo command. type GetMiningInfoResult struct { - CurrentBlockSize float64 `json:"currentblocksize"` + Blocks int64 `json:"blocks"` + CurrentBlockSize uint64 `json:"currentblocksize"` + CurrentBlockTx uint64 `json:"currentblocktx"` Difficulty float64 `json:"difficulty"` Errors string `json:"errors"` Generate bool `json:"generate"` - GenProcLimit float64 `json:"genproclimit"` - PooledTx float64 `json:"pooledtx"` + GenProcLimit int `json:"genproclimit"` + HashesPerSec int64 `json:"hashespersec"` + NetworkHashPS int64 `json:"networkhashps"` + PooledTx uint64 `json:"pooledtx"` Testnet bool `json:"testnet"` - Blocks float64 `json:"blocks"` - CurrentBlockTx float64 `json:"currentblocktx"` - HashesPerSec float64 `json:"hashespersec"` } // GetWorkResult models the data from the getwork command. From d443b489944bf3e717e98433130d2af429b27473 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 3 May 2014 14:05:07 -0500 Subject: [PATCH 159/229] Improve InfoResult. This commit modifies InfoResult to remove all of the omitempty tags since the fields should be present in the marshalled JSON regardless of them being zero values or not. --- jsonresults.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 1e470f2a..fdb39074 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -12,22 +12,22 @@ import ( // InfoResult contains the data returned by the getinfo command. type InfoResult struct { - Version int `json:"version,omitempty"` - ProtocolVersion int `json:"protocolversion,omitempty"` + Version int `json:"version"` + ProtocolVersion int `json:"protocolversion"` WalletVersion int `json:"walletversion,omitempty"` Balance float64 `json:"balance,omitempty"` - Blocks int `json:"blocks,omitempty"` - TimeOffset int64 `json:"timeoffset,omitempty"` - Connections int `json:"connections,omitempty"` - Proxy string `json:"proxy,omitempty"` - Difficulty float64 `json:"difficulty,omitempty"` - TestNet bool `json:"testnet,omitempty"` + Blocks int `json:"blocks"` + TimeOffset int64 `json:"timeoffset"` + Connections int `json:"connections"` + Proxy string `json:"proxy"` + Difficulty float64 `json:"difficulty"` + TestNet bool `json:"testnet"` KeypoolOldest int64 `json:"keypoololdest,omitempty"` KeypoolSize int `json:"keypoolsize,omitempty"` UnlockedUntil int64 `json:"unlocked_until,omitempty"` PaytxFee float64 `json:"paytxfee,omitempty"` - RelayFee float64 `json:"relayfee,omitempty"` - Errors string `json:"errors,omitempty"` + RelayFee float64 `json:"relayfee"` + Errors string `json:"errors"` } // BlockResult models the data from the getblock command when the verbose flag From 4202bf2e93f150ed9ef899116ccaa35155891ae8 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 3 May 2014 23:38:47 -0500 Subject: [PATCH 160/229] Make TestNet field name consistent. The commit makes the TestNet field in GetMiningInfoResult consistent with InfoResult. --- jsonresults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index fdb39074..1e87d9aa 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -247,7 +247,7 @@ type GetMiningInfoResult struct { HashesPerSec int64 `json:"hashespersec"` NetworkHashPS int64 `json:"networkhashps"` PooledTx uint64 `json:"pooledtx"` - Testnet bool `json:"testnet"` + TestNet bool `json:"testnet"` } // GetWorkResult models the data from the getwork command. From 4fb52720636a06de7fe22ea2f22538e9458681a5 Mon Sep 17 00:00:00 2001 From: GeertJohan Date: Sun, 4 May 2014 17:12:32 +0200 Subject: [PATCH 161/229] Return pointer to TxRawResult and use bytes.IndexByte instead of Strings.Contains --- jsonresults.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 1e87d9aa..a723d299 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -5,6 +5,7 @@ package btcjson import ( + "bytes" "encoding/json" "fmt" "strings" @@ -426,12 +427,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { case "getrawtransaction": // getrawtransaction can either return a JSON object or a // hex-encoded string depending on the verbose flag. Choose the - // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + // right form accordingly.= + if bytes.IndexByte(objmap["result"], '{') > -1 { var res TxRawResult err = json.Unmarshal(objmap["result"], &res) if err == nil { - result.Result = res + result.Result = &res } } else { var res string From 94451d7a9cd82e3a7a82424b67f9142504abb6d9 Mon Sep 17 00:00:00 2001 From: Geert-Johan Riemer Date: Mon, 5 May 2014 13:28:48 +0200 Subject: [PATCH 162/229] Changed strings.Contains(?, "{") to bytes.IndexOf(?, '{')>-1 --- jsonresults.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index a723d299..6d6fdf5d 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -370,7 +370,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getaddednodeinfo can either return a JSON object or a // slice of strings depending on the verbose flag. Choose the // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res []GetAddedNodeInfoResult err = json.Unmarshal(objmap["result"], &res) if err == nil { @@ -393,7 +393,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getblock can either return a JSON object or a hex-encoded // string depending on the verbose flag. Choose the right form // accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res BlockResult err = json.Unmarshal(objmap["result"], &res) if err == nil { @@ -463,7 +463,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getrawmempool can either return a map of JSON objects or // an array of strings depending on the verbose flag. Choose // the right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res map[string]GetRawMempoolResult err = json.Unmarshal(objmap["result"], &res) if err == nil { @@ -486,7 +486,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // getwork can either return a JSON object or a boolean // depending on whether or not data was provided. Choose the // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + if bytes.IndexByte(objmap["result"], '{') > -1 { var res GetWorkResult err = json.Unmarshal(objmap["result"], &res) if err == nil { From a5169bd8804f816f23198a8a4861fa98a732f559 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 5 May 2014 09:08:45 -0400 Subject: [PATCH 163/229] Remove extraneous character that got added to comment. --- jsonresults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index 6d6fdf5d..f63eb16e 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -427,7 +427,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { case "getrawtransaction": // getrawtransaction can either return a JSON object or a // hex-encoded string depending on the verbose flag. Choose the - // right form accordingly.= + // right form accordingly. if bytes.IndexByte(objmap["result"], '{') > -1 { var res TxRawResult err = json.Unmarshal(objmap["result"], &res) From 9965019da0876c7a2b16b5b0dcd5b26e8c438344 Mon Sep 17 00:00:00 2001 From: GeertJohan Date: Mon, 5 May 2014 21:11:06 +0200 Subject: [PATCH 164/229] Return pointers to structs Update doc.go to use proper btcjson result type Return pointers to structs Update doc.go to use proper btcjson result type --- doc.go | 2 +- jsonresults.go | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/doc.go b/doc.go index c738ad13..bab66104 100644 --- a/doc.go +++ b/doc.go @@ -83,7 +83,7 @@ reply to the appropriate concrete type. // Ensure there is a result and type assert it to a btcjson.InfoResult. if reply.Result != nil { - if info, ok := reply.Result.(btcjson.InfoResult); ok { + if info, ok := reply.Result.(*btcjson.InfoResult); ok { fmt.Println("balance =", info.Balance) } } diff --git a/jsonresults.go b/jsonresults.go index f63eb16e..d7c4dbad 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -355,13 +355,13 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // We handle the error condition after the switch statement. switch cmd { case "createmultisig": - var res CreateMultiSigResult + var res *CreateMultiSigResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res } case "decodescript": - var res DecodeScriptResult + var res *DecodeScriptResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -384,7 +384,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } case "getinfo": - var res InfoResult + var res *InfoResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -394,7 +394,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // string depending on the verbose flag. Choose the right form // accordingly. if bytes.IndexByte(objmap["result"], '{') > -1 { - var res BlockResult + var res *BlockResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -407,7 +407,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } case "getnettotals": - var res GetNetTotalsResult + var res *GetNetTotalsResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -429,10 +429,10 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // hex-encoded string depending on the verbose flag. Choose the // right form accordingly. if bytes.IndexByte(objmap["result"], '{') > -1 { - var res TxRawResult + var res *TxRawResult err = json.Unmarshal(objmap["result"], &res) if err == nil { - result.Result = &res + result.Result = res } } else { var res string @@ -442,7 +442,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } case "decoderawtransaction": - var res TxRawDecodeResult + var res *TxRawDecodeResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -454,7 +454,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } case "getmininginfo": - var res GetMiningInfoResult + var res *GetMiningInfoResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -477,7 +477,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } case "gettransaction": - var res GetTransactionResult + var res *GetTransactionResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -487,7 +487,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // depending on whether or not data was provided. Choose the // right form accordingly. if bytes.IndexByte(objmap["result"], '{') > -1 { - var res GetWorkResult + var res *GetWorkResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -500,13 +500,13 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } case "validateaddress": - var res ValidateAddressResult + var res *ValidateAddressResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res } case "signrawtransaction": - var res SignRawTransactionResult + var res *SignRawTransactionResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res @@ -524,7 +524,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } case "listsinceblock": - var res ListSinceBlockResult + var res *ListSinceBlockResult err = json.Unmarshal(objmap["result"], &res) if err == nil { if res.Transactions == nil { From 67abae0dbfccb6bc705519da4c7dfa1c74f279aa Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 5 May 2014 18:28:18 -0500 Subject: [PATCH 165/229] Add CONTRIBUTORS file. Since the github contributors list only lasts for a period of time, it's better to also maintain a contributors list in the repository rather than solely relying on github. --- CONTRIBUTORS | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CONTRIBUTORS diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 00000000..3ccdb210 --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,16 @@ +# This is the list of people who have contributed code to the repository. +# +# Names should be added to this file only after verifying that the individual +# or the individual's organization has agreed to the LICENSE. +# +# Names should be added to this file like so: +# Name + +John C. Vernaelo +Dave Collins +Owain G. Ainsworth +David Hill +Josh Rickmar +Andreas Metsälä +Francis Lam +Geert-Johan Riemer From b993af04b96b79b9a114f7a18086d38e8894870c Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 5 May 2014 22:15:28 -0500 Subject: [PATCH 166/229] Correct misspelled contributor name. --- CONTRIBUTORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 3ccdb210..b8d98b32 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -6,7 +6,7 @@ # Names should be added to this file like so: # Name -John C. Vernaelo +John C. Vernaleo Dave Collins Owain G. Ainsworth David Hill From 2e126ef59771994224d43ab83eadbd15ae6dfa01 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 9 May 2014 15:53:50 -0500 Subject: [PATCH 167/229] Rename ListUnspentResult, use correct integer types. --- jsonresults.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index d7c4dbad..802e50c9 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -295,15 +295,15 @@ type ListSinceBlockResult struct { LastBlock string `json:"lastblock"` } -// ListUnSpentResult models the data from the ListUnSpentResult command. -type ListUnSpentResult struct { +// ListUnspentResult models a successful response from the listunspent request. +type ListUnspentResult struct { TxId string `json:"txid"` - Vout float64 `json:"vout"` + Vout uint32 `json:"vout"` Address string `json:"address"` Account string `json:"account"` ScriptPubKey string `json:"scriptPubKey"` Amount float64 `json:"amount"` - Confirmations float64 `json:"confirmations"` + Confirmations int64 `json:"confirmations"` } // GetAddedNodeInfoResultAddr models the data of the addresses portion of the @@ -539,7 +539,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } case "listunspent": - var res []ListUnSpentResult + var res []ListUnspentResult err = json.Unmarshal(objmap["result"], &res) if err == nil { result.Result = res From 4f0eb662c835032c33c44250f403bd6e7b4be82d Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 12 May 2014 12:53:34 -0400 Subject: [PATCH 168/229] Support getblockchaininfo --- jsonapi.go | 2 +- jsonapi_test.go | 2 + jsoncmd.go | 66 ++++++++ jsoncmd_test.go | 10 ++ jsonresults.go | 11 ++ test_coverage.txt | 392 +++++++++++++++++++++++----------------------- 6 files changed, 289 insertions(+), 194 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index db79ade8..654ac841 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -91,7 +91,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ "getdifficulty", "getgenerate", "gethashespersec", "getinfo", "getmininginfo", "getpeerinfo", "getrawmempool", "keypoolrefill", "listaddressgroupings", "listlockunspent", - "stop", "walletlock", "getbestblockhash": + "stop", "walletlock", "getbestblockhash", "getblockchaininfo": if len(args) > 0 { err = fmt.Errorf("Too many arguments for %s", message) return finalMessage, err diff --git a/jsonapi_test.go b/jsonapi_test.go index 7a9376a4..98055de9 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -177,6 +177,8 @@ var cmdtests = []struct { {"getrawchangeaddress", []interface{}{"something", "test"}, false}, {"getbestblockhash", []interface{}{}, true}, {"getbestblockhash", []interface{}{"something"}, false}, + {"getblockchaininfo", []interface{}{}, true}, + {"getblockchaininfo", []interface{}{"something"}, false}, {"submitblock", []interface{}{}, false}, {"submitblock", []interface{}{"something"}, true}, {"submitblock", []interface{}{"something", "something else"}, true}, diff --git a/jsoncmd.go b/jsoncmd.go index f6e8f4bf..2e2bdd22 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -158,6 +158,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "getblock": cmd = new(GetBlockCmd) + case "getblockchaininfo": + cmd = new(GetBlockChainInfoCmd) + case "getblockcount": cmd = new(GetBlockCountCmd) @@ -1928,6 +1931,69 @@ func (cmd *GetBlockCmd) UnmarshalJSON(b []byte) error { return nil } +// GetBlockChainInfoCmd is a type handling custom marshaling and +// unmarshaling of getblockchaininfo JSON RPC commands. +type GetBlockChainInfoCmd struct { + id interface{} +} + +// Enforce that GetBlockChainInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetBlockChainInfoCmd{} + +// NewBlockChainInfoCmd creates a new GetBlockChainInfoCmd. +func NewGetBlockChainInfoCmd(id interface{}) (*GetBlockChainInfoCmd, error) { + return &GetBlockChainInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetBlockChainInfoCmd) Id() interface{} { + return cmd.id +} + +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetBlockChainInfoCmd) SetId(id interface{}) { + cmd.id = id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetBlockChainInfoCmd) Method() string { + return "getblockchaininfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetBlockChainInfoCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetBlockChainInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetBlockChainInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // GetBlockCountCmd is a type handling custom marshaling and // unmarshaling of getblockcount JSON RPC commands. type GetBlockCountCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 38632fe6..3caa6a00 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -347,6 +347,16 @@ var jsoncmdtests = []struct { Verbose: true, }, }, + { + name: "basic", + cmd: "getblockchaininfo", + f: func() (Cmd, error) { + return NewGetBlockChainInfoCmd(testId) + }, + result: &GetBlockChainInfoCmd{ + id: testId, + }, + }, { name: "basic", cmd: "getblockcount", diff --git a/jsonresults.go b/jsonresults.go index 802e50c9..c6a0b096 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -66,6 +66,17 @@ type DecodeScriptResult struct { P2sh string `json:"p2sh"` } +// GetBlockChainInfoResult models the data returned from the getblockchaininfo +// command. +type GetBlockChainInfoResult struct { + Chain string `json:"chain"` + Blocks int32 `json:"blocks"` + BestBlockHash string `json:"bestblockhash"` + Difficulty float64 `json:"difficulty"` + VerificationProgress float64 `json:"verificationprogress"` + ChainWork string `json:"chainwork"` +} + // GetPeerInfoResult models the data returned from the getpeerinfo command. type GetPeerInfoResult struct { Addr string `json:"addr"` diff --git a/test_coverage.txt b/test_coverage.txt index 7f95a4c5..48465473 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,23 +6,63 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) @@ -33,7 +73,6 @@ github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) @@ -43,7 +82,9 @@ github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1 github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) @@ -52,20 +93,16 @@ github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) @@ -78,8 +115,6 @@ github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) @@ -87,12 +122,10 @@ github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% ( github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) @@ -108,19 +141,15 @@ github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% ( github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) @@ -137,24 +166,57 @@ github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) @@ -163,22 +225,18 @@ github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) @@ -191,17 +249,14 @@ github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) @@ -211,234 +266,185 @@ github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1 github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.78% (79/90) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.91% (80/91) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/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.05% (85/149) @@ -451,16 +457,16 @@ github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) 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/jsoncmd.go newUnparsableCmd 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.27% (2348/3000) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.28% (2364/3020) From 529036ec2b77b37fea0d8c6320a4462182405118 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 14 May 2014 11:45:13 -0400 Subject: [PATCH 169/229] Implement getnetworkinfo --- jsonapi.go | 3 +- jsonapi_test.go | 2 + jsoncmd.go | 66 ++++++ jsoncmd_test.go | 10 + jsonresults.go | 33 +++ jsonresults_test.go | 4 + test_coverage.txt | 526 ++++++++++++++++++++++---------------------- 7 files changed, 383 insertions(+), 261 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 654ac841..347b47f8 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -91,7 +91,8 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ "getdifficulty", "getgenerate", "gethashespersec", "getinfo", "getmininginfo", "getpeerinfo", "getrawmempool", "keypoolrefill", "listaddressgroupings", "listlockunspent", - "stop", "walletlock", "getbestblockhash", "getblockchaininfo": + "stop", "walletlock", "getbestblockhash", "getblockchaininfo", + "getnetworkinfo": if len(args) > 0 { err = fmt.Errorf("Too many arguments for %s", message) return finalMessage, err diff --git a/jsonapi_test.go b/jsonapi_test.go index 98055de9..90c2d07f 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -179,6 +179,8 @@ var cmdtests = []struct { {"getbestblockhash", []interface{}{"something"}, false}, {"getblockchaininfo", []interface{}{}, true}, {"getblockchaininfo", []interface{}{"something"}, false}, + {"getnetworkinfo", []interface{}{}, true}, + {"getnetworkinfo", []interface{}{"something"}, false}, {"submitblock", []interface{}{}, false}, {"submitblock", []interface{}{"something"}, true}, {"submitblock", []interface{}{"something", "something else"}, true}, diff --git a/jsoncmd.go b/jsoncmd.go index 2e2bdd22..542c5568 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -194,6 +194,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "getnetworkhashps": cmd = new(GetNetworkHashPSCmd) + case "getnetworkinfo": + cmd = new(GetNetworkInfoCmd) + case "getnewaddress": cmd = new(GetNewAddressCmd) @@ -2604,6 +2607,69 @@ func (cmd *GetMiningInfoCmd) UnmarshalJSON(b []byte) error { return nil } +// GetNetworkInfoCmd is a type handling custom marshaling and +// unmarshaling of getnetworkinfo JSON RPC commands. +type GetNetworkInfoCmd struct { + id interface{} +} + +// Enforce that GetNetworkInfoCmd satisifies the Cmd interface. +var _ Cmd = &GetNetworkInfoCmd{} + +// NewNetworkInfoCmd creates a new GetNetworkInfoCmd. +func NewGetNetworkInfoCmd(id interface{}) (*GetNetworkInfoCmd, error) { + return &GetNetworkInfoCmd{ + id: id, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *GetNetworkInfoCmd) Id() interface{} { + return cmd.id +} + +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *GetNetworkInfoCmd) SetId(id interface{}) { + cmd.id = id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *GetNetworkInfoCmd) Method() string { + return "getnetworkinfo" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *GetNetworkInfoCmd) MarshalJSON() ([]byte, error) { + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), []interface{}{}) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *GetNetworkInfoCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) > 0 { + return ErrWrongNumberOfParams + } + + newCmd, err := NewGetNetworkInfoCmd(r.Id) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // GetNetTotalsCmd is a type handling custom marshaling and // unmarshaling of getnettotals JSON RPC commands. type GetNetTotalsCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 3caa6a00..61bd1e97 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -533,6 +533,16 @@ var jsoncmdtests = []struct { Height: 1000, }, }, + { + name: "basic", + cmd: "getnetworkinfo", + f: func() (Cmd, error) { + return NewGetNetworkInfoCmd(testId) + }, + result: &GetNetworkInfoCmd{ + id: testId, + }, + }, { name: "basic", cmd: "getnewaddress", diff --git a/jsonresults.go b/jsonresults.go index c6a0b096..3cca63ee 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -77,6 +77,24 @@ type GetBlockChainInfoResult struct { ChainWork string `json:"chainwork"` } +// LocalAddressesResult models the localaddresses data from the getnetworkinfo command. +type LocalAddressesResult struct { + Address string `json:"address"` + Port uint16 `json:"port"` + Score int `json:"score"` +} + +// GetNetworkInfoResult models the data returned from the getnetworkinfo command. +type GetNetworkInfoResult struct { + Version uint32 `json:"version"` + ProtocolVersion uint32 `json:"protocolversion"` + TimeOffset int64 `json:"timeoffset"` + Connections int `json:"connections"` + Proxy string `json:"proxy,omitempty"` + RelayFee float64 `json:"relayfee"` + LocalAddresses []LocalAddressesResult `json:"localaddresses"` +} + // GetPeerInfoResult models the data returned from the getpeerinfo command. type GetPeerInfoResult struct { Addr string `json:"addr"` @@ -417,6 +435,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } } + case "getblockchaininfo": + var res *GetBlockChainInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getnettotals": var res *GetNetTotalsResult err = json.Unmarshal(objmap["result"], &res) @@ -470,6 +494,15 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "getnetworkinfo": + var res *GetNetworkInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + if res.LocalAddresses == nil { + res.LocalAddresses = []LocalAddressesResult{} + } + result.Result = res + } case "getrawmempool": // getrawmempool can either return a map of JSON objects or // an array of strings depending on the verbose flag. Choose diff --git a/jsonresults_test.go b/jsonresults_test.go index de434589..db790fd4 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -35,6 +35,10 @@ var resulttests = []struct { {"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, + {"getblockchaininfo", []byte(`{"result":{"chain":"hex","blocks":250000,"bestblockhash":"hash"},"error":null,"id":1}`), false, true}, + {"getblockchaininfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getnetworkinfo", []byte(`{"result":{"version":100,"protocolversion":70002},"error":null,"id":1}`), false, true}, + {"getnetworkinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, {"gettransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, diff --git a/test_coverage.txt b/test_coverage.txt index 48465473..a9b92866 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,86 +6,17 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) @@ -93,9 +24,13 @@ github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) @@ -103,9 +38,12 @@ github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1 github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) @@ -113,114 +51,55 @@ github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) @@ -229,14 +108,18 @@ github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% ( github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) @@ -245,197 +128,320 @@ github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 87.91% (80/91) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.04% (81/92) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) @@ -445,9 +451,9 @@ 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.75% (95/159) 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.05% (85/149) 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) @@ -460,13 +466,13 @@ github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 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/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.28% (2364/3020) +github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 78.35% (2389/3049) From 82e79619a5fee4c841f1309b9bfad1263e005d84 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 21 May 2014 16:08:19 -0500 Subject: [PATCH 170/229] Add missing redeemScript to ListUnspentResult. ok @jcvernaleo --- jsonresults.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonresults.go b/jsonresults.go index 3cca63ee..08b9df4a 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -331,6 +331,7 @@ type ListUnspentResult struct { Address string `json:"address"` Account string `json:"account"` ScriptPubKey string `json:"scriptPubKey"` + RedeemScript string `json:"redeemScript,omitempty"` Amount float64 `json:"amount"` Confirmations int64 `json:"confirmations"` } From 66afd1dbc9e4a5d65f60fabbfb418e0ac2bbee97 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 5 Jun 2014 13:52:37 -0400 Subject: [PATCH 171/229] Use NewReader instead of NewBuffer. --- jsonfxns.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonfxns.go b/jsonfxns.go index d87609c0..5bf2cfda 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -53,7 +53,7 @@ func jsonRpcSend(user string, password string, server string, message []byte, } credentials := user + ":" + password resp, err := client.Post(protocol+"://"+credentials+"@"+server, - "application/json", bytes.NewBuffer(message)) + "application/json", bytes.NewReader(message)) if err != nil { // We do not want to log the username/password in the errors. replaceStr := ":" From 1723db03c57a65fb3b0abdc8321884248ca1dbd6 Mon Sep 17 00:00:00 2001 From: Nicola 'tekNico' Larosa Date: Fri, 6 Jun 2014 17:43:37 +0200 Subject: [PATCH 172/229] Add type and handling for listreceivedbyaddress. --- jsonresults.go | 17 ++++++++++++++++- jsonresults_test.go | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index 08b9df4a..93f2ffc8 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -313,7 +313,16 @@ type SignRawTransactionResult struct { // ListReceivedByAccountResult models the data from the listreceivedbyaccount // command. type ListReceivedByAccountResult struct { - Account string `json: "account"` + Account string `json:"account"` + Amount float64 `json:"amount"` + Confirmations uint64 `json:"confirmations"` +} + +// ListReceivedByAddressResult models the data from the listreceivedbyaddress +// command. +type ListReceivedByAddressResult struct { + Account string `json:"account"` + Address string `json:"address"` Amount float64 `json:"amount"` Confirmations uint64 `json:"confirmations"` } @@ -568,6 +577,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "listreceivedbyaddress": + var res []ListReceivedByAddressResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "listsinceblock": var res *ListSinceBlockResult err = json.Unmarshal(objmap["result"], &res) diff --git a/jsonresults_test.go b/jsonresults_test.go index db790fd4..469dca67 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -49,6 +49,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}, + {"listreceivedbyaddress", []byte(`{"error":null,"id":1,"result":[{"a"}]}`), false, false}, + {"listreceivedbyaddress", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), 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}, From 92c7716dd43458394cf5b1ca328addc21ba1e646 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 10 Jun 2014 16:29:56 -0400 Subject: [PATCH 173/229] Update coverage report. --- test_coverage.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index a9b92866..49ec16fd 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -451,7 +451,7 @@ 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.75% (95/159) +github.com/conformal/btcjson/jsonresults.go ReadResultCmd 60.74% (99/163) 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/jsonapi.go rpcRawCommand 53.33% (8/15) @@ -474,5 +474,5 @@ github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.35% (2389/3049) +github.com/conformal/btcjson --------------------------------------- 78.38% (2393/3053) From 39b09f7be1f1880323dcb688d8336653ab899fc7 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 11 Jun 2014 11:05:13 -0400 Subject: [PATCH 174/229] Add support for estimatefee and estimatepriority. --- cmdhelp.go | 8 + jsonapi.go | 2 +- jsonapi_test.go | 8 + jsoncmd.go | 154 +++++++++++++++ jsoncmd_test.go | 24 +++ jsonresults.go | 2 +- test_coverage.txt | 470 ++++++++++++++++++++++++---------------------- 7 files changed, 437 insertions(+), 231 deletions(-) diff --git a/cmdhelp.go b/cmdhelp.go index 3211cbce..d65adc92 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -130,6 +130,14 @@ Encrypts the wallet with "passphrase". This command is for the initial encryption of an otherwise unencrypted wallet, changing a passphrase should use walletpassphrasechange.`, + "estimatefee": `estimatefee "numblocks" +Estimates the approximate fee per kilobyte needed for a transaction to +get confirmed within 'numblocks' blocks.`, + + "estimatepriority": `estimatepriority "numblocks" +Estimates the approximate priority a zero-fee transaction needs to get +confirmed within 'numblocks' blocks.`, + "getaccount": `getaccount "address" Returns the account associated with the given "address" as a string.`, diff --git a/jsonapi.go b/jsonapi.go index 347b47f8..63e6edcc 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -113,7 +113,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } finalMessage, err = jsonWithArgs(message, id, args) // One required int - case "getblockhash": + case "getblockhash", "estimatefee", "estimatepriority": if len(args) != 1 { err = fmt.Errorf("Missing argument for %s", message) return finalMessage, err diff --git a/jsonapi_test.go b/jsonapi_test.go index 90c2d07f..0871ded8 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -32,6 +32,14 @@ var cmdtests = []struct { {"listaccounts", []interface{}{1}, true}, {"listaccounts", []interface{}{"test"}, false}, {"listaccounts", []interface{}{1, 2}, false}, + {"estimatefee", nil, false}, + {"estimatefee", []interface{}{1}, true}, + {"estimatefee", []interface{}{1, 2}, false}, + {"estimatefee", []interface{}{1.3}, false}, + {"estimatepriority", nil, false}, + {"estimatepriority", []interface{}{1}, true}, + {"estimatepriority", []interface{}{1, 2}, false}, + {"estimatepriority", []interface{}{1.3}, false}, {"getblockhash", nil, false}, {"getblockhash", []interface{}{1}, true}, {"getblockhash", []interface{}{1, 2}, false}, diff --git a/jsoncmd.go b/jsoncmd.go index 542c5568..fa08a46e 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -137,6 +137,12 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "encryptwallet": cmd = new(EncryptWalletCmd) + case "estimatefee": + cmd = new(EstimateFeeCmd) + + case "estimatepriority": + cmd = new(EstimatePriorityCmd) + case "getaccount": cmd = new(GetAccountCmd) @@ -1318,6 +1324,154 @@ func (cmd *EncryptWalletCmd) UnmarshalJSON(b []byte) error { return nil } +// EstimateFeeCmd is a type handling custom marshaling and +// unmarshaling of estimatefee JSON RPC commands. +type EstimateFeeCmd struct { + id interface{} + NumBlocks int64 +} + +// Enforce that EstimateFeeCmd satisifies the Cmd interface. +var _ Cmd = &EstimateFeeCmd{} + +// NewEstimateFeeCmd creates a new EstimateFeeCmd. +func NewEstimateFeeCmd(id interface{}, numblocks int64) (*EstimateFeeCmd, error) { + return &EstimateFeeCmd{ + id: id, + NumBlocks: numblocks, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *EstimateFeeCmd) Id() interface{} { + return cmd.id +} + +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *EstimateFeeCmd) SetId(id interface{}) { + cmd.id = id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *EstimateFeeCmd) Method() string { + return "estimatefee" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *EstimateFeeCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.NumBlocks, + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *EstimateFeeCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + var numblocks int64 + if err := json.Unmarshal(r.Params[0], &numblocks); err != nil { + return fmt.Errorf("first parameter 'numblocks' must be an integer: %v", err) + } + + newCmd, err := NewEstimateFeeCmd(r.Id, numblocks) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// EstimatePriorityCmd is a type handling custom marshaling and +// unmarshaling of estimatepriority JSON RPC commands. +type EstimatePriorityCmd struct { + id interface{} + NumBlocks int64 +} + +// Enforce that EstimatePriorityCmd satisifies the Cmd interface. +var _ Cmd = &EstimatePriorityCmd{} + +// NewEstimatePriorityCmd creates a new EstimatePriorityCmd. +func NewEstimatePriorityCmd(id interface{}, numblocks int64) (*EstimatePriorityCmd, error) { + return &EstimatePriorityCmd{ + id: id, + NumBlocks: numblocks, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *EstimatePriorityCmd) Id() interface{} { + return cmd.id +} + +// SetId allows one to modify the Id of a Cmd to help in relaying them. +func (cmd *EstimatePriorityCmd) SetId(id interface{}) { + cmd.id = id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *EstimatePriorityCmd) Method() string { + return "estimatepriority" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *EstimatePriorityCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.NumBlocks, + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *EstimatePriorityCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + var numblocks int64 + if err := json.Unmarshal(r.Params[0], &numblocks); err != nil { + return fmt.Errorf("first parameter 'numblocks' must be an integer: %v", err) + } + + newCmd, err := NewEstimatePriorityCmd(r.Id, numblocks) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // GetAccountCmd is a type handling custom marshaling and // unmarshaling of getaccount JSON RPC commands. type GetAccountCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 61bd1e97..63eccf77 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -207,6 +207,28 @@ var jsoncmdtests = []struct { Passphrase: "passphrase", }, }, + { + name: "basic", + cmd: "estimatefee", + f: func() (Cmd, error) { + return NewEstimateFeeCmd(testId, 1234) + }, + result: &EstimateFeeCmd{ + id: testId, + NumBlocks: 1234, + }, + }, + { + name: "basic", + cmd: "estimatepriority", + f: func() (Cmd, error) { + return NewEstimatePriorityCmd(testId, 1234) + }, + result: &EstimatePriorityCmd{ + id: testId, + NumBlocks: 1234, + }, + }, { name: "basic", cmd: "getaccount", @@ -1616,6 +1638,8 @@ func TestHelps(t *testing.T) { "dumpprivkey", "dumpwallet", "encryptwallet", + "estimatefee", + "estimatepriority", "getaccount", "getaccountaddress", "getaddednodeinfo", diff --git a/jsonresults.go b/jsonresults.go index 93f2ffc8..70b4b807 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -613,7 +613,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { "getnewaddress", "sendtoaddress", "createrawtransaction", "sendrawtransaction", "getbestblockhash", "getrawchangeaddress", "sendfrom", "sendmany", "addmultisigaddress", "getunconfirmedbalance", - "getaccountaddress": + "getaccountaddress", "estimatefee", "estimatepriority": err = json.Unmarshal(message, &result) default: // None of the standard Bitcoin RPC methods matched. Try diff --git a/test_coverage.txt b/test_coverage.txt index 49ec16fd..b56a0534 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,444 +6,456 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.04% (81/92) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.30% (83/94) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 66.67% (8/12) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) @@ -462,17 +474,17 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/2 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) -github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) +github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) +github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) 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/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.38% (2393/3053) +github.com/conformal/btcjson --------------------------------------- 78.38% (2429/3099) From 65c0570234fdb4f809f2b911c72fca2052e45ead Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 11 Jun 2014 12:01:05 -0500 Subject: [PATCH 175/229] Remove SetId from Cmd interface. --- jsoncmd.go | 386 ------------------------------------------------ jsoncmd_test.go | 7 - 2 files changed, 393 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index fa08a46e..5c9eae12 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -24,7 +24,6 @@ type Cmd interface { json.Marshaler json.Unmarshaler Id() interface{} - SetId(interface{}) Method() string } @@ -382,11 +381,6 @@ func (cmd *unparsableCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *unparsableCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *unparsableCmd) Method() string { return cmd.method @@ -456,11 +450,6 @@ func (cmd *AddMultisigAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *AddMultisigAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *AddMultisigAddressCmd) Method() string { return "addmultisigaddress" @@ -559,11 +548,6 @@ func (cmd *AddNodeCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *AddNodeCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *AddNodeCmd) Method() string { return "addnode" @@ -640,11 +624,6 @@ func (cmd *BackupWalletCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *BackupWalletCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *BackupWalletCmd) Method() string { return "backupwallet" @@ -717,11 +696,6 @@ func (cmd *CreateMultisigCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *CreateMultisigCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *CreateMultisigCmd) Method() string { return "createmultisig" @@ -806,11 +780,6 @@ func (cmd *CreateRawTransactionCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *CreateRawTransactionCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *CreateRawTransactionCmd) Method() string { return "createrawtransaction" @@ -903,11 +872,6 @@ func (cmd *DebugLevelCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *DebugLevelCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *DebugLevelCmd) Method() string { return "debuglevel" @@ -977,11 +941,6 @@ func (cmd *DecodeRawTransactionCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *DecodeRawTransactionCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *DecodeRawTransactionCmd) Method() string { return "decoderawtransaction" @@ -1051,11 +1010,6 @@ func (cmd *DecodeScriptCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *DecodeScriptCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *DecodeScriptCmd) Method() string { return "decodescript" @@ -1125,11 +1079,6 @@ func (cmd *DumpPrivKeyCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *DumpPrivKeyCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *DumpPrivKeyCmd) Method() string { return "dumpprivkey" @@ -1199,11 +1148,6 @@ func (cmd *DumpWalletCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *DumpWalletCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *DumpWalletCmd) Method() string { return "dumpwallet" @@ -1273,11 +1217,6 @@ func (cmd *EncryptWalletCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *EncryptWalletCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *EncryptWalletCmd) Method() string { return "encryptwallet" @@ -1347,11 +1286,6 @@ func (cmd *EstimateFeeCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *EstimateFeeCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *EstimateFeeCmd) Method() string { return "estimatefee" @@ -1421,11 +1355,6 @@ func (cmd *EstimatePriorityCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *EstimatePriorityCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *EstimatePriorityCmd) Method() string { return "estimatepriority" @@ -1495,11 +1424,6 @@ func (cmd *GetAccountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetAccountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAccountCmd) Method() string { return "getaccount" @@ -1569,11 +1493,6 @@ func (cmd *GetAccountAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetAccountAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAccountAddressCmd) Method() string { return "getaccountaddress" @@ -1654,11 +1573,6 @@ func (cmd *GetAddedNodeInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetAddedNodeInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAddedNodeInfoCmd) Method() string { return "getaddednodeinfo" @@ -1739,11 +1653,6 @@ func (cmd *GetAddressesByAccountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetAddressesByAccountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetAddressesByAccountCmd) Method() string { return "getaddressesbyaccount" @@ -1838,11 +1747,6 @@ func (cmd *GetBalanceCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBalanceCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBalanceCmd) Method() string { return "getbalance" @@ -1926,11 +1830,6 @@ func (cmd *GetBestBlockHashCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBestBlockHashCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBestBlockHashCmd) Method() string { return "getbestblockhash" @@ -2013,11 +1912,6 @@ func (cmd *GetBlockCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBlockCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockCmd) Method() string { return "getblock" @@ -2109,11 +2003,6 @@ func (cmd *GetBlockChainInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBlockChainInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockChainInfoCmd) Method() string { return "getblockchaininfo" @@ -2172,11 +2061,6 @@ func (cmd *GetBlockCountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBlockCountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockCountCmd) Method() string { return "getblockcount" @@ -2237,11 +2121,6 @@ func (cmd *GetBlockHashCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBlockHashCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockHashCmd) Method() string { return "getblockhash" @@ -2327,11 +2206,6 @@ func (cmd *GetBlockTemplateCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetBlockTemplateCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetBlockTemplateCmd) Method() string { return "getblocktemplate" @@ -2404,11 +2278,6 @@ func (cmd *GetConnectionCountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetConnectionCountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetConnectionCountCmd) Method() string { return "getconnectioncount" @@ -2467,11 +2336,6 @@ func (cmd *GetDifficultyCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetDifficultyCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetDifficultyCmd) Method() string { return "getdifficulty" @@ -2530,11 +2394,6 @@ func (cmd *GetGenerateCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetGenerateCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetGenerateCmd) Method() string { return "getgenerate" @@ -2593,11 +2452,6 @@ func (cmd *GetHashesPerSecCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetHashesPerSecCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetHashesPerSecCmd) Method() string { return "gethashespersec" @@ -2656,11 +2510,6 @@ func (cmd *GetInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetInfoCmd) Method() string { return "getinfo" @@ -2719,11 +2568,6 @@ func (cmd *GetMiningInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetMiningInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetMiningInfoCmd) Method() string { return "getmininginfo" @@ -2782,11 +2626,6 @@ func (cmd *GetNetworkInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetNetworkInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNetworkInfoCmd) Method() string { return "getnetworkinfo" @@ -2845,11 +2684,6 @@ func (cmd *GetNetTotalsCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetNetTotalsCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNetTotalsCmd) Method() string { return "getnettotals" @@ -2926,11 +2760,6 @@ func (cmd *GetNetworkHashPSCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetNetworkHashPSCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNetworkHashPSCmd) Method() string { return "getnetworkhashps" @@ -3023,11 +2852,6 @@ func (cmd *GetNewAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetNewAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetNewAddressCmd) Method() string { return "getnewaddress" @@ -3100,11 +2924,6 @@ func (cmd *GetPeerInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetPeerInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetPeerInfoCmd) Method() string { return "getpeerinfo" @@ -3173,11 +2992,6 @@ func (cmd *GetRawChangeAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetRawChangeAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetRawChangeAddressCmd) Method() string { return "getrawchangeaddress" @@ -3259,11 +3073,6 @@ func (cmd *GetRawMempoolCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetRawMempoolCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetRawMempoolCmd) Method() string { return "getrawmempool" @@ -3348,11 +3157,6 @@ func (cmd *GetRawTransactionCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetRawTransactionCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetRawTransactionCmd) Method() string { return "getrawtransaction" @@ -3442,11 +3246,6 @@ func (cmd *GetReceivedByAccountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetReceivedByAccountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetReceivedByAccountCmd) Method() string { return "getreceivedbyaccount" @@ -3536,11 +3335,6 @@ func (cmd *GetReceivedByAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetReceivedByAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetReceivedByAddressCmd) Method() string { return "getreceivedbyaddress" @@ -3621,11 +3415,6 @@ func (cmd *GetTransactionCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetTransactionCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetTransactionCmd) Method() string { return "gettransaction" @@ -3706,11 +3495,6 @@ func (cmd *GetTxOutCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetTxOutCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetTxOutCmd) Method() string { return "gettxout" @@ -3795,11 +3579,6 @@ func (cmd *GetTxOutSetInfoCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetTxOutSetInfoCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetTxOutSetInfoCmd) Method() string { return "gettxoutsetinfo" @@ -3868,11 +3647,6 @@ func (cmd *GetWorkCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *GetWorkCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *GetWorkCmd) Method() string { return "getwork" @@ -3953,11 +3727,6 @@ func (cmd *HelpCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *HelpCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *HelpCmd) Method() string { return "help" @@ -4056,11 +3825,6 @@ func (cmd *ImportPrivKeyCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ImportPrivKeyCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ImportPrivKeyCmd) Method() string { return "importprivkey" @@ -4153,11 +3917,6 @@ func (cmd *ImportWalletCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ImportWalletCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ImportWalletCmd) Method() string { return "importwallet" @@ -4237,11 +3996,6 @@ func (cmd *KeyPoolRefillCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *KeyPoolRefillCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *KeyPoolRefillCmd) Method() string { return "keypoolrefill" @@ -4324,11 +4078,6 @@ func (cmd *ListAccountsCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListAccountsCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListAccountsCmd) Method() string { return "listaccounts" @@ -4402,11 +4151,6 @@ func (cmd *ListAddressGroupingsCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListAddressGroupingsCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListAddressGroupingsCmd) Method() string { return "listaddressgroupings" @@ -4466,11 +4210,6 @@ func (cmd *ListLockUnspentCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListLockUnspentCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListLockUnspentCmd) Method() string { return "listlockunspent" @@ -4555,11 +4294,6 @@ func (cmd *ListReceivedByAccountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListReceivedByAccountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListReceivedByAccountCmd) Method() string { return "listreceivedbyaccount" @@ -4668,11 +4402,6 @@ func (cmd *ListReceivedByAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListReceivedByAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListReceivedByAddressCmd) Method() string { return "listreceivedbyaddress" @@ -4781,11 +4510,6 @@ func (cmd *ListSinceBlockCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListSinceBlockCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListSinceBlockCmd) Method() string { return "listsinceblock" @@ -4905,11 +4629,6 @@ func (cmd *ListTransactionsCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListTransactionsCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListTransactionsCmd) Method() string { return "listtransactions" @@ -5037,11 +4756,6 @@ func (cmd *ListUnspentCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ListUnspentCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ListUnspentCmd) Method() string { return "listunspent" @@ -5149,11 +4863,6 @@ func (cmd *LockUnspentCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *LockUnspentCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *LockUnspentCmd) Method() string { return "lockunspent" @@ -5266,11 +4975,6 @@ func (cmd *MoveCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *MoveCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *MoveCmd) Method() string { return "move" @@ -5377,11 +5081,6 @@ func (cmd *PingCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *PingCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *PingCmd) Method() string { return "ping" @@ -5484,11 +5183,6 @@ func (cmd *SendFromCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SendFromCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SendFromCmd) Method() string { return "sendfrom" @@ -5635,11 +5329,6 @@ func (cmd *SendManyCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SendManyCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SendManyCmd) Method() string { return "sendmany" @@ -5760,11 +5449,6 @@ func (cmd *SendRawTransactionCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SendRawTransactionCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SendRawTransactionCmd) Method() string { return "sendrawtransaction" @@ -5874,11 +5558,6 @@ func (cmd *SendToAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SendToAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SendToAddressCmd) Method() string { return "sendtoaddress" @@ -5983,11 +5662,6 @@ func (cmd *SetAccountCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SetAccountCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SetAccountCmd) Method() string { return "setaccount" @@ -6075,11 +5749,6 @@ func (cmd *SetGenerateCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SetGenerateCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SetGenerateCmd) Method() string { return "setgenerate" @@ -6161,11 +5830,6 @@ func (cmd *SetTxFeeCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SetTxFeeCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SetTxFeeCmd) Method() string { return "settxfee" @@ -6242,11 +5906,6 @@ func (cmd *SignMessageCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SignMessageCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SignMessageCmd) Method() string { return "signmessage" @@ -6367,11 +6026,6 @@ func (cmd *SignRawTransactionCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SignRawTransactionCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SignRawTransactionCmd) Method() string { return "signrawtransaction" @@ -6474,11 +6128,6 @@ func (cmd *StopCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *StopCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *StopCmd) Method() string { return "stop" @@ -6557,11 +6206,6 @@ func (cmd *SubmitBlockCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *SubmitBlockCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *SubmitBlockCmd) Method() string { return "submitblock" @@ -6645,11 +6289,6 @@ func (cmd *ValidateAddressCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *ValidateAddressCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *ValidateAddressCmd) Method() string { return "validateaddress" @@ -6737,11 +6376,6 @@ func (cmd *VerifyChainCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *VerifyChainCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *VerifyChainCmd) Method() string { return "verifychain" @@ -6835,11 +6469,6 @@ func (cmd *VerifyMessageCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *VerifyMessageCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *VerifyMessageCmd) Method() string { return "verifymessage" @@ -6921,11 +6550,6 @@ func (cmd *WalletLockCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *WalletLockCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *WalletLockCmd) Method() string { return "walletlock" @@ -6990,11 +6614,6 @@ func (cmd *WalletPassphraseCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *WalletPassphraseCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *WalletPassphraseCmd) Method() string { return "walletpassphrase" @@ -7074,11 +6693,6 @@ func (cmd *WalletPassphraseChangeCmd) Id() interface{} { return cmd.id } -// SetId allows one to modify the Id of a Cmd to help in relaying them. -func (cmd *WalletPassphraseChangeCmd) SetId(id interface{}) { - cmd.id = id -} - // Method satisfies the Cmd interface by returning the json method. func (cmd *WalletPassphraseChangeCmd) Method() string { return "walletpassphrasechange" diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 63eccf77..cbd2ac41 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1615,13 +1615,6 @@ func TestCmds(t *testing.T) { "got %v wanted %v", name, spew.Sdump(c2), spew.Sdump(c)) } - newId := 2.0 - c.SetId(newId) - id, ok = (c.Id()).(float64) - if !ok || id != newId { - t.Errorf("%s: id not returned properly after change.", name) - } - } } From 93f5aab0dba53d2782903a6b7949e11045d2c2a7 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 11 Jun 2014 12:02:35 -0500 Subject: [PATCH 176/229] Update test coverage report. --- test_coverage.txt | 651 ++++++++++++++++++++-------------------------- 1 file changed, 287 insertions(+), 364 deletions(-) diff --git a/test_coverage.txt b/test_coverage.txt index b56a0534..e756d276 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,408 +6,332 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.SetId 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.SetId 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.SetId 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.30% (83/94) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) @@ -415,47 +339,47 @@ github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.MarshalJSON 66.67% (8/12) github.com/conformal/btcjson/jsoncmd.go NewLockUnspentCmd 66.67% (4/6) @@ -474,17 +398,16 @@ github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/2 github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) -github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) +github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.SetId 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 78.38% (2429/3099) +github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 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 --------------------------------------- 77.86% (2353/3022) From ac5cc1d64ee48460cd4c65a2b537e4846c424911 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 11 Jun 2014 21:56:59 -0500 Subject: [PATCH 177/229] Use default genproclimit of -1 on setgenerate RPC. The correct default for the genproclimit on the setgenerate RPC is -1. ok @jcvernaleo. --- jsoncmd.go | 5 ++--- jsoncmd_test.go | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 5c9eae12..8cc0df22 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -5728,8 +5728,7 @@ var _ Cmd = &SetGenerateCmd{} // NewSetGenerateCmd creates a new SetGenerateCmd. Optionally a // pointer to a TemplateRequest may be provided. func NewSetGenerateCmd(id interface{}, generate bool, optArgs ...int) (*SetGenerateCmd, error) { - - genproclimit := 0 + genproclimit := -1 if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } @@ -5758,7 +5757,7 @@ func (cmd *SetGenerateCmd) Method() string { func (cmd *SetGenerateCmd) MarshalJSON() ([]byte, error) { params := make([]interface{}, 1, 2) params[0] = cmd.Generate - if cmd.GenProcLimit != 0 { + if cmd.GenProcLimit != -1 { params = append(params, cmd.GenProcLimit) } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index cbd2ac41..ab4f9c12 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1359,8 +1359,9 @@ var jsoncmdtests = []struct { return NewSetGenerateCmd(testId, true) }, result: &SetGenerateCmd{ - id: testId, - Generate: true, + id: testId, + Generate: true, + GenProcLimit: -1, }, }, { From 3d7749fceabbe6c8ffae2411444a658b6dbe5405 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 12 Jun 2014 15:27:10 -0400 Subject: [PATCH 178/229] Change PingTime and PingWait to float64. This is to match bitcoin-core. Caught by Skelsey. Closes #24 --- jsonresults.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 70b4b807..00384f16 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -97,22 +97,22 @@ type GetNetworkInfoResult struct { // GetPeerInfoResult models the data returned from the getpeerinfo command. type GetPeerInfoResult struct { - Addr string `json:"addr"` - AddrLocal string `json:"addrlocal,omitempty"` - Services string `json:"services"` - LastSend int64 `json:"lastsend"` - LastRecv int64 `json:"lastrecv"` - BytesSent uint64 `json:"bytessent"` - BytesRecv uint64 `json:"bytesrecv"` - PingTime int64 `json:"pingtime"` - PingWait int64 `json:"pingwait,omitempty"` - ConnTime int64 `json:"conntime"` - Version uint32 `json:"version"` - SubVer string `json:"subver"` - Inbound bool `json:"inbound"` - StartingHeight int32 `json:"startingheight"` - BanScore int `json:"banscore,omitempty"` - SyncNode bool `json:"syncnode"` + Addr string `json:"addr"` + AddrLocal string `json:"addrlocal,omitempty"` + Services string `json:"services"` + LastSend int64 `json:"lastsend"` + LastRecv int64 `json:"lastrecv"` + BytesSent uint64 `json:"bytessent"` + BytesRecv uint64 `json:"bytesrecv"` + PingTime float64 `json:"pingtime"` + PingWait float64 `json:"pingwait,omitempty"` + ConnTime int64 `json:"conntime"` + Version uint32 `json:"version"` + SubVer string `json:"subver"` + Inbound bool `json:"inbound"` + StartingHeight int32 `json:"startingheight"` + BanScore int `json:"banscore,omitempty"` + SyncNode bool `json:"syncnode"` } // GetRawMempoolResult models the data returned from the getrawmempool command. From 1997d73c652c3888ecab6042918ecec65c757abc Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 13 Jun 2014 17:06:15 -0500 Subject: [PATCH 179/229] Alphabetize result type declarations. --- jsonresults.go | 196 ++++++++++++++++++++++++------------------------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 00384f16..48f62302 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -11,26 +11,6 @@ import ( "strings" ) -// InfoResult contains the data returned by the getinfo command. -type InfoResult struct { - Version int `json:"version"` - ProtocolVersion int `json:"protocolversion"` - WalletVersion int `json:"walletversion,omitempty"` - Balance float64 `json:"balance,omitempty"` - Blocks int `json:"blocks"` - TimeOffset int64 `json:"timeoffset"` - Connections int `json:"connections"` - Proxy string `json:"proxy"` - Difficulty float64 `json:"difficulty"` - TestNet bool `json:"testnet"` - KeypoolOldest int64 `json:"keypoololdest,omitempty"` - KeypoolSize int `json:"keypoolsize,omitempty"` - UnlockedUntil int64 `json:"unlocked_until,omitempty"` - PaytxFee float64 `json:"paytxfee,omitempty"` - RelayFee float64 `json:"relayfee"` - Errors string `json:"errors"` -} - // BlockResult models the data from the getblock command when the verbose flag // is set. When the verbose flag is not set, getblock return a hex-encoded // string. @@ -66,6 +46,20 @@ type DecodeScriptResult struct { P2sh string `json:"p2sh"` } +// GetAddedNodeInfoResultAddr models the data of the addresses portion of the +// getaddednodeinfo command. +type GetAddedNodeInfoResultAddr struct { + Address string `json:"address"` + Connected string `json:"connected"` +} + +// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. +type GetAddedNodeInfoResult struct { + AddedNode string `json:"addednode"` + Connected *bool `json:"connected,omitempty"` + Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` +} + // GetBlockChainInfoResult models the data returned from the getblockchaininfo // command. type GetBlockChainInfoResult struct { @@ -77,13 +71,6 @@ type GetBlockChainInfoResult struct { ChainWork string `json:"chainwork"` } -// LocalAddressesResult models the localaddresses data from the getnetworkinfo command. -type LocalAddressesResult struct { - Address string `json:"address"` - Port uint16 `json:"port"` - Score int `json:"score"` -} - // GetNetworkInfoResult models the data returned from the getnetworkinfo command. type GetNetworkInfoResult struct { Version uint32 `json:"version"` @@ -151,49 +138,6 @@ type GetTransactionResult struct { Hex string `json:"hex"` } -// ListTransactionsResult models the data from the listtransactions command. -type ListTransactionsResult struct { - Account string `json:"account"` - Address string `json:"address,omitempty"` - Category string `json:"category"` - Amount float64 `json:"amount"` - Fee float64 `json:"fee"` - Confirmations int64 `json:"confirmations"` - Generated bool `json:"generated,omitempty"` - BlockHash string `json:"blockhash,omitempty"` - BlockIndex int64 `json:"blockindex,omitempty"` - BlockTime int64 `json:"blocktime,omitempty"` - TxID string `json:"txid"` - WalletConflicts []string `json:"walletconflicts"` - Time int64 `json:"time"` - TimeReceived int64 `json:"timereceived"` - Comment string `json:"comment,omitempty"` - OtherAccount string `json:"otheraccount"` -} - -// TxRawResult models the data from the getrawtransaction command. -type TxRawResult struct { - Hex string `json:"hex"` - Txid string `json:"txid"` - Version uint32 `json:"version"` - LockTime uint32 `json:"locktime"` - Vin []Vin `json:"vin"` - Vout []Vout `json:"vout"` - BlockHash string `json:"blockhash,omitempty"` - Confirmations uint64 `json:"confirmations,omitempty"` - Time int64 `json:"time,omitempty"` - Blocktime int64 `json:"blocktime,omitempty"` -} - -// TxRawDecodeResult models the data from the decoderawtransaction command. -type TxRawDecodeResult struct { - Txid string `json:"txid"` - Version uint32 `json:"version"` - Locktime uint32 `json:"locktime"` - Vin []Vin `json:"vin"` - Vout []Vout `json:"vout"` -} - // GetNetTotalsResult models the data returned from the getnettotals command. type GetNetTotalsResult struct { TotalBytesRecv uint64 `json:"totalbytesrecv"` @@ -288,26 +232,51 @@ type GetWorkResult struct { Target string `json:"target"` } -// ValidateAddressResult models the data from the validateaddress command. -type ValidateAddressResult struct { - IsValid bool `json:"isvalid"` - Address string `json:"address,omitempty"` - IsMine bool `json:"ismine,omitempty"` - IsScript bool `json:"isscript,omitempty"` - PubKey string `json:"pubkey,omitempty"` - IsCompressed bool `json:"iscompressed,omitempty"` - Account string `json:"account,omitempty"` - Addresses []string `json:"addresses,omitempty"` - Hex string `json:"hex,omitempty"` - Script string `json:"script,omitempty"` - SigsRequired int `json:"sigsrequired,omitempty"` +// InfoResult contains the data returned by the getinfo command. +type InfoResult struct { + Version int `json:"version"` + ProtocolVersion int `json:"protocolversion"` + WalletVersion int `json:"walletversion,omitempty"` + Balance float64 `json:"balance,omitempty"` + Blocks int `json:"blocks"` + TimeOffset int64 `json:"timeoffset"` + Connections int `json:"connections"` + Proxy string `json:"proxy"` + Difficulty float64 `json:"difficulty"` + TestNet bool `json:"testnet"` + KeypoolOldest int64 `json:"keypoololdest,omitempty"` + KeypoolSize int `json:"keypoolsize,omitempty"` + UnlockedUntil int64 `json:"unlocked_until,omitempty"` + PaytxFee float64 `json:"paytxfee,omitempty"` + RelayFee float64 `json:"relayfee"` + Errors string `json:"errors"` } -// SignRawTransactionResult models the data from the signrawtransaction -// command. -type SignRawTransactionResult struct { - Hex string `json:"hex"` - Complete bool `json:"complete"` +// ListTransactionsResult models the data from the listtransactions command. +type ListTransactionsResult struct { + Account string `json:"account"` + Address string `json:"address,omitempty"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee"` + Confirmations int64 `json:"confirmations"` + Generated bool `json:"generated,omitempty"` + BlockHash string `json:"blockhash,omitempty"` + BlockIndex int64 `json:"blockindex,omitempty"` + BlockTime int64 `json:"blocktime,omitempty"` + TxID string `json:"txid"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Comment string `json:"comment,omitempty"` + OtherAccount string `json:"otheraccount"` +} + +// LocalAddressesResult models the localaddresses data from the getnetworkinfo command. +type LocalAddressesResult struct { + Address string `json:"address"` + Port uint16 `json:"port"` + Score int `json:"score"` } // ListReceivedByAccountResult models the data from the listreceivedbyaccount @@ -345,18 +314,49 @@ type ListUnspentResult struct { Confirmations int64 `json:"confirmations"` } -// GetAddedNodeInfoResultAddr models the data of the addresses portion of the -// getaddednodeinfo command. -type GetAddedNodeInfoResultAddr struct { - Address string `json:"address"` - Connected string `json:"connected"` +// SignRawTransactionResult models the data from the signrawtransaction +// command. +type SignRawTransactionResult struct { + Hex string `json:"hex"` + Complete bool `json:"complete"` } -// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. -type GetAddedNodeInfoResult struct { - AddedNode string `json:"addednode"` - Connected *bool `json:"connected,omitempty"` - Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` +// TxRawResult models the data from the getrawtransaction command. +type TxRawResult struct { + Hex string `json:"hex"` + Txid string `json:"txid"` + Version uint32 `json:"version"` + LockTime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` + BlockHash string `json:"blockhash,omitempty"` + Confirmations uint64 `json:"confirmations,omitempty"` + Time int64 `json:"time,omitempty"` + Blocktime int64 `json:"blocktime,omitempty"` +} + +// TxRawDecodeResult models the data from the decoderawtransaction command. +type TxRawDecodeResult struct { + Txid string `json:"txid"` + Version uint32 `json:"version"` + Locktime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` +} + +// ValidateAddressResult models the data from the validateaddress command. +type ValidateAddressResult struct { + IsValid bool `json:"isvalid"` + Address string `json:"address,omitempty"` + IsMine bool `json:"ismine,omitempty"` + IsScript bool `json:"isscript,omitempty"` + PubKey string `json:"pubkey,omitempty"` + IsCompressed bool `json:"iscompressed,omitempty"` + Account string `json:"account,omitempty"` + Addresses []string `json:"addresses,omitempty"` + Hex string `json:"hex,omitempty"` + Script string `json:"script,omitempty"` + SigsRequired int `json:"sigsrequired,omitempty"` } // ReadResultCmd unmarshalls the json reply with data struct for specific From b585d4e3a0233f5933d5fb7bad7960480890fdb7 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 16 Jun 2014 10:26:11 -0500 Subject: [PATCH 180/229] Make params which reference txout indices uint32. This reasons for this change follow: - All instances of the same key should be consistent amongst the commands and returns - Output indices can't be negative, so rather than adding more code to check for a negative after unmarshal, just allow the unmarshal to weed out negatives ok @jcvernaleo --- jsonapi.go | 8 ++++---- jsonapi_test.go | 4 ++-- jsoncmd.go | 2 +- jsonresults.go | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 63e6edcc..ba678d23 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -490,13 +490,13 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } type vlist struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` } vList := make([]vlist, len(args)/4) addresses := make(map[string]float64) for i := 0; i < len(args)/4; i += 1 { txid, ok1 := args[(i*4)+0].(string) - vout, ok2 := args[(i*4)+1].(int) + vout, ok2 := args[(i*4)+1].(uint32) add, ok3 := args[(i*4)+2].(string) amt, ok4 := args[(i*4)+3].(float64) if !ok1 || !ok2 || !ok3 || !ok4 { @@ -574,14 +574,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } type txlist struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptPubKey string `json:"scriptPubKey"` } txList := make([]txlist, 1) if len(args) > 1 { txid, ok2 := args[1].(string) - vout, ok3 := args[2].(int) + vout, ok3 := args[2].(uint32) spkey, ok4 := args[3].(string) if !ok1 || !ok2 || !ok3 || !ok4 { err = fmt.Errorf("Incorrect arguement types.") diff --git a/jsonapi_test.go b/jsonapi_test.go index 0871ded8..91bf28c9 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -154,7 +154,7 @@ var cmdtests = []struct { {"addmultisignaddress", []interface{}{1, "test"}, false}, {"addmultisignaddress", []interface{}{1, 1.0, "test"}, false}, {"addmultisignaddress", []interface{}{1, "test", "test", "test"}, true}, - {"createrawtransaction", []interface{}{"in1", 0, "a1", 1.0}, true}, + {"createrawtransaction", []interface{}{"in1", uint32(0), "a1", 1.0}, true}, {"createrawtransaction", []interface{}{"in1", "out1", "a1", 1.0, "test"}, false}, {"createrawtransaction", []interface{}{}, false}, {"createrawtransaction", []interface{}{"in1", 1.0, "a1", 1.0}, false}, @@ -166,7 +166,7 @@ var cmdtests = []struct { {"lockunspent", []interface{}{true, "something"}, true}, {"lockunspent", []interface{}{true}, false}, {"lockunspent", []interface{}{1.0, "something"}, false}, - {"signrawtransaction", []interface{}{"hexstring", "test", 1, "test"}, true}, + {"signrawtransaction", []interface{}{"hexstring", "test", uint32(1), "test"}, true}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", "test3"}, false}, {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, diff --git a/jsoncmd.go b/jsoncmd.go index 8cc0df22..6dd97b6b 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -752,7 +752,7 @@ func (cmd *CreateMultisigCmd) UnmarshalJSON(b []byte) error { // transactionsha and output number pair. type TransactionInput struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` } // CreateRawTransactionCmd is a type handling custom marshaling and diff --git a/jsonresults.go b/jsonresults.go index 48f62302..a675bbcf 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -158,7 +158,7 @@ type ScriptSig struct { type Vin struct { Coinbase string `json:"coinbase"` Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptSig *ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` } @@ -183,7 +183,7 @@ func (v *Vin) MarshalJSON() ([]byte, error) { txStruct := struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptSig *ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` }{ @@ -199,7 +199,7 @@ func (v *Vin) MarshalJSON() ([]byte, error) { // getrawtransaction and decoderawtransaction use the same structure. type Vout struct { Value float64 `json:"value"` - N int `json:"n"` + N uint32 `json:"n"` ScriptPubKey struct { Asm string `json:"asm"` Hex string `json:"hex"` From 370899e1fc9335624ba9858196caa904fed8a41e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 16 Jun 2014 15:49:01 -0500 Subject: [PATCH 181/229] Change RawTxInput.Vout to uint32 as well. This was missed by the previous commit. --- jsoncmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index 6dd97b6b..59df4328 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -5960,7 +5960,7 @@ func (cmd *SignMessageCmd) UnmarshalJSON(b []byte) error { // RawTxInput models the data needed for a raw tx input. type RawTxInput struct { Txid string `json:"txid"` - Vout int `json:"vout"` + Vout uint32 `json:"vout"` ScriptPubKey string `json:"scriptPubKey"` RedeemScript string `json:"redeemScript"` } From 00874b6ec24ee41f0c7a5774728b06049e7623e8 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Mon, 23 Jun 2014 16:51:21 -0500 Subject: [PATCH 182/229] Unmarshal correct lockunspent outpoints parameter. --- jsoncmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoncmd.go b/jsoncmd.go index 59df4328..5a9a1321 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -4905,7 +4905,7 @@ func (cmd *LockUnspentCmd) UnmarshalJSON(b []byte) error { optArgs := make([][]TransactionInput, 0, 1) if len(r.Params) > 1 { var transactions []TransactionInput - if err := json.Unmarshal(r.Params[0], &transactions); err != nil { + if err := json.Unmarshal(r.Params[1], &transactions); err != nil { return fmt.Errorf("second optional parameter 'transactions' "+ "must be a JSON array of transaction input JSON objects: %v", err) } From dc84f95fe9ed33926a0b21163b62763fb0ed0506 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 27 Jun 2014 00:25:00 -0500 Subject: [PATCH 183/229] Name field WorkID to make golint happy. --- jsoncmd.go | 2 +- jsoncmd_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 5a9a1321..f5dfb4a0 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -6168,7 +6168,7 @@ func (cmd *StopCmd) UnmarshalJSON(b []byte) error { // a SubmitBlockCmd command. type SubmitBlockOptions struct { // must be provided if server provided a workid with template. - WorkId string `json:"workid,omitempty"` + WorkID string `json:"workid,omitempty"` } // SubmitBlockCmd is a type handling custom marshaling and diff --git a/jsoncmd_test.go b/jsoncmd_test.go index ab4f9c12..1d012c61 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1473,12 +1473,12 @@ var jsoncmdtests = []struct { f: func() (Cmd, error) { return NewSubmitBlockCmd(testId, "lotsofhex", - &SubmitBlockOptions{WorkId: "otherstuff"}) + &SubmitBlockOptions{WorkID: "otherstuff"}) }, result: &SubmitBlockCmd{ id: testId, HexBlock: "lotsofhex", - Options: &SubmitBlockOptions{WorkId: "otherstuff"}, + Options: &SubmitBlockOptions{WorkID: "otherstuff"}, }, }, { From 5290cb1186db65e12172231dd6b50afbafe01e6e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 16 Jun 2014 22:07:51 -0500 Subject: [PATCH 184/229] Allow more BIP0022 fields in GetBlockTemplateCmd. BIP0022 defines optional fields in a getblocktemplate request for long polling and template tweaking. In addition, for template tweaking, there are two fields, sigoplimit and sizelimit, which are atypical in that they are allowed to be either booleans or numeric. This requires the fields to be represented as interfaces which means any code making use of the struct will need to use type assertions or a type switch. This commit updates GetBlockTemplateCmd accordingly. ok @jcvernaleo --- jsoncmd.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/jsoncmd.go b/jsoncmd.go index f5dfb4a0..0dc83c2f 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2173,6 +2173,21 @@ func (cmd *GetBlockHashCmd) UnmarshalJSON(b []byte) error { type TemplateRequest struct { Mode string `json:"mode,omitempty"` Capabilities []string `json:"capabilities,omitempty"` + + // Optional long polling. + LongPollID string `json:"longpollid,omitempty"` + + // Optional template tweaking. SigOpLimit and SizeLimit can be int64 + // or bool. + SigOpLimit interface{} `json:"sigoplimit,omitempty"` + SizeLimit interface{} `json:"sizelimit,omitempty"` + MaxVersion uint32 `json:"maxversion,omitempty"` +} + +// isFloatInt64 returns whether the passed float64 is a whole number that safely +// fits into a 64-bit integer. +func isFloatInt64(a float64) bool { + return a == float64(int64(a)) } // GetBlockTemplateCmd is a type handling custom marshaling and @@ -2194,6 +2209,38 @@ func NewGetBlockTemplateCmd(id interface{}, optArgs ...*TemplateRequest) (*GetBl return nil, ErrTooManyOptArgs } request = optArgs[0] + switch val := request.SigOpLimit.(type) { + case nil: + case bool: + case int64: + case float64: + if !isFloatInt64(val) { + return nil, errors.New("the sigoplimit field " + + "must be unspecified, a boolean, or a " + + "64-bit integer") + } + request.SigOpLimit = int64(val) + default: + return nil, errors.New("the sigoplimit field " + + "must be unspecified, a boolean, or a 64-bit " + + "integer") + } + switch val := request.SizeLimit.(type) { + case nil: + case bool: + case int64: + case float64: + if !isFloatInt64(val) { + return nil, errors.New("the sizelimit field " + + "must be unspecified, a boolean, or a " + + "64-bit integer") + } + request.SizeLimit = int64(val) + default: + return nil, errors.New("the sizelimit field " + + "must be unspecified, a boolean, or a 64-bit " + + "integer") + } } return &GetBlockTemplateCmd{ id: id, From b6c474de2a8de7535db5b2ebcf560690f3b6deb3 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 13 Jun 2014 17:28:49 -0500 Subject: [PATCH 185/229] Add support for BIP0022 GetBlockTemplateResult. This commit adds a new result type for the getblocktemplate RPC which provides the fields as defined by BIP0022. The extension fields defined by BIP0023 are not included yet. ok @jcvernaleo --- jsonresults.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/jsonresults.go b/jsonresults.go index a675bbcf..1d0fd08e 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -71,6 +71,46 @@ type GetBlockChainInfoResult struct { ChainWork string `json:"chainwork"` } +// GetBlockTemplateResultTransaction models the transactions field of the +// getblocktemplate command. +type GetBlockTemplateResultTx struct { + Data string `json:"data"` + Hash string `json:"hash"` + Depends []int64 `json:"depends"` + Fee int64 `json:"fee"` + SigOps int64 `json:"sigops"` +} + +// GetBlockTemplateResultAux models the coinbaseaux field of the +// getblocktemplate command. +type GetBlockTemplateResultAux struct { + Flags string `json:"flags"` +} + +// GetBlockTemplateResult models the data returned from the getblocktemplate +// command. +type GetBlockTemplateResult struct { + // Base fields from BIP 0022. CoinbaseAux is optional. One of + // CoinbaseTxn or CoinbaseValue must be specified, but not both. + Bits string `json:"bits"` + CurTime int64 `json:"curtime"` + Height int64 `json:"height"` + PreviousHash string `json:"previousblockhash"` + SigOpLimit int64 `json:"sigoplimit,omitempty"` + SizeLimit int64 `json:"sizelimit,omitempty"` + Transactions []GetBlockTemplateResultTx `json:"transactions"` + Version uint32 `json:"version"` + CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseaux,omitempty"` + CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbasetxn,omitempty"` + CoinbaseValue *int64 `json:"coinbasevalue,omitempty"` + WorkID string `json:"workid,omitempty"` + + // Optional long polling from BIP 0022. + LongPollID string `json:"longpollid,omitempty"` + LongPollURI string `json:"longpolluri,omitempty"` + SubmitOld *bool `json:"submitold,omitempty"` +} + // GetNetworkInfoResult models the data returned from the getnetworkinfo command. type GetNetworkInfoResult struct { Version uint32 `json:"version"` From b5db9fb48569b906a526fa5242cbf8d30e2aa07e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 16 Jun 2014 22:12:08 -0500 Subject: [PATCH 186/229] Add BIP0023 basic pool extension fields. This commit adds the optional basic pool extension fields defined by BIP0023 to the GetBlockTemplateResult GetBlockTemplateCmd types. ok @jcvernaleo --- jsoncmd.go | 3 +++ jsonresults.go | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/jsoncmd.go b/jsoncmd.go index 0dc83c2f..5a199465 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2182,6 +2182,9 @@ type TemplateRequest struct { SigOpLimit interface{} `json:"sigoplimit,omitempty"` SizeLimit interface{} `json:"sizelimit,omitempty"` MaxVersion uint32 `json:"maxversion,omitempty"` + + // Basic pool extension from BIP 0023. + Target string `json:"target,omitempty"` } // isFloatInt64 returns whether the passed float64 is a whole number that safely diff --git a/jsonresults.go b/jsonresults.go index 1d0fd08e..b230c89c 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -109,6 +109,15 @@ type GetBlockTemplateResult struct { LongPollID string `json:"longpollid,omitempty"` LongPollURI string `json:"longpolluri,omitempty"` SubmitOld *bool `json:"submitold,omitempty"` + + // Basic pool extension from BIP 0023. + Target string `json:"target,omitempty"` + Expires int64 `json:"expires,omitempty"` + + // Mutations from BIP 0023. + MinTime int64 `json:"mintime,omitempty"` + Mutable []string `json:"mutable,omitempty"` + NonceRange string `json:"noncerange,omitempty"` } // GetNetworkInfoResult models the data returned from the getnetworkinfo command. From ed76ff2172b7525689275a3db256e82889931323 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 24 Jun 2014 10:34:03 -0500 Subject: [PATCH 187/229] Add BIP0023 block proposal fields. This commit adds the optional block proposal fields defined by BIP0023 to the GetBlockTemplateResult and TemplateRequest types. ok @jcvernaleo --- jsoncmd.go | 5 +++++ jsonresults.go | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/jsoncmd.go b/jsoncmd.go index 5a199465..158a157c 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -2185,6 +2185,11 @@ type TemplateRequest struct { // Basic pool extension from BIP 0023. Target string `json:"target,omitempty"` + + // Block proposal from BIP 0023. Data is only provided when Mode is + // "proposal". + Data string `json:"data,omitempty"` + WorkID string `json:"workid,omitempty"` } // isFloatInt64 returns whether the passed float64 is a whole number that safely diff --git a/jsonresults.go b/jsonresults.go index b230c89c..98f07879 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -118,6 +118,10 @@ type GetBlockTemplateResult struct { MinTime int64 `json:"mintime,omitempty"` Mutable []string `json:"mutable,omitempty"` NonceRange string `json:"noncerange,omitempty"` + + // Block proposal from BIP 0023. + Capabilities []string `json:"capabilities,omitempty"` + RejectReasion string `json:"reject-reason,omitempty"` } // GetNetworkInfoResult models the data returned from the getnetworkinfo command. From e2e688e3d62a917d361762d22a47b6ee63f29741 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 29 Jun 2014 14:41:25 -0500 Subject: [PATCH 188/229] Make a compatibility pass. This commit modifies some of the types of the values to better match the reference client JSON-RPC API. --- jsonresults.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 98f07879..9e774c8d 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -17,9 +17,9 @@ import ( type BlockResult struct { Hash string `json:"hash"` Confirmations uint64 `json:"confirmations"` - Size int `json:"size"` + Size int32 `json:"size"` Height int64 `json:"height"` - Version uint32 `json:"version"` + Version int32 `json:"version"` MerkleRoot string `json:"merkleroot"` Tx []string `json:"tx,omitempty"` RawTx []TxRawResult `json:"rawtx,omitempty"` @@ -40,7 +40,7 @@ type CreateMultiSigResult struct { // DecodeScriptResult models the data returned from the decodescript command. type DecodeScriptResult struct { Asm string `json:"asm"` - ReqSigs int `json:"reqSigs,omitempty"` + ReqSigs int32 `json:"reqSigs,omitempty"` Type string `json:"type"` Addresses []string `json:"addresses,omitempty"` P2sh string `json:"p2sh"` @@ -99,7 +99,7 @@ type GetBlockTemplateResult struct { SigOpLimit int64 `json:"sigoplimit,omitempty"` SizeLimit int64 `json:"sizelimit,omitempty"` Transactions []GetBlockTemplateResultTx `json:"transactions"` - Version uint32 `json:"version"` + Version int32 `json:"version"` CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseaux,omitempty"` CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbasetxn,omitempty"` CoinbaseValue *int64 `json:"coinbasevalue,omitempty"` @@ -126,10 +126,10 @@ type GetBlockTemplateResult struct { // GetNetworkInfoResult models the data returned from the getnetworkinfo command. type GetNetworkInfoResult struct { - Version uint32 `json:"version"` - ProtocolVersion uint32 `json:"protocolversion"` + Version int32 `json:"version"` + ProtocolVersion int32 `json:"protocolversion"` TimeOffset int64 `json:"timeoffset"` - Connections int `json:"connections"` + Connections int32 `json:"connections"` Proxy string `json:"proxy,omitempty"` RelayFee float64 `json:"relayfee"` LocalAddresses []LocalAddressesResult `json:"localaddresses"` @@ -151,13 +151,13 @@ type GetPeerInfoResult struct { SubVer string `json:"subver"` Inbound bool `json:"inbound"` StartingHeight int32 `json:"startingheight"` - BanScore int `json:"banscore,omitempty"` + BanScore int32 `json:"banscore,omitempty"` SyncNode bool `json:"syncnode"` } // GetRawMempoolResult models the data returned from the getrawmempool command. type GetRawMempoolResult struct { - Size int `json:"size"` + Size int32 `json:"size"` Fee float64 `json:"fee"` Time int64 `json:"time"` Height int64 `json:"height"` @@ -256,7 +256,7 @@ type Vout struct { ScriptPubKey struct { Asm string `json:"asm"` Hex string `json:"hex"` - ReqSigs int `json:"reqSigs,omitempty"` + ReqSigs int32 `json:"reqSigs,omitempty"` Type string `json:"type"` Addresses []string `json:"addresses,omitempty"` } `json:"scriptPubKey"` @@ -270,7 +270,7 @@ type GetMiningInfoResult struct { Difficulty float64 `json:"difficulty"` Errors string `json:"errors"` Generate bool `json:"generate"` - GenProcLimit int `json:"genproclimit"` + GenProcLimit int32 `json:"genproclimit"` HashesPerSec int64 `json:"hashespersec"` NetworkHashPS int64 `json:"networkhashps"` PooledTx uint64 `json:"pooledtx"` @@ -287,18 +287,18 @@ type GetWorkResult struct { // InfoResult contains the data returned by the getinfo command. type InfoResult struct { - Version int `json:"version"` - ProtocolVersion int `json:"protocolversion"` - WalletVersion int `json:"walletversion,omitempty"` + Version int32 `json:"version"` + ProtocolVersion int32 `json:"protocolversion"` + WalletVersion int32 `json:"walletversion,omitempty"` Balance float64 `json:"balance,omitempty"` - Blocks int `json:"blocks"` + Blocks int32 `json:"blocks"` TimeOffset int64 `json:"timeoffset"` - Connections int `json:"connections"` + Connections int32 `json:"connections"` Proxy string `json:"proxy"` Difficulty float64 `json:"difficulty"` TestNet bool `json:"testnet"` KeypoolOldest int64 `json:"keypoololdest,omitempty"` - KeypoolSize int `json:"keypoolsize,omitempty"` + KeypoolSize int32 `json:"keypoolsize,omitempty"` UnlockedUntil int64 `json:"unlocked_until,omitempty"` PaytxFee float64 `json:"paytxfee,omitempty"` RelayFee float64 `json:"relayfee"` @@ -329,7 +329,7 @@ type ListTransactionsResult struct { type LocalAddressesResult struct { Address string `json:"address"` Port uint16 `json:"port"` - Score int `json:"score"` + Score int32 `json:"score"` } // ListReceivedByAccountResult models the data from the listreceivedbyaccount @@ -378,7 +378,7 @@ type SignRawTransactionResult struct { type TxRawResult struct { Hex string `json:"hex"` Txid string `json:"txid"` - Version uint32 `json:"version"` + Version int32 `json:"version"` LockTime uint32 `json:"locktime"` Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` @@ -391,7 +391,7 @@ type TxRawResult struct { // TxRawDecodeResult models the data from the decoderawtransaction command. type TxRawDecodeResult struct { Txid string `json:"txid"` - Version uint32 `json:"version"` + Version int32 `json:"version"` Locktime uint32 `json:"locktime"` Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` @@ -409,7 +409,7 @@ type ValidateAddressResult struct { Addresses []string `json:"addresses,omitempty"` Hex string `json:"hex,omitempty"` Script string `json:"script,omitempty"` - SigsRequired int `json:"sigsrequired,omitempty"` + SigsRequired int32 `json:"sigsrequired,omitempty"` } // ReadResultCmd unmarshalls the json reply with data struct for specific From 2d32ed6ba741bd24eaf0da91d9d19271f5b30ea3 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 30 Jun 2014 10:37:34 -0500 Subject: [PATCH 189/229] Add MaxTime field support from BIP0023 mutations. --- jsonresults.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonresults.go b/jsonresults.go index 9e774c8d..5c13467b 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -115,6 +115,7 @@ type GetBlockTemplateResult struct { Expires int64 `json:"expires,omitempty"` // Mutations from BIP 0023. + MaxTime int64 `json:"maxtime,omitempty"` MinTime int64 `json:"mintime,omitempty"` Mutable []string `json:"mutable,omitempty"` NonceRange string `json:"noncerange,omitempty"` From 6aa6bec7fc1fb46f086af45f02384b6d50e4e69b Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 2 Jul 2014 19:41:28 -0500 Subject: [PATCH 190/229] goimports -w . --- jsonapi_test.go | 3 ++- jsoncmd_test.go | 3 ++- jsonfxns_test.go | 3 ++- jsonresults_test.go | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jsonapi_test.go b/jsonapi_test.go index 91bf28c9..4c1459f3 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -7,10 +7,11 @@ package btcjson_test import ( "bytes" "fmt" - "github.com/conformal/btcjson" "io" "io/ioutil" "testing" + + "github.com/conformal/btcjson" ) // cmdtests is a table of all the possible commands and a list of inputs, diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 1d012c61..67dc1d12 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -7,10 +7,11 @@ package btcjson import ( "encoding/json" - "github.com/davecgh/go-spew/spew" "reflect" "strings" "testing" + + "github.com/davecgh/go-spew/spew" ) var testId = float64(1) diff --git a/jsonfxns_test.go b/jsonfxns_test.go index 2fa2f7c1..31bb93aa 100644 --- a/jsonfxns_test.go +++ b/jsonfxns_test.go @@ -7,8 +7,9 @@ package btcjson_test import ( "bytes" "fmt" - "github.com/conformal/btcjson" "testing" + + "github.com/conformal/btcjson" ) // TestMarshallAndSend tests the MarshallAndSend function to make sure it can diff --git a/jsonresults_test.go b/jsonresults_test.go index 469dca67..fc25138f 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -7,8 +7,9 @@ package btcjson_test import ( "bytes" "encoding/json" - "github.com/conformal/btcjson" "testing" + + "github.com/conformal/btcjson" ) var resulttests = []struct { From 2e0a2433834736123ff440c3ca73ebdf3331f052 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 3 Jul 2014 23:12:13 -0400 Subject: [PATCH 191/229] Support gettxout --- jsoncmd.go | 4 +- jsoncmd_test.go | 7 +- jsonresults.go | 41 +++-- jsonresults_test.go | 1 + test_coverage.txt | 385 ++++++++++++++++++++++---------------------- 5 files changed, 232 insertions(+), 206 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 158a157c..2eae4841 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -3530,7 +3530,7 @@ var _ Cmd = &GetTxOutCmd{} // NewGetTxOutCmd creates a new GetTxOutCmd. func NewGetTxOutCmd(id interface{}, txid string, output int, optArgs ...bool) (*GetTxOutCmd, error) { - var mempool bool + mempool := true if len(optArgs) > 0 { if len(optArgs) > 1 { return nil, ErrTooManyOptArgs @@ -3560,7 +3560,7 @@ func (cmd *GetTxOutCmd) MarshalJSON() ([]byte, error) { params := make([]interface{}, 2, 3) params[0] = cmd.Txid params[1] = cmd.Output - if cmd.IncludeMempool != false { + if !cmd.IncludeMempool { params = append(params, cmd.IncludeMempool) } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 67dc1d12..30910adb 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -743,9 +743,10 @@ var jsoncmdtests = []struct { 10) }, result: &GetTxOutCmd{ - id: testId, - Txid: "sometx", - Output: 10, + id: testId, + Txid: "sometx", + Output: 10, + IncludeMempool: true, }, }, { diff --git a/jsonresults.go b/jsonresults.go index 5c13467b..f39f6e3a 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -192,6 +192,16 @@ type GetTransactionResult struct { Hex string `json:"hex"` } +// GetTxOutResult models the data from the gettxout command. +type GetTxOutResult struct { + BestBlock string `json:"bestblock"` + Confirmations int64 `json:"confirmations"` + Value float64 `json:"value"` + ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"` + Version int32 `json:"version"` + Coinbase bool `json:"coinbase"` +} + // GetNetTotalsResult models the data returned from the getnettotals command. type GetNetTotalsResult struct { TotalBytesRecv uint64 `json:"totalbytesrecv"` @@ -249,18 +259,22 @@ func (v *Vin) MarshalJSON() ([]byte, error) { return json.Marshal(txStruct) } +// ScriptPubKeyResult models the scriptPubKey data of a tx script. It is +// defined separately since it is used by multiple commands. +type ScriptPubKeyResult struct { + Asm string `json:"asm"` + Hex string `json:"hex,omitempty"` + ReqSigs int32 `json:"reqSigs,omitempty"` + Type string `json:"type"` + Addresses []string `json:"addresses,omitempty"` +} + // Vout models parts of the tx data. It is defined seperately since both // getrawtransaction and decoderawtransaction use the same structure. type Vout struct { - Value float64 `json:"value"` - N uint32 `json:"n"` - ScriptPubKey struct { - Asm string `json:"asm"` - Hex string `json:"hex"` - ReqSigs int32 `json:"reqSigs,omitempty"` - Type string `json:"type"` - Addresses []string `json:"addresses,omitempty"` - } `json:"scriptPubKey"` + Value float64 `json:"value"` + N uint32 `json:"n"` + ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"` } // GetMiningInfoResult models the data from the getmininginfo command. @@ -590,6 +604,15 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + case "gettxout": + var res *GetTxOutResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + if res.ScriptPubKey.Addresses == nil { + res.ScriptPubKey.Addresses = []string{} + } + result.Result = true + } case "getwork": // getwork can either return a JSON object or a boolean // depending on whether or not data was provided. Choose the diff --git a/jsonresults_test.go b/jsonresults_test.go index fc25138f..2197093d 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -50,6 +50,7 @@ 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}, + {"gettxout", []byte(`{"error":null,"id":1,"result":{"bestblock":"a","value":1.0}}`), false, true}, {"listreceivedbyaddress", []byte(`{"error":null,"id":1,"result":[{"a"}]}`), false, false}, {"listreceivedbyaddress", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, true}, {"listsinceblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, diff --git a/test_coverage.txt b/test_coverage.txt index e756d276..9fa27538 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,8 @@ github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) @@ -16,146 +17,156 @@ github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) @@ -163,251 +174,241 @@ github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.30% (83/94) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 77.78% (7/9) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/jsonresults.go ReadResultCmd 62.13% (105/169) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) -github.com/conformal/btcjson/jsonresults.go ReadResultCmd 60.74% (99/163) -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/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) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 44.83% (13/29) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 43.75% (7/16) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) -github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) +github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go isFloatInt64 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 77.86% (2353/3022) +github.com/conformal/btcjson --------------------------------------- 77.82% (2365/3039) From 8005d2e455d3fabf0e2bf512f30a282556b42718 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Mon, 7 Jul 2014 22:39:22 -0500 Subject: [PATCH 192/229] Update TODO list in README. This package has supported https for quite some time. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index daccfd15..e0794bed 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,7 @@ $ go get github.com/conformal/btcjson ## TODO -- Add data structures for remaining commands. - Increase test coverage to 100%. -- Add https support. ## GPG Verification Key From 033b00dd1cc886c2d7f2257b7b1ae4107693ca29 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 6 Jul 2014 11:51:13 -0700 Subject: [PATCH 193/229] Properly set reply.Result to output of unmarshalled GetTxOutResult JSON. Fix panic caused by nil pointer dereference. Create new error type for invalid tx vout (gettxout). --- jsonerr.go | 4 ++++ jsonresults.go | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jsonerr.go b/jsonerr.go index 3ebd7f8b..87c07f1e 100644 --- a/jsonerr.go +++ b/jsonerr.go @@ -148,6 +148,10 @@ var ( Code: -5, Message: "No information about newest block", } + ErrInvalidTxVout = Error{ + Code: -5, + Message: "Ouput index number (vout) does not exist for transaction.", + } ErrRawTxString = Error{ Code: -32602, Message: "Raw tx is not a string", diff --git a/jsonresults.go b/jsonresults.go index f39f6e3a..e5f41046 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -607,11 +607,11 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { case "gettxout": var res *GetTxOutResult err = json.Unmarshal(objmap["result"], &res) - if err == nil { + if res != nil && err == nil { if res.ScriptPubKey.Addresses == nil { res.ScriptPubKey.Addresses = []string{} } - result.Result = true + result.Result = res } case "getwork": // getwork can either return a JSON object or a boolean From 6aea36c5500cf97ee6fce432ea535e7e3065d0b5 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 15 Jul 2014 10:09:35 -0400 Subject: [PATCH 194/229] Various changes to make golint happier. --- cmdhelp.go | 2 +- jsonapi.go | 130 ++++++------- jsonapi_test.go | 4 +- jsoncmd.go | 12 +- jsoncmd_test.go | 488 ++++++++++++++++++++++++------------------------ jsonfxns.go | 2 +- jsonresults.go | 12 +- 7 files changed, 325 insertions(+), 325 deletions(-) diff --git a/cmdhelp.go b/cmdhelp.go index d65adc92..3b745e77 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -770,5 +770,5 @@ func GetHelpString(cmdName string) (string, error) { if c, ok := customCmds[cmdName]; ok { return c.helpString, nil } - return helpstr, errors.New("Invalid command specified") + return helpstr, errors.New("invalid command specified") } diff --git a/jsonapi.go b/jsonapi.go index ba678d23..47fb11af 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -94,20 +94,20 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ "stop", "walletlock", "getbestblockhash", "getblockchaininfo", "getnetworkinfo": if len(args) > 0 { - err = fmt.Errorf("Too many arguments for %s", message) + err = fmt.Errorf("too many arguments for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One optional int case "listaccounts": if len(args) > 1 { - err = fmt.Errorf("Too many arguments for %s", message) + err = fmt.Errorf("too many arguments for %s", message) return finalMessage, err } if len(args) == 1 { _, ok := args[0].(int) if !ok { - err = fmt.Errorf("Argument must be int for %s", message) + err = fmt.Errorf("argument must be int for %s", message) return finalMessage, err } } @@ -115,24 +115,24 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // One required int case "getblockhash", "estimatefee", "estimatepriority": if len(args) != 1 { - err = fmt.Errorf("Missing argument for %s", message) + err = fmt.Errorf("missing argument for %s", message) return finalMessage, err } _, ok := args[0].(int) if !ok { - err = fmt.Errorf("Argument must be int for %s", message) + err = fmt.Errorf("argument must be int for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required float case "settxfee": if len(args) != 1 { - err = fmt.Errorf("Missing argument for %s", message) + err = fmt.Errorf("missing argument for %s", message) return finalMessage, err } _, ok := args[0].(float64) if !ok { - err = fmt.Errorf("Argument must be float64 for %s", message) + err = fmt.Errorf("argument must be float64 for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) @@ -140,13 +140,13 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ case "getmemorypool", "getnewaddress", "getwork", "help", "getrawchangeaddress": if len(args) > 1 { - err = fmt.Errorf("Too many arguments for %s", message) + err = fmt.Errorf("too many arguments for %s", message) return finalMessage, err } if len(args) == 1 { _, ok := args[0].(string) if !ok { - err = fmt.Errorf("Optional argument must be string for %s", message) + err = fmt.Errorf("optional argument must be string for %s", message) return finalMessage, err } } @@ -162,54 +162,54 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } _, ok := args[0].(string) if !ok { - err = fmt.Errorf("Argument must be string for %s", message) + err = fmt.Errorf("argument must be string for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // Two required strings case "setaccount", "signmessage", "walletpassphrasechange", "addnode": if len(args) != 2 { - err = fmt.Errorf("Missing arguments for %s", message) + err = fmt.Errorf("missing arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) _, ok2 := args[1].(string) if !ok1 || !ok2 { - err = fmt.Errorf("Arguments must be string for %s", message) + err = fmt.Errorf("arguments must be string for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required string, one required int case "walletpassphrase": if len(args) != 2 { - err = fmt.Errorf("Missing arguments for %s", message) + err = fmt.Errorf("missing arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) _, ok2 := args[1].(int) if !ok1 || !ok2 { - err = fmt.Errorf("Arguments must be string and int for %s", message) + err = fmt.Errorf("arguments must be string and int for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // Three required strings case "verifymessage": if len(args) != 3 { - err = fmt.Errorf("Three arguments required for %s", message) + err = fmt.Errorf("three arguments required for %s", message) return finalMessage, err } _, ok1 := args[0].(string) _, ok2 := args[1].(string) _, ok3 := args[2].(string) if !ok1 || !ok2 || !ok3 { - err = fmt.Errorf("Arguments must be string for %s", message) + err = fmt.Errorf("arguments must be string for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required bool, one optional string case "getaddednodeinfo": if len(args) > 2 || len(args) == 0 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(bool) @@ -218,14 +218,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(string) } if !ok1 || !ok2 { - err = fmt.Errorf("Arguments must be bool and optionally string for %s", message) + err = fmt.Errorf("arguments must be bool and optionally string for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required bool, one optional int case "setgenerate": if len(args) > 2 || len(args) == 0 { - err = fmt.Errorf("Wrong number of argument for %s", message) + err = fmt.Errorf("wrong number of argument for %s", message) return finalMessage, err } _, ok1 := args[0].(bool) @@ -234,14 +234,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(int) } if !ok1 || !ok2 { - err = fmt.Errorf("Arguments must be bool and optionally int for %s", message) + err = fmt.Errorf("arguments must be bool and optionally int for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One optional string, one optional int case "getbalance", "getreceivedbyaccount": if len(args) > 2 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } ok1 := true @@ -253,14 +253,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(int) } if !ok1 || !ok2 { - err = fmt.Errorf("Optional arguments must be string and int for %s", message) + err = fmt.Errorf("optional arguments must be string and int for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required string, one optional int case "getrawtransaction", "getreceivedbyaddress": if len(args) > 2 || len(args) == 0 { - err = fmt.Errorf("Wrong number of argument for %s", message) + err = fmt.Errorf("wrong number of argument for %s", message) return finalMessage, err } _, ok1 := args[0].(string) @@ -269,7 +269,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(int) } if !ok1 || !ok2 { - err = fmt.Errorf("Arguments must be string and optionally int for %s", message) + err = fmt.Errorf("arguments must be string and optionally int for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) @@ -279,7 +279,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // support for it is complete. case "submitblock": if len(args) > 2 || len(args) == 0 { - err = fmt.Errorf("Wrong number of argument for %s", message) + err = fmt.Errorf("wrong number of argument for %s", message) return finalMessage, err } _, ok1 := args[0].(string) @@ -288,14 +288,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(string) } if !ok1 || !ok2 { - err = fmt.Errorf("Arguments must be string and optionally string for %s", message) + err = fmt.Errorf("arguments must be string and optionally string for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One optional int, one optional bool case "listreceivedbyaccount", "listreceivedbyaddress": if len(args) > 2 { - err = fmt.Errorf("Wrong number of argument for %s", message) + err = fmt.Errorf("wrong number of argument for %s", message) return finalMessage, err } ok1 := true @@ -307,14 +307,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(bool) } if !ok1 || !ok2 { - err = fmt.Errorf("Optional arguments must be int and bool for %s", message) + err = fmt.Errorf("optional arguments must be int and bool for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One optional string, two optional ints case "listtransactions": if len(args) > 3 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } ok1 := true @@ -330,14 +330,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok3 = args[2].(int) } if !ok1 || !ok2 || !ok3 { - err = fmt.Errorf("Optional arguments must be string and up to two ints for %s", message) + err = fmt.Errorf("optional arguments must be string and up to two ints for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required string, one optional string, one optional bool case "importprivkey": if len(args) > 3 || len(args) == 0 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) @@ -350,14 +350,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok3 = args[2].(bool) } if !ok1 || !ok2 || !ok3 { - err = fmt.Errorf("Arguments must be string and optionally string and bool for %s", message) + err = fmt.Errorf("arguments must be string and optionally string and bool for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // Two optional ints case "listunspent": if len(args) > 2 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } ok1 := true @@ -369,14 +369,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(int) } if !ok1 || !ok2 { - err = fmt.Errorf("Optional arguments must be ints for %s", message) + err = fmt.Errorf("optional arguments must be ints for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // Two optional strings case "listsinceblock": if len(args) > 2 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } ok1 := true @@ -388,7 +388,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok2 = args[1].(string) } if !ok1 || !ok2 { - err = fmt.Errorf("Optional arguments must be strings for %s", message) + err = fmt.Errorf("optional arguments must be strings for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) @@ -397,7 +397,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // two optional strings. case "sendfrom": if len(args) > 6 || len(args) < 3 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) @@ -416,7 +416,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok6 = args[5].(string) } if !ok1 || !ok2 || !ok3 || !ok4 || !ok5 || !ok6 { - err = fmt.Errorf("Arguments must be string, string, float64 and optionally int and two strings for %s", message) + err = fmt.Errorf("arguments must be string, string, float64 and optionally int and two strings for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) @@ -424,7 +424,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // one optional string. case "move": if len(args) > 5 || len(args) < 3 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) @@ -439,14 +439,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok5 = args[4].(string) } if !ok1 || !ok2 || !ok3 || !ok4 || !ok5 { - err = fmt.Errorf("Arguments must be string, string, float64 and optionally int and string for %s", message) + err = fmt.Errorf("arguments must be string, string, float64 and optionally int and string for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // One required strings, one required float, two optional strings case "sendtoaddress": if len(args) > 4 || len(args) < 2 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) @@ -460,14 +460,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok4 = args[3].(string) } if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("Arguments must be string, float64 and optionally two strings for %s", message) + err = fmt.Errorf("arguments must be string, float64 and optionally two strings for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // required int, required pair of keys (string), optional string case "addmultisignaddress": if len(args) > 4 || len(args) < 3 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(int) @@ -478,14 +478,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ _, ok4 = args[2].(string) } if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("Arguments must be int, two string and optionally one for %s", message) + err = fmt.Errorf("arguments must be int, two string and optionally one for %s", message) return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) // Must be a set of string, int, string, float (any number of those). case "createrawtransaction": if len(args)%4 != 0 || len(args) == 0 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } type vlist struct { @@ -494,13 +494,13 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } vList := make([]vlist, len(args)/4) addresses := make(map[string]float64) - for i := 0; i < len(args)/4; i += 1 { + for i := 0; i < len(args)/4; i++ { txid, ok1 := args[(i*4)+0].(string) vout, ok2 := args[(i*4)+1].(uint32) add, ok3 := args[(i*4)+2].(string) amt, ok4 := args[(i*4)+3].(float64) if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("Incorrect arguement types.") + err = fmt.Errorf("incorrect arguement types") return finalMessage, err } vList[i].Txid = txid @@ -511,14 +511,14 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // string, string/float pairs, optional int, and string case "sendmany": if len(args) < 3 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } var minconf int var comment string _, ok1 := args[0].(string) if !ok1 { - err = fmt.Errorf("Incorrect arguement types.") + err = fmt.Errorf("incorrect arguement types") return finalMessage, err } addresses := make(map[string]float64) @@ -528,7 +528,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ if len(args) > i+1 { amt, ok2 := args[i+1].(float64) if !ok2 { - err = fmt.Errorf("Incorrect arguement types.") + err = fmt.Errorf("incorrect arguement types") return finalMessage, err } // Put a single pair into addresses @@ -551,12 +551,12 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // bool and an array of stuff case "lockunspent": if len(args) < 2 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(bool) if !ok1 { - err = fmt.Errorf("Incorrect arguement types.") + err = fmt.Errorf("incorrect arguement types") return finalMessage, err } finalMessage, err = jsonWithArgs(message, id, args) @@ -564,12 +564,12 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // and one string along with another optional string. case "signrawtransaction": if len(args) < 1 { - err = fmt.Errorf("Wrong number of arguments for %s", message) + err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err } _, ok1 := args[0].(string) if !ok1 { - err = fmt.Errorf("Incorrect arguement types.") + err = fmt.Errorf("incorrect arguement types") return finalMessage, err } type txlist struct { @@ -584,7 +584,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ vout, ok3 := args[2].(uint32) spkey, ok4 := args[3].(string) if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("Incorrect arguement types.") + err = fmt.Errorf("incorrect arguement types") return finalMessage, err } txList[0].Txid = txid @@ -612,7 +612,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), txList}) // Any other message default: - err = fmt.Errorf("Not a valid command: %s", message) + err = fmt.Errorf("not a valid command: %s", message) } return finalMessage, err } @@ -626,7 +626,7 @@ func JSONGetMethod(message []byte) (string, error) { var msg interface{} err := json.Unmarshal(message, &msg) if err != nil { - err := fmt.Errorf("Error, message does not appear to be valid json: %v", err) + err := fmt.Errorf("error, message does not appear to be valid json: %v", err) return method, err } m := msg.(map[string]interface{}) @@ -636,7 +636,7 @@ func JSONGetMethod(message []byte) (string, error) { } } if method == "" { - err := fmt.Errorf("Error, no method specified.") + err := fmt.Errorf("error, no method specified") return method, err } return method, err @@ -669,12 +669,12 @@ func rpcCommand(user string, password string, server string, message []byte, body, err := rpcRawCommand(user, password, server, message, https, certificates, skipverify) if err != nil { - err := fmt.Errorf("Error getting json reply: %v", err) + err := fmt.Errorf("error getting json reply: %v", err) return result, err } result, err = ReadResultCmd(method, body) if err != nil { - err := fmt.Errorf("Error reading json message: %v", err) + err := fmt.Errorf("error reading json message: %v", err) return result, err } return result, err @@ -704,18 +704,18 @@ func rpcRawCommand(user string, password string, server string, var msg interface{} err := json.Unmarshal(message, &msg) if err != nil { - err := fmt.Errorf("Error, message does not appear to be valid json: %v", err) + err := fmt.Errorf("error, message does not appear to be valid json: %v", err) return result, err } resp, err := jsonRpcSend(user, password, server, message, https, certificates, skipverify) if err != nil { - err := fmt.Errorf("Error sending json message: " + err.Error()) + err := fmt.Errorf("error sending json message: " + err.Error()) return result, err } result, err = GetRaw(resp.Body) if err != nil { - err := fmt.Errorf("Error getting json reply: %v", err) + err := fmt.Errorf("error getting json reply: %v", err) return result, err } return result, err @@ -779,11 +779,11 @@ func JSONToAmount(jsonAmount float64) (int64, error) { var amount int64 var err error if jsonAmount > 1.797693134862315708145274237317043567981e+300 { - err := fmt.Errorf("Error %v is too large to convert", jsonAmount) + err := fmt.Errorf("error %v is too large to convert", jsonAmount) return amount, err } if jsonAmount < -1.797693134862315708145274237317043567981e+300 { - err := fmt.Errorf("Error %v is too small to convert", jsonAmount) + err := fmt.Errorf("error %v is too small to convert", jsonAmount) return amount, err } tempVal := 1e8 * jsonAmount diff --git a/jsonapi_test.go b/jsonapi_test.go index 4c1459f3..19aff307 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -279,7 +279,7 @@ func TestRpcReply(t *testing.T) { } var idtests = []struct { - testId []interface{} + testID []interface{} pass bool }{ {[]interface{}{"string test"}, true}, @@ -293,7 +293,7 @@ var idtests = []struct { // types). func TestIsValidIdType(t *testing.T) { for _, tt := range idtests { - res := btcjson.IsValidIdType(tt.testId[0]) + res := btcjson.IsValidIdType(tt.testID[0]) if res != tt.pass { t.Errorf("Incorrect type result %v.", tt) } diff --git a/jsoncmd.go b/jsoncmd.go index 2eae4841..2b9bae58 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -533,7 +533,7 @@ func NewAddNodeCmd(id interface{}, addr string, subcmd string) ( case "onetry": // fine default: - return nil, errors.New("Invalid subcommand for addnode") + return nil, errors.New("invalid subcommand for addnode") } return &AddNodeCmd{ @@ -1714,7 +1714,7 @@ var _ Cmd = &GetBalanceCmd{} // and an int for minconf may be provided as arguments. func NewGetBalanceCmd(id interface{}, optArgs ...interface{}) (*GetBalanceCmd, error) { var account string - var minconf int = 1 + var minconf = 1 if len(optArgs) > 2 { return nil, ErrWrongNumberOfParams @@ -1991,7 +1991,7 @@ type GetBlockChainInfoCmd struct { // Enforce that GetBlockChainInfoCmd satisifies the Cmd interface. var _ Cmd = &GetBlockChainInfoCmd{} -// NewBlockChainInfoCmd creates a new GetBlockChainInfoCmd. +// NewGetBlockChainInfoCmd creates a new GetBlockChainInfoCmd. func NewGetBlockChainInfoCmd(id interface{}) (*GetBlockChainInfoCmd, error) { return &GetBlockChainInfoCmd{ id: id, @@ -2669,7 +2669,7 @@ type GetNetworkInfoCmd struct { // Enforce that GetNetworkInfoCmd satisifies the Cmd interface. var _ Cmd = &GetNetworkInfoCmd{} -// NewNetworkInfoCmd creates a new GetNetworkInfoCmd. +// NewGetNetworkInfoCmd creates a new GetNetworkInfoCmd. func NewGetNetworkInfoCmd(id interface{}) (*GetNetworkInfoCmd, error) { return &GetNetworkInfoCmd{ id: id, @@ -3285,7 +3285,7 @@ func NewGetReceivedByAccountCmd(id interface{}, account string, optArgs ...int) if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - var minconf int = 1 + var minconf = 1 if len(optArgs) > 0 { minconf = optArgs[0] } @@ -3374,7 +3374,7 @@ func NewGetReceivedByAddressCmd(id interface{}, address string, optArgs ...int) if len(optArgs) > 1 { return nil, ErrTooManyOptArgs } - var minconf int = 1 + var minconf = 1 if len(optArgs) > 0 { minconf = optArgs[0] } diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 30910adb..b5db010e 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -14,7 +14,7 @@ import ( "github.com/davecgh/go-spew/spew" ) -var testId = float64(1) +var testID = float64(1) var jsoncmdtests = []struct { name string @@ -26,11 +26,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "addmultisigaddress", f: func() (Cmd, error) { - return NewAddMultisigAddressCmd(testId, 1, + return NewAddMultisigAddressCmd(testID, 1, []string{"foo", "bar"}) }, result: &AddMultisigAddressCmd{ - id: testId, + id: testID, NRequired: 1, Keys: []string{"foo", "bar"}, Account: "", @@ -40,11 +40,11 @@ var jsoncmdtests = []struct { name: "+ optional", cmd: "addmultisigaddress", f: func() (Cmd, error) { - return NewAddMultisigAddressCmd(testId, 1, + return NewAddMultisigAddressCmd(testID, 1, []string{"foo", "bar"}, "address") }, result: &AddMultisigAddressCmd{ - id: testId, + id: testID, NRequired: 1, Keys: []string{"foo", "bar"}, Account: "address", @@ -55,11 +55,11 @@ var jsoncmdtests = []struct { name: "basic add", cmd: "addnode", f: func() (Cmd, error) { - return NewAddNodeCmd(testId, "address", + return NewAddNodeCmd(testID, "address", "add") }, result: &AddNodeCmd{ - id: testId, + id: testID, Addr: "address", SubCmd: "add", }, @@ -68,11 +68,11 @@ var jsoncmdtests = []struct { name: "basic remove", cmd: "addnode", f: func() (Cmd, error) { - return NewAddNodeCmd(testId, "address", + return NewAddNodeCmd(testID, "address", "remove") }, result: &AddNodeCmd{ - id: testId, + id: testID, Addr: "address", SubCmd: "remove", }, @@ -81,11 +81,11 @@ var jsoncmdtests = []struct { name: "basic onetry", cmd: "addnode", f: func() (Cmd, error) { - return NewAddNodeCmd(testId, "address", + return NewAddNodeCmd(testID, "address", "onetry") }, result: &AddNodeCmd{ - id: testId, + id: testID, Addr: "address", SubCmd: "onetry", }, @@ -95,10 +95,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "backupwallet", f: func() (Cmd, error) { - return NewBackupWalletCmd(testId, "destination") + return NewBackupWalletCmd(testID, "destination") }, result: &BackupWalletCmd{ - id: testId, + id: testID, Destination: "destination", }, }, @@ -106,11 +106,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "createmultisig", f: func() (Cmd, error) { - return NewCreateMultisigCmd(testId, 1, + return NewCreateMultisigCmd(testID, 1, []string{"key1", "key2", "key3"}) }, result: &CreateMultisigCmd{ - id: testId, + id: testID, NRequired: 1, Keys: []string{"key1", "key2", "key3"}, }, @@ -119,14 +119,14 @@ var jsoncmdtests = []struct { name: "basic", cmd: "createrawtransaction", f: func() (Cmd, error) { - return NewCreateRawTransactionCmd(testId, + return NewCreateRawTransactionCmd(testID, []TransactionInput{ {Txid: "tx1", Vout: 1}, {Txid: "tx2", Vout: 3}}, map[string]int64{"bob": 1, "bill": 2}) }, result: &CreateRawTransactionCmd{ - id: testId, + id: testID, Inputs: []TransactionInput{ {Txid: "tx1", Vout: 1}, {Txid: "tx2", Vout: 3}, @@ -141,10 +141,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "debuglevel", f: func() (Cmd, error) { - return NewDebugLevelCmd(testId, "debug") + return NewDebugLevelCmd(testID, "debug") }, result: &DebugLevelCmd{ - id: testId, + id: testID, LevelSpec: "debug", }, }, @@ -152,11 +152,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "decoderawtransaction", f: func() (Cmd, error) { - return NewDecodeRawTransactionCmd(testId, + return NewDecodeRawTransactionCmd(testID, "thisisahexidecimaltransaction") }, result: &DecodeRawTransactionCmd{ - id: testId, + id: testID, HexTx: "thisisahexidecimaltransaction", }, }, @@ -164,11 +164,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "decodescript", f: func() (Cmd, error) { - return NewDecodeScriptCmd(testId, + return NewDecodeScriptCmd(testID, "a bunch of hex") }, result: &DecodeScriptCmd{ - id: testId, + id: testID, HexScript: "a bunch of hex", }, }, @@ -176,11 +176,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "dumpprivkey", f: func() (Cmd, error) { - return NewDumpPrivKeyCmd(testId, + return NewDumpPrivKeyCmd(testID, "address") }, result: &DumpPrivKeyCmd{ - id: testId, + id: testID, Address: "address", }, }, @@ -188,11 +188,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "dumpwallet", f: func() (Cmd, error) { - return NewDumpWalletCmd(testId, + return NewDumpWalletCmd(testID, "filename") }, result: &DumpWalletCmd{ - id: testId, + id: testID, Filename: "filename", }, }, @@ -200,11 +200,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "encryptwallet", f: func() (Cmd, error) { - return NewEncryptWalletCmd(testId, + return NewEncryptWalletCmd(testID, "passphrase") }, result: &EncryptWalletCmd{ - id: testId, + id: testID, Passphrase: "passphrase", }, }, @@ -212,10 +212,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "estimatefee", f: func() (Cmd, error) { - return NewEstimateFeeCmd(testId, 1234) + return NewEstimateFeeCmd(testID, 1234) }, result: &EstimateFeeCmd{ - id: testId, + id: testID, NumBlocks: 1234, }, }, @@ -223,10 +223,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "estimatepriority", f: func() (Cmd, error) { - return NewEstimatePriorityCmd(testId, 1234) + return NewEstimatePriorityCmd(testID, 1234) }, result: &EstimatePriorityCmd{ - id: testId, + id: testID, NumBlocks: 1234, }, }, @@ -234,11 +234,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getaccount", f: func() (Cmd, error) { - return NewGetAccountCmd(testId, + return NewGetAccountCmd(testID, "address") }, result: &GetAccountCmd{ - id: testId, + id: testID, Address: "address", }, }, @@ -246,11 +246,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getaccountaddress", f: func() (Cmd, error) { - return NewGetAccountAddressCmd(testId, + return NewGetAccountAddressCmd(testID, "account") }, result: &GetAccountAddressCmd{ - id: testId, + id: testID, Account: "account", }, }, @@ -258,10 +258,10 @@ var jsoncmdtests = []struct { name: "basic true", cmd: "getaddednodeinfo", f: func() (Cmd, error) { - return NewGetAddedNodeInfoCmd(testId, true) + return NewGetAddedNodeInfoCmd(testID, true) }, result: &GetAddedNodeInfoCmd{ - id: testId, + id: testID, Dns: true, }, }, @@ -269,10 +269,10 @@ var jsoncmdtests = []struct { name: "basic false", cmd: "getaddednodeinfo", f: func() (Cmd, error) { - return NewGetAddedNodeInfoCmd(testId, false) + return NewGetAddedNodeInfoCmd(testID, false) }, result: &GetAddedNodeInfoCmd{ - id: testId, + id: testID, Dns: false, }, }, @@ -280,11 +280,11 @@ var jsoncmdtests = []struct { name: "basic withnode", cmd: "getaddednodeinfo", f: func() (Cmd, error) { - return NewGetAddedNodeInfoCmd(testId, true, + return NewGetAddedNodeInfoCmd(testID, true, "thisisanode") }, result: &GetAddedNodeInfoCmd{ - id: testId, + id: testID, Dns: true, Node: "thisisanode", }, @@ -293,11 +293,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getaddressesbyaccount", f: func() (Cmd, error) { - return NewGetAddressesByAccountCmd(testId, + return NewGetAddressesByAccountCmd(testID, "account") }, result: &GetAddressesByAccountCmd{ - id: testId, + id: testID, Account: "account", }, }, @@ -305,10 +305,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testId) + return NewGetBalanceCmd(testID) }, result: &GetBalanceCmd{ - id: testId, + id: testID, MinConf: 1, // the default }, }, @@ -316,10 +316,10 @@ var jsoncmdtests = []struct { name: "basic + account", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testId, "account") + return NewGetBalanceCmd(testID, "account") }, result: &GetBalanceCmd{ - id: testId, + id: testID, Account: "account", MinConf: 1, // the default }, @@ -328,10 +328,10 @@ var jsoncmdtests = []struct { name: "basic + minconf", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testId, "", 2) + return NewGetBalanceCmd(testID, "", 2) }, result: &GetBalanceCmd{ - id: testId, + id: testID, MinConf: 2, }, }, @@ -339,10 +339,10 @@ var jsoncmdtests = []struct { name: "basic + account + minconf", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testId, "account", 2) + return NewGetBalanceCmd(testID, "account", 2) }, result: &GetBalanceCmd{ - id: testId, + id: testID, Account: "account", MinConf: 2, }, @@ -351,21 +351,21 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getbestblockhash", f: func() (Cmd, error) { - return NewGetBestBlockHashCmd(testId) + return NewGetBestBlockHashCmd(testID) }, result: &GetBestBlockHashCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getblock", f: func() (Cmd, error) { - return NewGetBlockCmd(testId, + return NewGetBlockCmd(testID, "somehash") }, result: &GetBlockCmd{ - id: testId, + id: testID, Hash: "somehash", Verbose: true, }, @@ -374,30 +374,30 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getblockchaininfo", f: func() (Cmd, error) { - return NewGetBlockChainInfoCmd(testId) + return NewGetBlockChainInfoCmd(testID) }, result: &GetBlockChainInfoCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getblockcount", f: func() (Cmd, error) { - return NewGetBlockCountCmd(testId) + return NewGetBlockCountCmd(testID) }, result: &GetBlockCountCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getblockhash", f: func() (Cmd, error) { - return NewGetBlockHashCmd(testId, 1234) + return NewGetBlockHashCmd(testID, 1234) }, result: &GetBlockHashCmd{ - id: testId, + id: testID, Index: 1234, }, }, @@ -405,22 +405,22 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getblocktemplate", f: func() (Cmd, error) { - return NewGetBlockTemplateCmd(testId) + return NewGetBlockTemplateCmd(testID) }, result: &GetBlockTemplateCmd{ - id: testId, + id: testID, }, }, { name: "basic + request", cmd: "getblocktemplate", f: func() (Cmd, error) { - return NewGetBlockTemplateCmd(testId, + return NewGetBlockTemplateCmd(testID, &TemplateRequest{Mode: "mode", Capabilities: []string{"one", "two", "three"}}) }, result: &GetBlockTemplateCmd{ - id: testId, + id: testID, Request: &TemplateRequest{ Mode: "mode", Capabilities: []string{ @@ -435,12 +435,12 @@ var jsoncmdtests = []struct { name: "basic + request no mode", cmd: "getblocktemplate", f: func() (Cmd, error) { - return NewGetBlockTemplateCmd(testId, + return NewGetBlockTemplateCmd(testID, &TemplateRequest{ Capabilities: []string{"one", "two", "three"}}) }, result: &GetBlockTemplateCmd{ - id: testId, + id: testID, Request: &TemplateRequest{ Capabilities: []string{ "one", @@ -454,80 +454,80 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getconnectioncount", f: func() (Cmd, error) { - return NewGetConnectionCountCmd(testId) + return NewGetConnectionCountCmd(testID) }, result: &GetConnectionCountCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getdifficulty", f: func() (Cmd, error) { - return NewGetDifficultyCmd(testId) + return NewGetDifficultyCmd(testID) }, result: &GetDifficultyCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getgenerate", f: func() (Cmd, error) { - return NewGetGenerateCmd(testId) + return NewGetGenerateCmd(testID) }, result: &GetGenerateCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "gethashespersec", f: func() (Cmd, error) { - return NewGetHashesPerSecCmd(testId) + return NewGetHashesPerSecCmd(testID) }, result: &GetHashesPerSecCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getinfo", f: func() (Cmd, error) { - return NewGetInfoCmd(testId) + return NewGetInfoCmd(testID) }, result: &GetInfoCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getmininginfo", f: func() (Cmd, error) { - return NewGetMiningInfoCmd(testId) + return NewGetMiningInfoCmd(testID) }, result: &GetMiningInfoCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getnettotals", f: func() (Cmd, error) { - return NewGetNetTotalsCmd(testId) + return NewGetNetTotalsCmd(testID) }, result: &GetNetTotalsCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getnetworkhashps", f: func() (Cmd, error) { - return NewGetNetworkHashPSCmd(testId) + return NewGetNetworkHashPSCmd(testID) }, result: &GetNetworkHashPSCmd{ - id: testId, + id: testID, Blocks: 120, Height: -1, }, @@ -536,10 +536,10 @@ var jsoncmdtests = []struct { name: "basic + blocks", cmd: "getnetworkhashps", f: func() (Cmd, error) { - return NewGetNetworkHashPSCmd(testId, 5000) + return NewGetNetworkHashPSCmd(testID, 5000) }, result: &GetNetworkHashPSCmd{ - id: testId, + id: testID, Blocks: 5000, Height: -1, }, @@ -548,10 +548,10 @@ var jsoncmdtests = []struct { name: "basic + blocks + height", cmd: "getnetworkhashps", f: func() (Cmd, error) { - return NewGetNetworkHashPSCmd(testId, 5000, 1000) + return NewGetNetworkHashPSCmd(testID, 5000, 1000) }, result: &GetNetworkHashPSCmd{ - id: testId, + id: testID, Blocks: 5000, Height: 1000, }, @@ -560,20 +560,20 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getnetworkinfo", f: func() (Cmd, error) { - return NewGetNetworkInfoCmd(testId) + return NewGetNetworkInfoCmd(testID) }, result: &GetNetworkInfoCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getnewaddress", f: func() (Cmd, error) { - return NewGetNewAddressCmd(testId, "account") + return NewGetNewAddressCmd(testID, "account") }, result: &GetNewAddressCmd{ - id: testId, + id: testID, Account: "account", }, }, @@ -581,31 +581,31 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getpeerinfo", f: func() (Cmd, error) { - return NewGetPeerInfoCmd(testId) + return NewGetPeerInfoCmd(testID) }, result: &GetPeerInfoCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getrawchangeaddress", f: func() (Cmd, error) { - return NewGetRawChangeAddressCmd(testId) + return NewGetRawChangeAddressCmd(testID) }, result: &GetRawChangeAddressCmd{ - id: testId, + id: testID, }, }, { name: "basic + account", cmd: "getrawchangeaddress", f: func() (Cmd, error) { - return NewGetRawChangeAddressCmd(testId, + return NewGetRawChangeAddressCmd(testID, "accountname") }, result: &GetRawChangeAddressCmd{ - id: testId, + id: testID, Account: "accountname", }, }, @@ -613,30 +613,30 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getrawmempool", f: func() (Cmd, error) { - return NewGetRawMempoolCmd(testId) + return NewGetRawMempoolCmd(testID) }, result: &GetRawMempoolCmd{ - id: testId, + id: testID, }, }, { name: "basic noverbose", cmd: "getrawmempool", f: func() (Cmd, error) { - return NewGetRawMempoolCmd(testId, false) + return NewGetRawMempoolCmd(testID, false) }, result: &GetRawMempoolCmd{ - id: testId, + id: testID, }, }, { name: "basic verbose", cmd: "getrawmempool", f: func() (Cmd, error) { - return NewGetRawMempoolCmd(testId, true) + return NewGetRawMempoolCmd(testID, true) }, result: &GetRawMempoolCmd{ - id: testId, + id: testID, Verbose: true, }, }, @@ -644,11 +644,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getrawtransaction", f: func() (Cmd, error) { - return NewGetRawTransactionCmd(testId, + return NewGetRawTransactionCmd(testID, "sometxid") }, result: &GetRawTransactionCmd{ - id: testId, + id: testID, Txid: "sometxid", }, }, @@ -656,12 +656,12 @@ var jsoncmdtests = []struct { name: "basic + verbose", cmd: "getrawtransaction", f: func() (Cmd, error) { - return NewGetRawTransactionCmd(testId, + return NewGetRawTransactionCmd(testID, "sometxid", 1) }, result: &GetRawTransactionCmd{ - id: testId, + id: testID, Txid: "sometxid", Verbose: 1, }, @@ -670,12 +670,12 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getreceivedbyaccount", f: func() (Cmd, error) { - return NewGetReceivedByAccountCmd(testId, + return NewGetReceivedByAccountCmd(testID, "abtcaccount", 1) }, result: &GetReceivedByAccountCmd{ - id: testId, + id: testID, Account: "abtcaccount", MinConf: 1, }, @@ -684,12 +684,12 @@ var jsoncmdtests = []struct { name: "basic + opt", cmd: "getreceivedbyaccount", f: func() (Cmd, error) { - return NewGetReceivedByAccountCmd(testId, + return NewGetReceivedByAccountCmd(testID, "abtcaccount", 2) }, result: &GetReceivedByAccountCmd{ - id: testId, + id: testID, Account: "abtcaccount", MinConf: 2, }, @@ -698,12 +698,12 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getreceivedbyaddress", f: func() (Cmd, error) { - return NewGetReceivedByAddressCmd(testId, + return NewGetReceivedByAddressCmd(testID, "abtcaddress", 1) }, result: &GetReceivedByAddressCmd{ - id: testId, + id: testID, Address: "abtcaddress", MinConf: 1, }, @@ -712,12 +712,12 @@ var jsoncmdtests = []struct { name: "basic + opt", cmd: "getreceivedbyaddress", f: func() (Cmd, error) { - return NewGetReceivedByAddressCmd(testId, + return NewGetReceivedByAddressCmd(testID, "abtcaddress", 2) }, result: &GetReceivedByAddressCmd{ - id: testId, + id: testID, Address: "abtcaddress", MinConf: 2, }, @@ -726,11 +726,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "gettransaction", f: func() (Cmd, error) { - return NewGetTransactionCmd(testId, + return NewGetTransactionCmd(testID, "atxid") }, result: &GetTransactionCmd{ - id: testId, + id: testID, Txid: "atxid", }, }, @@ -738,12 +738,12 @@ var jsoncmdtests = []struct { name: "basic", cmd: "gettxout", f: func() (Cmd, error) { - return NewGetTxOutCmd(testId, + return NewGetTxOutCmd(testID, "sometx", 10) }, result: &GetTxOutCmd{ - id: testId, + id: testID, Txid: "sometx", Output: 10, IncludeMempool: true, @@ -753,13 +753,13 @@ var jsoncmdtests = []struct { name: "basic + optional", cmd: "gettxout", f: func() (Cmd, error) { - return NewGetTxOutCmd(testId, + return NewGetTxOutCmd(testID, "sometx", 10, false) }, result: &GetTxOutCmd{ - id: testId, + id: testID, Txid: "sometx", Output: 10, IncludeMempool: false, @@ -769,20 +769,20 @@ var jsoncmdtests = []struct { name: "basic", cmd: "gettxoutsetinfo", f: func() (Cmd, error) { - return NewGetTxOutSetInfoCmd(testId) + return NewGetTxOutSetInfoCmd(testID) }, result: &GetTxOutSetInfoCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "getwork", f: func() (Cmd, error) { - return NewGetWorkCmd(testId, "some data") + return NewGetWorkCmd(testID, "some data") }, result: &GetWorkCmd{ - id: testId, + id: testID, Data: "some data", }, }, @@ -790,21 +790,21 @@ var jsoncmdtests = []struct { name: "basic", cmd: "help", f: func() (Cmd, error) { - return NewHelpCmd(testId) + return NewHelpCmd(testID) }, result: &HelpCmd{ - id: testId, + id: testID, }, }, { name: "basic + optional cmd", cmd: "help", f: func() (Cmd, error) { - return NewHelpCmd(testId, + return NewHelpCmd(testID, "getinfo") }, result: &HelpCmd{ - id: testId, + id: testID, Command: "getinfo", }, }, @@ -812,11 +812,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "importprivkey", f: func() (Cmd, error) { - return NewImportPrivKeyCmd(testId, + return NewImportPrivKeyCmd(testID, "somereallongprivatekey") }, result: &ImportPrivKeyCmd{ - id: testId, + id: testID, PrivKey: "somereallongprivatekey", Rescan: true, }, @@ -825,12 +825,12 @@ var jsoncmdtests = []struct { name: "basic + 1 opt", cmd: "importprivkey", f: func() (Cmd, error) { - return NewImportPrivKeyCmd(testId, + return NewImportPrivKeyCmd(testID, "somereallongprivatekey", "some text") }, result: &ImportPrivKeyCmd{ - id: testId, + id: testID, PrivKey: "somereallongprivatekey", Label: "some text", Rescan: true, @@ -840,13 +840,13 @@ var jsoncmdtests = []struct { name: "basic + 2 opts", cmd: "importprivkey", f: func() (Cmd, error) { - return NewImportPrivKeyCmd(testId, + return NewImportPrivKeyCmd(testID, "somereallongprivatekey", "some text", false) }, result: &ImportPrivKeyCmd{ - id: testId, + id: testID, PrivKey: "somereallongprivatekey", Label: "some text", Rescan: false, @@ -856,11 +856,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "importwallet", f: func() (Cmd, error) { - return NewImportWalletCmd(testId, + return NewImportWalletCmd(testID, "walletfilename.dat") }, result: &ImportWalletCmd{ - id: testId, + id: testID, Filename: "walletfilename.dat", }, }, @@ -868,20 +868,20 @@ var jsoncmdtests = []struct { name: "basic", cmd: "keypoolrefill", f: func() (Cmd, error) { - return NewKeyPoolRefillCmd(testId) + return NewKeyPoolRefillCmd(testID) }, result: &KeyPoolRefillCmd{ - id: testId, + id: testID, }, }, { name: "newsize", cmd: "keypoolrefill", f: func() (Cmd, error) { - return NewKeyPoolRefillCmd(testId, 1000000) + return NewKeyPoolRefillCmd(testID, 1000000) }, result: &KeyPoolRefillCmd{ - id: testId, + id: testID, NewSize: 1000000, }, }, @@ -889,10 +889,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "listaccounts", f: func() (Cmd, error) { - return NewListAccountsCmd(testId, 1) + return NewListAccountsCmd(testID, 1) }, result: &ListAccountsCmd{ - id: testId, + id: testID, MinConf: 1, }, }, @@ -900,10 +900,10 @@ var jsoncmdtests = []struct { name: "basic + opt", cmd: "listaccounts", f: func() (Cmd, error) { - return NewListAccountsCmd(testId, 2) + return NewListAccountsCmd(testID, 2) }, result: &ListAccountsCmd{ - id: testId, + id: testID, MinConf: 2, }, }, @@ -911,30 +911,30 @@ var jsoncmdtests = []struct { name: "basic", cmd: "listaddressgroupings", f: func() (Cmd, error) { - return NewListAddressGroupingsCmd(testId) + return NewListAddressGroupingsCmd(testID) }, result: &ListAddressGroupingsCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "listlockunspent", f: func() (Cmd, error) { - return NewListLockUnspentCmd(testId) + return NewListLockUnspentCmd(testID) }, result: &ListLockUnspentCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "listreceivedbyaccount", f: func() (Cmd, error) { - return NewListReceivedByAccountCmd(testId) + return NewListReceivedByAccountCmd(testID) }, result: &ListReceivedByAccountCmd{ - id: testId, + id: testID, MinConf: 1, }, }, @@ -942,10 +942,10 @@ var jsoncmdtests = []struct { name: "basic + 1 opt", cmd: "listreceivedbyaccount", f: func() (Cmd, error) { - return NewListReceivedByAccountCmd(testId, 2) + return NewListReceivedByAccountCmd(testID, 2) }, result: &ListReceivedByAccountCmd{ - id: testId, + id: testID, MinConf: 2, }, }, @@ -953,10 +953,10 @@ var jsoncmdtests = []struct { name: "basic + 2 opt", cmd: "listreceivedbyaccount", f: func() (Cmd, error) { - return NewListReceivedByAccountCmd(testId, 2, true) + return NewListReceivedByAccountCmd(testID, 2, true) }, result: &ListReceivedByAccountCmd{ - id: testId, + id: testID, MinConf: 2, IncludeEmpty: true, }, @@ -965,10 +965,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "listreceivedbyaddress", f: func() (Cmd, error) { - return NewListReceivedByAddressCmd(testId) + return NewListReceivedByAddressCmd(testID) }, result: &ListReceivedByAddressCmd{ - id: testId, + id: testID, MinConf: 1, }, }, @@ -976,10 +976,10 @@ var jsoncmdtests = []struct { name: "basic + 1 opt", cmd: "listreceivedbyaddress", f: func() (Cmd, error) { - return NewListReceivedByAddressCmd(testId, 2) + return NewListReceivedByAddressCmd(testID, 2) }, result: &ListReceivedByAddressCmd{ - id: testId, + id: testID, MinConf: 2, }, }, @@ -987,10 +987,10 @@ var jsoncmdtests = []struct { name: "basic + 2 opt", cmd: "listreceivedbyaddress", f: func() (Cmd, error) { - return NewListReceivedByAddressCmd(testId, 2, true) + return NewListReceivedByAddressCmd(testID, 2, true) }, result: &ListReceivedByAddressCmd{ - id: testId, + id: testID, MinConf: 2, IncludeEmpty: true, }, @@ -999,10 +999,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "listsinceblock", f: func() (Cmd, error) { - return NewListSinceBlockCmd(testId) + return NewListSinceBlockCmd(testID) }, result: &ListSinceBlockCmd{ - id: testId, + id: testID, TargetConfirmations: 1, }, }, @@ -1010,10 +1010,10 @@ var jsoncmdtests = []struct { name: "basic + 1 ops", cmd: "listsinceblock", f: func() (Cmd, error) { - return NewListSinceBlockCmd(testId, "someblockhash") + return NewListSinceBlockCmd(testID, "someblockhash") }, result: &ListSinceBlockCmd{ - id: testId, + id: testID, BlockHash: "someblockhash", TargetConfirmations: 1, }, @@ -1022,10 +1022,10 @@ var jsoncmdtests = []struct { name: "basic + 2 ops", cmd: "listsinceblock", f: func() (Cmd, error) { - return NewListSinceBlockCmd(testId, "someblockhash", 3) + return NewListSinceBlockCmd(testID, "someblockhash", 3) }, result: &ListSinceBlockCmd{ - id: testId, + id: testID, BlockHash: "someblockhash", TargetConfirmations: 3, }, @@ -1034,10 +1034,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testId) + return NewListTransactionsCmd(testID) }, result: &ListTransactionsCmd{ - id: testId, + id: testID, Account: "", Count: 10, From: 0, @@ -1047,10 +1047,10 @@ var jsoncmdtests = []struct { name: "+ 1 optarg", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testId, "abcde") + return NewListTransactionsCmd(testID, "abcde") }, result: &ListTransactionsCmd{ - id: testId, + id: testID, Account: "abcde", Count: 10, From: 0, @@ -1060,10 +1060,10 @@ var jsoncmdtests = []struct { name: "+ 2 optargs", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testId, "abcde", 123) + return NewListTransactionsCmd(testID, "abcde", 123) }, result: &ListTransactionsCmd{ - id: testId, + id: testID, Account: "abcde", Count: 123, From: 0, @@ -1073,10 +1073,10 @@ var jsoncmdtests = []struct { name: "+ 3 optargs", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testId, "abcde", 123, 456) + return NewListTransactionsCmd(testID, "abcde", 123, 456) }, result: &ListTransactionsCmd{ - id: testId, + id: testID, Account: "abcde", Count: 123, From: 456, @@ -1086,10 +1086,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "listunspent", f: func() (Cmd, error) { - return NewListUnspentCmd(testId) + return NewListUnspentCmd(testID) }, result: &ListUnspentCmd{ - id: testId, + id: testID, MinConf: 1, MaxConf: 999999, }, @@ -1098,10 +1098,10 @@ var jsoncmdtests = []struct { name: "basic + opts", cmd: "listunspent", f: func() (Cmd, error) { - return NewListUnspentCmd(testId, 0, 6) + return NewListUnspentCmd(testID, 0, 6) }, result: &ListUnspentCmd{ - id: testId, + id: testID, MinConf: 0, MaxConf: 6, }, @@ -1110,12 +1110,12 @@ var jsoncmdtests = []struct { name: "basic + opts + addresses", cmd: "listunspent", f: func() (Cmd, error) { - return NewListUnspentCmd(testId, 0, 6, []string{ + return NewListUnspentCmd(testID, 0, 6, []string{ "a", "b", "c", }) }, result: &ListUnspentCmd{ - id: testId, + id: testID, MinConf: 0, MaxConf: 6, Addresses: []string{"a", "b", "c"}, @@ -1125,10 +1125,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "lockunspent", f: func() (Cmd, error) { - return NewLockUnspentCmd(testId, true) + return NewLockUnspentCmd(testID, true) }, result: &LockUnspentCmd{ - id: testId, + id: testID, Unlock: true, }, }, @@ -1136,14 +1136,14 @@ var jsoncmdtests = []struct { name: "basic", cmd: "move", f: func() (Cmd, error) { - return NewMoveCmd(testId, + return NewMoveCmd(testID, "account1", "account2", 12, 1) }, result: &MoveCmd{ - id: testId, + id: testID, FromAccount: "account1", ToAccount: "account2", Amount: 12, @@ -1154,7 +1154,7 @@ var jsoncmdtests = []struct { name: "basic + optionals", cmd: "move", f: func() (Cmd, error) { - return NewMoveCmd(testId, + return NewMoveCmd(testID, "account1", "account2", 12, @@ -1162,7 +1162,7 @@ var jsoncmdtests = []struct { "some comment") }, result: &MoveCmd{ - id: testId, + id: testID, FromAccount: "account1", ToAccount: "account2", Amount: 12, @@ -1174,24 +1174,24 @@ var jsoncmdtests = []struct { name: "basic", cmd: "ping", f: func() (Cmd, error) { - return NewPingCmd(testId) + return NewPingCmd(testID) }, result: &PingCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "sendfrom", f: func() (Cmd, error) { - return NewSendFromCmd(testId, + return NewSendFromCmd(testID, "account", "address", 12, 1) }, result: &SendFromCmd{ - id: testId, + id: testID, FromAccount: "account", ToAddress: "address", Amount: 12, @@ -1202,7 +1202,7 @@ var jsoncmdtests = []struct { name: "basic + options", cmd: "sendfrom", f: func() (Cmd, error) { - return NewSendFromCmd(testId, + return NewSendFromCmd(testID, "account", "address", 12, @@ -1211,7 +1211,7 @@ var jsoncmdtests = []struct { "comment to") }, result: &SendFromCmd{ - id: testId, + id: testID, FromAccount: "account", ToAddress: "address", Amount: 12, @@ -1229,12 +1229,12 @@ var jsoncmdtests = []struct { "address B": 2000, "address C": 3000, } - return NewSendManyCmd(testId, + return NewSendManyCmd(testID, "account", pairs) }, result: &SendManyCmd{ - id: testId, + id: testID, FromAccount: "account", Amounts: map[string]int64{ "address A": 1000, @@ -1253,14 +1253,14 @@ var jsoncmdtests = []struct { "address B": 2000, "address C": 3000, } - return NewSendManyCmd(testId, + return NewSendManyCmd(testID, "account", pairs, 10, "comment") }, result: &SendManyCmd{ - id: testId, + id: testID, FromAccount: "account", Amounts: map[string]int64{ "address A": 1000, @@ -1275,11 +1275,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "sendrawtransaction", f: func() (Cmd, error) { - return NewSendRawTransactionCmd(testId, + return NewSendRawTransactionCmd(testID, "hexstringofatx") }, result: &SendRawTransactionCmd{ - id: testId, + id: testID, HexTx: "hexstringofatx", }, }, @@ -1287,11 +1287,11 @@ var jsoncmdtests = []struct { name: "allowhighfees: false", cmd: "sendrawtransaction", f: func() (Cmd, error) { - return NewSendRawTransactionCmd(testId, + return NewSendRawTransactionCmd(testID, "hexstringofatx", false) }, result: &SendRawTransactionCmd{ - id: testId, + id: testID, HexTx: "hexstringofatx", }, }, @@ -1299,11 +1299,11 @@ var jsoncmdtests = []struct { name: "allowhighfees: true", cmd: "sendrawtransaction", f: func() (Cmd, error) { - return NewSendRawTransactionCmd(testId, + return NewSendRawTransactionCmd(testID, "hexstringofatx", true) }, result: &SendRawTransactionCmd{ - id: testId, + id: testID, HexTx: "hexstringofatx", AllowHighFees: true, }, @@ -1312,12 +1312,12 @@ var jsoncmdtests = []struct { name: "basic", cmd: "sendtoaddress", f: func() (Cmd, error) { - return NewSendToAddressCmd(testId, + return NewSendToAddressCmd(testID, "somebtcaddress", 1) }, result: &SendToAddressCmd{ - id: testId, + id: testID, Address: "somebtcaddress", Amount: 1, }, @@ -1326,14 +1326,14 @@ var jsoncmdtests = []struct { name: "basic + optional", cmd: "sendtoaddress", f: func() (Cmd, error) { - return NewSendToAddressCmd(testId, + return NewSendToAddressCmd(testID, "somebtcaddress", 1, "a comment", "comment to") }, result: &SendToAddressCmd{ - id: testId, + id: testID, Address: "somebtcaddress", Amount: 1, Comment: "a comment", @@ -1344,12 +1344,12 @@ var jsoncmdtests = []struct { name: "basic", cmd: "setaccount", f: func() (Cmd, error) { - return NewSetAccountCmd(testId, + return NewSetAccountCmd(testID, "somebtcaddress", "account name") }, result: &SetAccountCmd{ - id: testId, + id: testID, Address: "somebtcaddress", Account: "account name", }, @@ -1358,10 +1358,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "setgenerate", f: func() (Cmd, error) { - return NewSetGenerateCmd(testId, true) + return NewSetGenerateCmd(testID, true) }, result: &SetGenerateCmd{ - id: testId, + id: testID, Generate: true, GenProcLimit: -1, }, @@ -1370,10 +1370,10 @@ var jsoncmdtests = []struct { name: "basic + optional", cmd: "setgenerate", f: func() (Cmd, error) { - return NewSetGenerateCmd(testId, true, 10) + return NewSetGenerateCmd(testID, true, 10) }, result: &SetGenerateCmd{ - id: testId, + id: testID, Generate: true, GenProcLimit: 10, }, @@ -1382,10 +1382,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "settxfee", f: func() (Cmd, error) { - return NewSetTxFeeCmd(testId, 10) + return NewSetTxFeeCmd(testID, 10) }, result: &SetTxFeeCmd{ - id: testId, + id: testID, Amount: 10, }, }, @@ -1393,12 +1393,12 @@ var jsoncmdtests = []struct { name: "basic", cmd: "signmessage", f: func() (Cmd, error) { - return NewSignMessageCmd(testId, + return NewSignMessageCmd(testID, "btcaddress", "a message") }, result: &SignMessageCmd{ - id: testId, + id: testID, Address: "btcaddress", Message: "a message", }, @@ -1407,11 +1407,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "signrawtransaction", f: func() (Cmd, error) { - return NewSignRawTransactionCmd(testId, + return NewSignRawTransactionCmd(testID, "sometxstring") }, result: &SignRawTransactionCmd{ - id: testId, + id: testID, RawTx: "sometxstring", }, }, @@ -1419,7 +1419,7 @@ var jsoncmdtests = []struct { name: "basic + optional", cmd: "signrawtransaction", f: func() (Cmd, error) { - return NewSignRawTransactionCmd(testId, + return NewSignRawTransactionCmd(testID, "sometxstring", []RawTxInput{ RawTxInput{ @@ -1433,7 +1433,7 @@ var jsoncmdtests = []struct { "flags") }, result: &SignRawTransactionCmd{ - id: testId, + id: testID, RawTx: "sometxstring", Inputs: []RawTxInput{ RawTxInput{ @@ -1451,21 +1451,21 @@ var jsoncmdtests = []struct { name: "basic", cmd: "stop", f: func() (Cmd, error) { - return NewStopCmd(testId) + return NewStopCmd(testID) }, result: &StopCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "submitblock", f: func() (Cmd, error) { - return NewSubmitBlockCmd(testId, + return NewSubmitBlockCmd(testID, "lotsofhex") }, result: &SubmitBlockCmd{ - id: testId, + id: testID, HexBlock: "lotsofhex", }, }, @@ -1473,12 +1473,12 @@ var jsoncmdtests = []struct { name: "+ optional object", cmd: "submitblock", f: func() (Cmd, error) { - return NewSubmitBlockCmd(testId, + return NewSubmitBlockCmd(testID, "lotsofhex", &SubmitBlockOptions{WorkID: "otherstuff"}) }, result: &SubmitBlockCmd{ - id: testId, + id: testID, HexBlock: "lotsofhex", Options: &SubmitBlockOptions{WorkID: "otherstuff"}, }, @@ -1487,11 +1487,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "validateaddress", f: func() (Cmd, error) { - return NewValidateAddressCmd(testId, + return NewValidateAddressCmd(testID, "somebtcaddress") }, result: &ValidateAddressCmd{ - id: testId, + id: testID, Address: "somebtcaddress", }, }, @@ -1499,10 +1499,10 @@ var jsoncmdtests = []struct { name: "basic", cmd: "verifychain", f: func() (Cmd, error) { - return NewVerifyChainCmd(testId) + return NewVerifyChainCmd(testID) }, result: &VerifyChainCmd{ - id: testId, + id: testID, CheckLevel: 3, CheckDepth: 288, }, @@ -1511,10 +1511,10 @@ var jsoncmdtests = []struct { name: "basic + optional", cmd: "verifychain", f: func() (Cmd, error) { - return NewVerifyChainCmd(testId, 4, 1) + return NewVerifyChainCmd(testID, 4, 1) }, result: &VerifyChainCmd{ - id: testId, + id: testID, CheckLevel: 4, CheckDepth: 1, }, @@ -1523,13 +1523,13 @@ var jsoncmdtests = []struct { name: "basic", cmd: "verifymessage", f: func() (Cmd, error) { - return NewVerifyMessageCmd(testId, + return NewVerifyMessageCmd(testID, "someaddress", "somesig", "a message") }, result: &VerifyMessageCmd{ - id: testId, + id: testID, Address: "someaddress", Signature: "somesig", Message: "a message", @@ -1539,22 +1539,22 @@ var jsoncmdtests = []struct { name: "basic", cmd: "walletlock", f: func() (Cmd, error) { - return NewWalletLockCmd(testId) + return NewWalletLockCmd(testID) }, result: &WalletLockCmd{ - id: testId, + id: testID, }, }, { name: "basic", cmd: "walletpassphrase", f: func() (Cmd, error) { - return NewWalletPassphraseCmd(testId, + return NewWalletPassphraseCmd(testID, "phrase1", 10) }, result: &WalletPassphraseCmd{ - id: testId, + id: testID, Passphrase: "phrase1", Timeout: 10, }, @@ -1563,11 +1563,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "walletpassphrasechange", f: func() (Cmd, error) { - return NewWalletPassphraseChangeCmd(testId, + return NewWalletPassphraseChangeCmd(testID, "phrase1", "phrase2") }, result: &WalletPassphraseChangeCmd{ - id: testId, + id: testID, OldPassphrase: "phrase1", NewPassphrase: "phrase2", }, @@ -1599,7 +1599,7 @@ func TestCmds(t *testing.T) { } id, ok := (c.Id()).(float64) - if !ok || id != testId { + if !ok || id != testID { t.Errorf("%s: id not returned properly", name) } diff --git a/jsonfxns.go b/jsonfxns.go index 5bf2cfda..98339a0c 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -70,7 +70,7 @@ func GetRaw(resp io.ReadCloser) ([]byte, error) { body, err := ioutil.ReadAll(resp) resp.Close() if err != nil { - err = fmt.Errorf("Error reading json reply: %v", err) + err = fmt.Errorf("error reading json reply: %v", err) return body, err } return body, nil diff --git a/jsonresults.go b/jsonresults.go index e5f41046..452164cc 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -71,7 +71,7 @@ type GetBlockChainInfoResult struct { ChainWork string `json:"chainwork"` } -// GetBlockTemplateResultTransaction models the transactions field of the +// GetBlockTemplateResultTx models the transactions field of the // getblocktemplate command. type GetBlockTemplateResultTx struct { Data string `json:"data"` @@ -437,9 +437,9 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { err = json.Unmarshal(message, &objmap) if err != nil { if strings.Contains(string(message), "401 Unauthorized.") { - err = fmt.Errorf("Authentication error.") + err = fmt.Errorf("authentication error") } else { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) + err = fmt.Errorf("error unmarshalling json reply: %v", err) } return result, err } @@ -448,12 +448,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { var id interface{} err = json.Unmarshal(objmap["error"], &jsonErr) if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) + err = fmt.Errorf("error unmarshalling json reply: %v", err) return result, err } err = json.Unmarshal(objmap["id"], &id) if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) + err = fmt.Errorf("error unmarshalling json reply: %v", err) return result, err } @@ -709,7 +709,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { } } if err != nil { - err = fmt.Errorf("Error unmarshalling json reply: %v", err) + err = fmt.Errorf("error unmarshalling json reply: %v", err) return result, err } // Only want the error field when there is an actual error to report. From 766d571317a53de92d05504a6fab371d2c5e8864 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Thu, 24 Jul 2014 10:06:25 -0400 Subject: [PATCH 195/229] Replace common error with defined value. --- jsonapi.go | 26 ++++++++++++-------------- test_coverage.txt | 4 ++-- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 47fb11af..c40d7f88 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -6,9 +6,14 @@ package btcjson import ( "encoding/json" + "errors" "fmt" ) +// ErrIncorrectArgTypes describes an error where the wrong argument types +// are present. +var ErrIncorrectArgTypes = errors.New("incorrect arguement types") + // Message contains a message to be sent to the bitcoin client. type Message struct { Jsonrpc string `json:"jsonrpc"` @@ -500,8 +505,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ add, ok3 := args[(i*4)+2].(string) amt, ok4 := args[(i*4)+3].(float64) if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("incorrect arguement types") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } vList[i].Txid = txid vList[i].Vout = vout @@ -518,8 +522,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ var comment string _, ok1 := args[0].(string) if !ok1 { - err = fmt.Errorf("incorrect arguement types") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } addresses := make(map[string]float64) for i := 1; i < len(args); i += 2 { @@ -528,8 +531,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ if len(args) > i+1 { amt, ok2 := args[i+1].(float64) if !ok2 { - err = fmt.Errorf("incorrect arguement types") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } // Put a single pair into addresses addresses[add] = amt @@ -556,8 +558,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } _, ok1 := args[0].(bool) if !ok1 { - err = fmt.Errorf("incorrect arguement types") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } finalMessage, err = jsonWithArgs(message, id, args) // one required string (hex) and optional sets of one string, one int, @@ -569,8 +570,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } _, ok1 := args[0].(string) if !ok1 { - err = fmt.Errorf("incorrect arguement types") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } type txlist struct { Txid string `json:"txid"` @@ -584,8 +584,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ vout, ok3 := args[2].(uint32) spkey, ok4 := args[3].(string) if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("incorrect arguement types") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } txList[0].Txid = txid txList[0].Vout = vout @@ -600,8 +599,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ spkey, ok3 := args[(i*4)+3].(string) pkey, ok4 := args[(i*4)+4].(string) if !ok1 || !ok2 || !ok3 || !ok4 { - err = fmt.Errorf("Incorrect arguement types.") - return finalMessage, err + return finalMessage, ErrIncorrectArgTypes } txList[i].Txid = txid txList[i].Vout = vout diff --git a/test_coverage.txt b/test_coverage.txt index 9fa27538..84064814 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -202,7 +202,7 @@ github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1 github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.18% (327/340) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.11% (321/334) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) @@ -410,5 +410,5 @@ github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 77.82% (2365/3039) +github.com/conformal/btcjson --------------------------------------- 77.78% (2359/3033) From 3d76571621d9f34d7c0470b7d621aea916ceb0f6 Mon Sep 17 00:00:00 2001 From: David Hill Date: Fri, 29 Aug 2014 09:14:20 -0400 Subject: [PATCH 196/229] Update getnetworkinfo structure. This matches the changes in Bitcoin Core. Tested with btcctl. OK @jcvernaleo --- jsonresults.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index 452164cc..9474b68a 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -131,7 +131,7 @@ type GetNetworkInfoResult struct { ProtocolVersion int32 `json:"protocolversion"` TimeOffset int64 `json:"timeoffset"` Connections int32 `json:"connections"` - Proxy string `json:"proxy,omitempty"` + Networks []NetworksResult `json:"networks"` RelayFee float64 `json:"relayfee"` LocalAddresses []LocalAddressesResult `json:"localaddresses"` } @@ -382,6 +382,14 @@ type ListUnspentResult struct { Confirmations int64 `json:"confirmations"` } +// NetworksResult models the networks data from the getnetworkinfo command. +type NetworksResult struct { + Name string `json:"name"` + Limited bool `json:"limited"` + Reachable bool `json:"reachable"` + Proxy string `json:"proxy"` +} + // SignRawTransactionResult models the data from the signrawtransaction // command. type SignRawTransactionResult struct { From d6a4b896015c71ccff1e3b08d4a6a028213a0642 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Thu, 4 Sep 2014 20:55:34 +0530 Subject: [PATCH 197/229] updated ListReceivedByAddressResult for Tx ids also added InvolvesWatchonly while here --- jsonresults.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 9474b68a..3fb23979 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -358,10 +358,12 @@ type ListReceivedByAccountResult struct { // ListReceivedByAddressResult models the data from the listreceivedbyaddress // command. type ListReceivedByAddressResult struct { - Account string `json:"account"` - Address string `json:"address"` - Amount float64 `json:"amount"` - Confirmations uint64 `json:"confirmations"` + Account string `json:"account"` + Address string `json:"address"` + Amount float64 `json:"amount"` + Confirmations uint64 `json:"confirmations"` + Tx []string `json:"tx,omitempty"` + InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"` } // ListSinceBlockResult models the data from the listsinceblock command. From c630b6ca1fa86bead0d13f3e32fede47a40f32d3 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 5 Sep 2014 13:44:04 -0400 Subject: [PATCH 198/229] Minor golint cleanups. --- internal_test.go | 6 +++--- jsonapi.go | 2 +- jsonfxns.go | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal_test.go b/internal_test.go index cf041f8f..3116ec28 100644 --- a/internal_test.go +++ b/internal_test.go @@ -42,16 +42,16 @@ func TestJsonWithArgs(t *testing.T) { return } -// TestJsonRpcSend tests jsonRpcSend which actually send the rpc command. +// TestJsonRPCSend tests jsonRPCSend which actually send the rpc command. // This currently a negative test only until we setup a fake http server to // test the actually connection code. -func TestJsonRpcSend(t *testing.T) { +func TestJsonRPCSend(t *testing.T) { // Just negative test right now. user := "something" password := "something" server := "invalid" var message []byte - _, err := jsonRpcSend(user, password, server, message, false, nil, false) + _, err := jsonRPCSend(user, password, server, message, false, nil, false) if err == nil { t.Errorf("Should fail when it cannot connect.") } diff --git a/jsonapi.go b/jsonapi.go index c40d7f88..3720ce10 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -705,7 +705,7 @@ func rpcRawCommand(user string, password string, server string, err := fmt.Errorf("error, message does not appear to be valid json: %v", err) return result, err } - resp, err := jsonRpcSend(user, password, server, message, https, + resp, err := jsonRPCSend(user, password, server, message, https, certificates, skipverify) if err != nil { err := fmt.Errorf("error sending json message: " + err.Error()) diff --git a/jsonfxns.go b/jsonfxns.go index 98339a0c..df4a16b7 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -6,6 +6,7 @@ package btcjson import ( "bytes" + // Need to import this size it registers hash we need. _ "crypto/sha512" "crypto/tls" "crypto/x509" @@ -31,11 +32,11 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) { return msg, nil } -// jsonRpcSend connects to the daemon with the specified username, password, +// jsonRPCSend connects to the daemon with the specified username, password, // and ip/port and then send the supplied message. This uses net/http rather // than net/rpc/jsonrpc since that one doesn't support http connections and is // therefore useless. -func jsonRpcSend(user string, password string, server string, message []byte, +func jsonRPCSend(user string, password string, server string, message []byte, https bool, certificates []byte, skipverify bool) (*http.Response, error) { client := &http.Client{} protocol := "http" From 8f4643df14832a09183427810ddef051a7a4aeec Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Fri, 5 Sep 2014 14:58:14 -0400 Subject: [PATCH 199/229] Add go vet and golint to travis-ci config. For golint, min_confidence is set to 0.9 since things aren't totally golint clean yet. --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ae71c02f..763a2eca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,11 @@ language: go go: release -install: go get -d -t -v ./... +install: +- go get code.google.com/p/go.tools/cmd/vet +- go get github.com/GeertJohan/fgt +- go get github.com/golang/lint/golint +- go get -d -t -v ./... +script: +- $HOME/gopath/bin/fgt $HOME/gopath/bin/golint -min_confidence=0.9 *.go +- go vet *.go +- go test -v ./... From 4bc2c7f04f2a252b304c13ce5315431909994681 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Mon, 8 Sep 2014 08:41:26 -0400 Subject: [PATCH 200/229] Slight siplification in .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 763a2eca..291a624f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ install: - go get github.com/golang/lint/golint - go get -d -t -v ./... script: -- $HOME/gopath/bin/fgt $HOME/gopath/bin/golint -min_confidence=0.9 *.go +- export PATH=$PATH:$HOME/gopath/bin +- fgt golint -min_confidence=0.9 *.go - go vet *.go - go test -v ./... From 036daa58178a284c864a294a556a0954f96a3af4 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 16 Sep 2014 07:58:50 -0400 Subject: [PATCH 201/229] Bring .travis.yml in line with others. Add tip too. --- .travis.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 291a624f..8febacf1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,16 @@ language: go -go: release +go: + - 1.2 + - release + - tip install: -- go get code.google.com/p/go.tools/cmd/vet -- go get github.com/GeertJohan/fgt -- go get github.com/golang/lint/golint -- go get -d -t -v ./... + - go get -d -t -v ./... + - go get -v code.google.com/p/go.tools/cmd/vet + - go get -v github.com/GeertJohan/fgt + - go get -v github.com/golang/lint/golint script: -- export PATH=$PATH:$HOME/gopath/bin -- fgt golint -min_confidence=0.9 *.go -- go vet *.go -- go test -v ./... + - export PATH=$PATH:$HOME/gopath/bin + - go vet + - fgt golint -min_confidence=0.9 . + - go vet *.go + - go test -v From 3e465b2012afb194e9d4d4410f33ac4eb6e2ad9e Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 16 Sep 2014 08:14:49 -0400 Subject: [PATCH 202/229] Remove extra go vet --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8febacf1..9a3d80d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,5 +12,4 @@ script: - export PATH=$PATH:$HOME/gopath/bin - go vet - fgt golint -min_confidence=0.9 . - - go vet *.go - go test -v From 26802c7eccfb484141a1488c9ef40e5b5805d96c Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 16 Sep 2014 10:10:24 -0500 Subject: [PATCH 203/229] Fix JSONGetMethod to prevent panics on bad input. ok @jcvernaleo --- jsonapi.go | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 3720ce10..0e37bd23 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -618,26 +618,11 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ // JSONGetMethod takes a message and tries to find the bitcoin command that it // is in reply to so it can be processed further. func JSONGetMethod(message []byte) (string, error) { - // Need this so we can tell what kind of message we are sending - // so we can unmarshal it properly. - var method string - var msg interface{} - err := json.Unmarshal(message, &msg) - if err != nil { - err := fmt.Errorf("error, message does not appear to be valid json: %v", err) - return method, err + var obj struct { + Method string `json:"method"` } - m := msg.(map[string]interface{}) - for k, v := range m { - if k == "method" { - method = v.(string) - } - } - if method == "" { - err := fmt.Errorf("error, no method specified") - return method, err - } - return method, err + err := json.Unmarshal(message, &obj) + return obj.Method, err } // TlsRpcCommand takes a message generated from one of the routines above From 1caddd4a37d2e85c65e36065bdd47cf946e9e4c1 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Tue, 16 Sep 2014 01:44:44 +0530 Subject: [PATCH 204/229] handle http errors ok @jrick, @jcvernaleo --- jsonapi.go | 12 ++++++++++++ jsonresults.go | 6 ------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/jsonapi.go b/jsonapi.go index 0e37bd23..8d2a8b94 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -8,8 +8,17 @@ import ( "encoding/json" "errors" "fmt" + "net/http" ) +// BadStatusCode describes a HTTP error when a response has non-200 status code +type BadStatusCode int + +func (e BadStatusCode) Error() string { + status := int(e) + return fmt.Sprintf("http bad status: %d %s", status, http.StatusText(status)) +} + // ErrIncorrectArgTypes describes an error where the wrong argument types // are present. var ErrIncorrectArgTypes = errors.New("incorrect arguement types") @@ -696,6 +705,9 @@ func rpcRawCommand(user string, password string, server string, err := fmt.Errorf("error sending json message: " + err.Error()) return result, err } + if resp.StatusCode != http.StatusOK { + return nil, BadStatusCode(resp.StatusCode) + } result, err = GetRaw(resp.Body) if err != nil { err := fmt.Errorf("error getting json reply: %v", err) diff --git a/jsonresults.go b/jsonresults.go index 3fb23979..71a6418f 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -8,7 +8,6 @@ import ( "bytes" "encoding/json" "fmt" - "strings" ) // BlockResult models the data from the getblock command when the verbose flag @@ -446,11 +445,6 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { var objmap map[string]json.RawMessage err = json.Unmarshal(message, &objmap) if err != nil { - if strings.Contains(string(message), "401 Unauthorized.") { - err = fmt.Errorf("authentication error") - } else { - err = fmt.Errorf("error unmarshalling json reply: %v", err) - } return result, err } // Take care of the parts that are the same for all replies. From a5b1a31e073d67be0215e68ce3714b2cfd661bfd Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sat, 20 Sep 2014 19:05:38 -0500 Subject: [PATCH 205/229] Use the net package function for credentials. This change ensures any usernames or passwords which contain symbols that would confuse the URL parser are properly escaped. --- jsonfxns.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsonfxns.go b/jsonfxns.go index df4a16b7..baa45b65 100644 --- a/jsonfxns.go +++ b/jsonfxns.go @@ -15,6 +15,7 @@ import ( "io" "io/ioutil" "net/http" + "net/url" "strings" ) @@ -52,7 +53,7 @@ func jsonRPCSend(user string, password string, server string, message []byte, client.Transport = transport protocol = "https" } - credentials := user + ":" + password + credentials := url.UserPassword(user, password).String() resp, err := client.Post(protocol+"://"+credentials+"@"+server, "application/json", bytes.NewReader(message)) if err != nil { From dd4763c7260c53f513b6981fec1b90174038686e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 23 Oct 2014 10:18:56 -0500 Subject: [PATCH 206/229] Don't modify nil getnetworkinfo result. Since the result might not be set when the response does not contain one, such as in the case when the command is not implemented by the server, don't attempt to modify it until ensuring it exists. --- jsonresults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index 71a6418f..7ee0704a 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -580,7 +580,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { var res *GetNetworkInfoResult err = json.Unmarshal(objmap["result"], &res) if err == nil { - if res.LocalAddresses == nil { + if res != nil && res.LocalAddresses == nil { res.LocalAddresses = []LocalAddressesResult{} } result.Result = res From e316258f6de796341e89f51a51986953982690c4 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Sun, 26 Oct 2014 13:22:39 -0500 Subject: [PATCH 207/229] Update ListReceivedByAddressResult txids field. The name of the field in the returned JSON is txids, not tx. --- jsonresults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index 7ee0704a..472cab49 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -361,7 +361,7 @@ type ListReceivedByAddressResult struct { Address string `json:"address"` Amount float64 `json:"amount"` Confirmations uint64 `json:"confirmations"` - Tx []string `json:"tx,omitempty"` + TxIDs []string `json:"txids,omitempty"` InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"` } From d87778df6dc5d5f1716021c0fca26e035ed7ac73 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Wed, 29 Oct 2014 13:02:48 +0530 Subject: [PATCH 208/229] update ValidateAddressResult for IsWatchOnly --- jsonresults.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonresults.go b/jsonresults.go index 472cab49..0f970b32 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -426,6 +426,7 @@ type ValidateAddressResult struct { IsValid bool `json:"isvalid"` Address string `json:"address,omitempty"` IsMine bool `json:"ismine,omitempty"` + IsWatchOnly bool `json:"iswatchonly,omitempty"` IsScript bool `json:"isscript,omitempty"` PubKey string `json:"pubkey,omitempty"` IsCompressed bool `json:"iscompressed,omitempty"` From 503670f7a576b10227b12fe5526c6f05924fcf3e Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 2 Dec 2014 13:10:21 -0500 Subject: [PATCH 209/229] For now, do not have travis build tip. The location of go vet moved but the new version only works with tip while the old one works with release. So for now, not building tip. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9a3d80d2..748c55d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: go go: - 1.2 - release - - tip install: - go get -d -t -v ./... - go get -v code.google.com/p/go.tools/cmd/vet From e0d536640da2eaf6720b01e3b489e2e8886c4194 Mon Sep 17 00:00:00 2001 From: "John C. Vernaleo" Date: Tue, 2 Dec 2014 08:58:23 -0500 Subject: [PATCH 210/229] Add invalidateblock and reconsiderblock. --- cmdhelp.go | 12 +- jsonapi.go | 3 +- jsonapi_test.go | 8 + jsoncmd.go | 146 +++++++++++++++ jsoncmd_test.go | 26 +++ test_coverage.txt | 463 ++++++++++++++++++++++++---------------------- 6 files changed, 428 insertions(+), 230 deletions(-) diff --git a/cmdhelp.go b/cmdhelp.go index 3b745e77..801500dc 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -416,7 +416,7 @@ following information about txid is returned: Returns the total amount of BTC received by addresses related to "account". Only transactions with at least "minconf" confirmations are considered.`, - "getreceivedbyaddress": `getreceivedbyaddress "address" ( minconf=1 ) + "getreceivedbyaddress": `getreceivedbyaddress "address" ( minconf=1 ) Returns the total amount of BTC received by the given address. Only transactions with "minconf" confirmations will be used for the total.`, @@ -500,6 +500,9 @@ blockchain will be scanned for transaction.`, "importwallet": `importwallet "filename" Imports keys from the wallet dump file in "filename".`, + "invalidateblock": `invalidateblock "hash" +Mark block specified by "hash" as invalid.`, + "keypoolrefill": `keypoolrefill ( newsize=100 ) Refills the wallet pregenerated key pool to a size of "newsize"`, @@ -571,7 +574,7 @@ with "minconf" confirmations are listed. "transactions":[ "account" # String of account related to the transaction. "address" # String of related address of transaction. - "category":"send|receive" # String detailing whether transaction was a send or receive of funds. + "category":"send|receive" # String detailing whether transaction was a send or receive of funds. "amount":n, # Numeric value of transaction. Negative if transaction category was "send" "fee":n, # Numeric value of transaction fee in BTC. "confirmations":n, # Number of transaction confirmations @@ -594,7 +597,7 @@ accounts if none specified) skipping the first "from" transactions. "transactions":[ "account" # String of account related to the transaction. "address" # String of related address of transaction. - "category":"send|receive|move" # String detailing whether transaction was a send or receive of funds.Move is a local move between accounts and doesnt touch the blockchain. + "category":"send|receive|move" # String detailing whether transaction was a send or receive of funds.Move is a local move between accounts and doesnt touch the blockchain. "amount":n, # Numeric value of transaction. Negative if transaction category was "send" "fee":n, # Numeric value of transaction fee in BTC. "confirmations":n, # Number of transaction confirmations @@ -645,6 +648,9 @@ to denode success.`, Queues a ping to be sent to each connected peer. Ping times are provided in getpeerinfo.`, + "reconsiderblock": `reconsiderblock "hash" +Remove invalid mark from block specified by "hash" so it is considered again.`, + "sendfrom": `sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf=1 "comment" "comment-to" ) Sends "amount" (rounded to the nearest 0.00000001) to "tobitcoindaddress" from "fromaccount". Only funds with at least diff --git a/jsonapi.go b/jsonapi.go index 8d2a8b94..9821e199 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -169,7 +169,8 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ case "backupwallet", "decoderawtransaction", "dumpprivkey", "encryptwallet", "getaccount", "getaccountaddress", "getaddressesbyaccount", "getblock", - "gettransaction", "sendrawtransaction", "validateaddress": + "gettransaction", "sendrawtransaction", "validateaddress", + "invalidateblock", "reconsiderblock": if len(args) != 1 { err = fmt.Errorf("%s requires one argument", message) return finalMessage, err diff --git a/jsonapi_test.go b/jsonapi_test.go index 19aff307..c4e20a27 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -57,6 +57,14 @@ var cmdtests = []struct { {"backupwallet", []interface{}{1, 2}, false}, {"backupwallet", []interface{}{1}, false}, {"backupwallet", []interface{}{"testpath"}, true}, + {"invalidateblock", nil, false}, + {"invalidateblock", []interface{}{1, 2}, false}, + {"invalidateblock", []interface{}{1}, false}, + {"invalidateblock", []interface{}{"testhash"}, true}, + {"reconsiderblock", nil, false}, + {"reconsiderblock", []interface{}{1, 2}, false}, + {"reconsiderblock", []interface{}{1}, false}, + {"reconsiderblock", []interface{}{"testhash"}, true}, {"setaccount", nil, false}, {"setaccount", []interface{}{1}, false}, {"setaccount", []interface{}{1, 2, 3}, false}, diff --git a/jsoncmd.go b/jsoncmd.go index 2b9bae58..00426885 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -244,6 +244,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "importwallet": cmd = new(ImportWalletCmd) + case "invalidateblock": + cmd = new(InvalidateBlockCmd) + case "keypoolrefill": cmd = new(KeyPoolRefillCmd) @@ -280,6 +283,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "ping": cmd = new(PingCmd) + case "reconsiderblock": + cmd = new(ReconsiderBlockCmd) + case "sendfrom": cmd = new(SendFromCmd) @@ -4018,6 +4024,76 @@ func (cmd *ImportWalletCmd) UnmarshalJSON(b []byte) error { return nil } +// InvalidateBlockCmd is a type handling custom marshaling and +// unmarshaling of invalidateblock JSON RPC commands. +type InvalidateBlockCmd struct { + id interface{} + BlockHash string +} + +// Enforce that InvalidateBlockCmd satisifies the Cmd interface. +var _ Cmd = &InvalidateBlockCmd{} + +// NewInvalidateBlockCmd creates a new InvalidateBlockCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewInvalidateBlockCmd(id interface{}, blockhash string) (*InvalidateBlockCmd, error) { + return &InvalidateBlockCmd{ + id: id, + BlockHash: blockhash, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *InvalidateBlockCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *InvalidateBlockCmd) Method() string { + return "invalidateblock" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *InvalidateBlockCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.BlockHash, + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *InvalidateBlockCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + var blockhash string + if err := json.Unmarshal(r.Params[0], &blockhash); err != nil { + return fmt.Errorf("first parameter 'hash' must be a string: %v", err) + } + + newCmd, err := NewInvalidateBlockCmd(r.Id, blockhash) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // KeyPoolRefillCmd is a type handling custom marshaling and // unmarshaling of keypoolrefill JSON RPC commands. type KeyPoolRefillCmd struct { @@ -5173,6 +5249,76 @@ func (cmd *PingCmd) UnmarshalJSON(b []byte) error { return nil } +// ReconsiderBlockCmd is a type handling custom marshaling and +// unmarshaling of reconsiderblock JSON RPC commands. +type ReconsiderBlockCmd struct { + id interface{} + BlockHash string +} + +// Enforce that ReconsiderBlockCmd satisifies the Cmd interface. +var _ Cmd = &ReconsiderBlockCmd{} + +// NewReconsiderBlockCmd creates a new ReconsiderBlockCmd. Optionally a +// pointer to a TemplateRequest may be provided. +func NewReconsiderBlockCmd(id interface{}, blockhash string) (*ReconsiderBlockCmd, error) { + return &ReconsiderBlockCmd{ + id: id, + BlockHash: blockhash, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ReconsiderBlockCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ReconsiderBlockCmd) Method() string { + return "reconsiderblock" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ReconsiderBlockCmd) MarshalJSON() ([]byte, error) { + params := []interface{}{ + cmd.BlockHash, + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ReconsiderBlockCmd) UnmarshalJSON(b []byte) error { + // Unmashal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) != 1 { + return ErrWrongNumberOfParams + } + + var blockhash string + if err := json.Unmarshal(r.Params[0], &blockhash); err != nil { + return fmt.Errorf("first parameter 'hash' must be a string: %v", err) + } + + newCmd, err := NewReconsiderBlockCmd(r.Id, blockhash) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // SendFromCmd is a type handling custom marshaling and // unmarshaling of sendfrom JSON RPC commands. type SendFromCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index b5db010e..1671e55b 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -864,6 +864,18 @@ var jsoncmdtests = []struct { Filename: "walletfilename.dat", }, }, + { + name: "basic", + cmd: "invalidateblock", + f: func() (Cmd, error) { + return NewInvalidateBlockCmd(testID, + "lotsofhex") + }, + result: &InvalidateBlockCmd{ + id: testID, + BlockHash: "lotsofhex", + }, + }, { name: "basic", cmd: "keypoolrefill", @@ -1180,6 +1192,18 @@ var jsoncmdtests = []struct { id: testID, }, }, + { + name: "basic", + cmd: "reconsiderblock", + f: func() (Cmd, error) { + return NewReconsiderBlockCmd(testID, + "lotsofhex") + }, + result: &ReconsiderBlockCmd{ + id: testID, + BlockHash: "lotsofhex", + }, + }, { name: "basic", cmd: "sendfrom", @@ -1668,6 +1692,7 @@ func TestHelps(t *testing.T) { "help", "importprivkey", "importwallet", + "invalidateblock", "keypoolrefill", "listaccounts", "listaddressgroupings", @@ -1680,6 +1705,7 @@ func TestHelps(t *testing.T) { "lockunspent", "move", "ping", + "reconsiderblock", "sendfrom", "sendmany", "sendrawtransaction", diff --git a/test_coverage.txt b/test_coverage.txt index 84064814..73731a4a 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,397 +1,407 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (14/14) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) +github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewReconsiderBlockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewInvalidateBlockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.11% (321/334) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.30% (83/94) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.54% (85/96) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 72.73% (16/22) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/jsonresults.go ReadResultCmd 62.13% (105/169) +github.com/conformal/btcjson/jsonfxns.go jsonRPCSend 62.50% (10/16) +github.com/conformal/btcjson/jsonresults.go ReadResultCmd 62.05% (103/166) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) 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) github.com/conformal/btcjson/cmdhelp.go GetHelpString 50.00% (3/6) +github.com/conformal/btcjson/jsonapi.go rpcRawCommand 47.06% (8/17) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 44.83% (13/29) github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 43.75% (7/16) github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) @@ -401,14 +411,15 @@ github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go isFloatInt64 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go BadStatusCode.Error 0.00% (0/2) github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 77.78% (2359/3033) +github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go isFloatInt64 0.00% (0/1) +github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) +github.com/conformal/btcjson --------------------------------------- 77.60% (2380/3067) From 43b4cad8b69e3056018eaeb9b2bc9bba7a42af86 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 11 Dec 2014 11:33:23 -0600 Subject: [PATCH 211/229] Update TracisCI for Go 1.4 release. Our policy is to only ensure the code compiles for the latest Go release minus one version. Since Go 1.4 has now been released, this commit updates TravisCI to remove Go 1.2 from the build matrix and add Go 1.3. Also, go vet changed locations in between Go 1.3 and Go 1.4, so a check has been added to download the appropriate version based on which version of Go is running the integration tests. Finally, the previous removed Go tip entry in the build matrix has been reintroduced since it will now work again. --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 748c55d6..7271d4d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,11 @@ language: go go: - - 1.2 + - 1.3 - release + - tip install: - go get -d -t -v ./... - - go get -v code.google.com/p/go.tools/cmd/vet + - if [ "$TRAVIS_GO_VERSION" = "1.3" ]; then go get -v code.google.com/p/go.tools/cmd/vet else go get -v golang.org/x/tools/cmd/vet fi - go get -v github.com/GeertJohan/fgt - go get -v github.com/golang/lint/golint script: From d041b80301541bbcf940ce16457f1c730f1c818f Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 11 Dec 2014 11:52:45 -0600 Subject: [PATCH 212/229] Correct recent TravisCI go vet fetch script. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7271d4d2..e0ecfb2d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ go: - tip install: - go get -d -t -v ./... - - if [ "$TRAVIS_GO_VERSION" = "1.3" ]; then go get -v code.google.com/p/go.tools/cmd/vet else go get -v golang.org/x/tools/cmd/vet fi + - if [ "$TRAVIS_GO_VERSION" = "1.3" ]; then go get -v code.google.com/p/go.tools/cmd/vet; else go get -v golang.org/x/tools/cmd/vet; fi - go get -v github.com/GeertJohan/fgt - go get -v github.com/golang/lint/golint script: From 7214218925f33b31e4aba04add7f989a61d9c40a Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 11 Dec 2014 12:20:56 -0600 Subject: [PATCH 213/229] Be more specific in TravisCI go vet version test. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e0ecfb2d..32f8400d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ go: - tip install: - go get -d -t -v ./... - - if [ "$TRAVIS_GO_VERSION" = "1.3" ]; then go get -v code.google.com/p/go.tools/cmd/vet; else go get -v golang.org/x/tools/cmd/vet; fi + - if [ "$TRAVIS_GO_VERSION" = "go1.3.3" ]; then go get -v code.google.com/p/go.tools/cmd/vet; else go get -v golang.org/x/tools/cmd/vet; fi - go get -v github.com/GeertJohan/fgt - go get -v github.com/golang/lint/golint script: From 39d758c2c39841e32a6d34e77840485bf07aea08 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 6 Jan 2015 21:09:02 -0600 Subject: [PATCH 214/229] Fix TravisCI build for Go release version. --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 32f8400d..21402c35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,12 @@ go: - 1.3 - release - tip +before_install: + - gotools=golang.org/x/tools + - if [ "$TRAVIS_GO_VERSION" = "release" ] || [ "$TRAVIS_GO_VERSION" = "go1.3.3" ]; then gotools=code.google.com/p/go.tools; fi install: - go get -d -t -v ./... - - if [ "$TRAVIS_GO_VERSION" = "go1.3.3" ]; then go get -v code.google.com/p/go.tools/cmd/vet; else go get -v golang.org/x/tools/cmd/vet; fi + - go get $gotools/cmd/vet - go get -v github.com/GeertJohan/fgt - go get -v github.com/golang/lint/golint script: From effe99b4b59bb4b1b7b9e969552bfa82e617eff1 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 28 Dec 2014 19:09:32 -0600 Subject: [PATCH 215/229] Correct typo: Unmashal -> Unmarshal --- jsoncmd.go | 156 ++++++++++++++++++++++++++--------------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 00426885..77c7c3a3 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -405,7 +405,7 @@ func (cmd *unparsableCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *unparsableCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -481,7 +481,7 @@ func (cmd *AddMultisigAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *AddMultisigAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -652,7 +652,7 @@ func (cmd *BackupWalletCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *BackupWalletCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -725,7 +725,7 @@ func (cmd *CreateMultisigCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *CreateMultisigCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -814,7 +814,7 @@ func (cmd *CreateRawTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *CreateRawTransactionCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -900,7 +900,7 @@ func (cmd *DebugLevelCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *DebugLevelCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -969,7 +969,7 @@ func (cmd *DecodeRawTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *DecodeRawTransactionCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1038,7 +1038,7 @@ func (cmd *DecodeScriptCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *DecodeScriptCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1107,7 +1107,7 @@ func (cmd *DumpPrivKeyCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *DumpPrivKeyCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1176,7 +1176,7 @@ func (cmd *DumpWalletCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *DumpWalletCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1245,7 +1245,7 @@ func (cmd *EncryptWalletCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *EncryptWalletCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1314,7 +1314,7 @@ func (cmd *EstimateFeeCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *EstimateFeeCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1383,7 +1383,7 @@ func (cmd *EstimatePriorityCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *EstimatePriorityCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1452,7 +1452,7 @@ func (cmd *GetAccountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetAccountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1521,7 +1521,7 @@ func (cmd *GetAccountAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetAccountAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1605,7 +1605,7 @@ func (cmd *GetAddedNodeInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetAddedNodeInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1681,7 +1681,7 @@ func (cmd *GetAddressesByAccountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetAddressesByAccountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1779,7 +1779,7 @@ func (cmd *GetBalanceCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBalanceCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1854,7 +1854,7 @@ func (cmd *GetBestBlockHashCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBestBlockHashCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -1948,7 +1948,7 @@ func (cmd *GetBlockCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBlockCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2027,7 +2027,7 @@ func (cmd *GetBlockChainInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBlockChainInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2085,7 +2085,7 @@ func (cmd *GetBlockCountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBlockCountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2149,7 +2149,7 @@ func (cmd *GetBlockHashCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBlockHashCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2290,7 +2290,7 @@ func (cmd *GetBlockTemplateCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetBlockTemplateCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2357,7 +2357,7 @@ func (cmd *GetConnectionCountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetConnectionCountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2415,7 +2415,7 @@ func (cmd *GetDifficultyCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetDifficultyCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2473,7 +2473,7 @@ func (cmd *GetGenerateCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetGenerateCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2531,7 +2531,7 @@ func (cmd *GetHashesPerSecCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetHashesPerSecCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2589,7 +2589,7 @@ func (cmd *GetInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2647,7 +2647,7 @@ func (cmd *GetMiningInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetMiningInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2705,7 +2705,7 @@ func (cmd *GetNetworkInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetNetworkInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2763,7 +2763,7 @@ func (cmd *GetNetTotalsCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetNetTotalsCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2847,7 +2847,7 @@ func (cmd *GetNetworkHashPSCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetNetworkHashPSCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -2936,7 +2936,7 @@ func (cmd *GetNewAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetNewAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3003,7 +3003,7 @@ func (cmd *GetPeerInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetPeerInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3076,7 +3076,7 @@ func (cmd *GetRawChangeAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetRawChangeAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3157,7 +3157,7 @@ func (cmd *GetRawMempoolCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetRawMempoolCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3242,7 +3242,7 @@ func (cmd *GetRawTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetRawTransactionCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3331,7 +3331,7 @@ func (cmd *GetReceivedByAccountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetReceivedByAccountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3420,7 +3420,7 @@ func (cmd *GetReceivedByAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetReceivedByAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3498,7 +3498,7 @@ func (cmd *GetTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetTransactionCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3581,7 +3581,7 @@ func (cmd *GetTxOutCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetTxOutCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3658,7 +3658,7 @@ func (cmd *GetTxOutSetInfoCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetTxOutSetInfoCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3731,7 +3731,7 @@ func (cmd *GetWorkCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *GetWorkCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3811,7 +3811,7 @@ func (cmd *HelpCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *HelpCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -3913,7 +3913,7 @@ func (cmd *ImportPrivKeyCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ImportPrivKeyCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4000,7 +4000,7 @@ func (cmd *ImportWalletCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ImportWalletCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4070,7 +4070,7 @@ func (cmd *InvalidateBlockCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *InvalidateBlockCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4150,7 +4150,7 @@ func (cmd *KeyPoolRefillCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *KeyPoolRefillCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4232,7 +4232,7 @@ func (cmd *ListAccountsCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListAccountsCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4300,7 +4300,7 @@ func (cmd *ListAddressGroupingsCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListAddressGroupingsCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4359,7 +4359,7 @@ func (cmd *ListLockUnspentCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListLockUnspentCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4451,7 +4451,7 @@ func (cmd *ListReceivedByAccountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListReceivedByAccountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4559,7 +4559,7 @@ func (cmd *ListReceivedByAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListReceivedByAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4667,7 +4667,7 @@ func (cmd *ListSinceBlockCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListSinceBlockCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4789,7 +4789,7 @@ func (cmd *ListTransactionsCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListTransactionsCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -4916,7 +4916,7 @@ func (cmd *ListUnspentCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ListUnspentCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5018,7 +5018,7 @@ func (cmd *LockUnspentCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *LockUnspentCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5135,7 +5135,7 @@ func (cmd *MoveCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *MoveCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5230,7 +5230,7 @@ func (cmd *PingCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *PingCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5295,7 +5295,7 @@ func (cmd *ReconsiderBlockCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ReconsiderBlockCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5416,7 +5416,7 @@ func (cmd *SendFromCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SendFromCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5563,7 +5563,7 @@ func (cmd *SendManyCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SendManyCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5674,7 +5674,7 @@ func (cmd *SendRawTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SendRawTransactionCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5787,7 +5787,7 @@ func (cmd *SendToAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SendToAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5886,7 +5886,7 @@ func (cmd *SetAccountCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SetAccountCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -5973,7 +5973,7 @@ func (cmd *SetGenerateCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SetGenerateCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6052,7 +6052,7 @@ func (cmd *SetTxFeeCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SetTxFeeCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6129,7 +6129,7 @@ func (cmd *SignMessageCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SignMessageCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6256,7 +6256,7 @@ func (cmd *SignRawTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SignRawTransactionCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6346,7 +6346,7 @@ func (cmd *StopCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *StopCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6430,7 +6430,7 @@ func (cmd *SubmitBlockCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *SubmitBlockCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6511,7 +6511,7 @@ func (cmd *ValidateAddressCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *ValidateAddressCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6603,7 +6603,7 @@ func (cmd *VerifyChainCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *VerifyChainCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6693,7 +6693,7 @@ func (cmd *VerifyMessageCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *VerifyMessageCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6768,7 +6768,7 @@ func (cmd *WalletLockCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *WalletLockCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6837,7 +6837,7 @@ func (cmd *WalletPassphraseCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *WalletPassphraseCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err @@ -6916,7 +6916,7 @@ func (cmd *WalletPassphraseChangeCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. func (cmd *WalletPassphraseChangeCmd) UnmarshalJSON(b []byte) error { - // Unmashal into a RawCmd + // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { return err From b9c8ec92d630bcb157e33332c2d7fa587edf85de Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 28 Dec 2014 21:21:40 -0600 Subject: [PATCH 216/229] Add searchrawtransaction --- cmdhelp.go | 45 +++++++ jsonapi.go | 24 ++++ jsonapi_test.go | 6 + jsoncmd.go | 143 +++++++++++++++++++++++ jsoncmd_test.go | 16 +++ jsonresults.go | 27 ++++- jsonresults_test.go | 3 + test_coverage.txt | 279 ++++++++++++++++++++++---------------------- 8 files changed, 403 insertions(+), 140 deletions(-) diff --git a/cmdhelp.go b/cmdhelp.go index 801500dc..ca3e95fe 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -651,6 +651,51 @@ getpeerinfo.`, "reconsiderblock": `reconsiderblock "hash" Remove invalid mark from block specified by "hash" so it is considered again.`, + "searchrawtransaction": `searchrawtransaction "address" (verbose=1 skip=0 count=100) +Returns raw tx data related to credits or debits to "address". Skip indicates +the number of leading transactions to leave out of the final result. Count +represents the max number of transactions to return. If verbose is false, a +string containing hex-encoded serialized data for txid. If verbose is true a +JSON object with the following information about txid is returned: +{ + "hex":"data", # String of serialized, hex encoded data for txid. + "txid":"id", # String containing the transaction id (same as "txid" parameter) + "version":n # Numeric tx version number. + "locktime":t, # Transaction locktime. + "vin":[ # Array of objects representing transaction inputs. + { + "txid":"id", # Spent transaction id as a string. + "vout""n, # Spent transaction output no. + "scriptSig":{ # Signature script as an object. + "asm":"asm", # Disassembled script string. + "hex":"hex", # Hex serialized string. + }, + "sequence":n, # Script sequence number. + }, + ... + ], + vout:[ # Array of objects representing transaction outputs. + { + "value":n, # Numeric value of output in btc. + "n", n, # Numeric output index. + "scriptPubKey":{ # Object representing pubkey script. + "asm":"asm" # Disassembled string of script. + "hex":"hex" # Hex serialized string. + "reqSigs":n, # Number of required signatures. + "type":"pubkey", # Type of scirpt. e.g. pubkeyhash" or "pubkey". + "addresses":[ # Array of address strings. + "address", # Bitcoin address. + ... + ], + } + } + ], + "blockhash":"hash" # Hash of the block the transaction is part of. + "confirmations":n, # Number of numeric confirmations of block. + "time":t, # Transaction time in seconds since the epoch. + "blocktime":t, # Block time in seconds since the epoch. +}`, + "sendfrom": `sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf=1 "comment" "comment-to" ) Sends "amount" (rounded to the nearest 0.00000001) to "tobitcoindaddress" from "fromaccount". Only funds with at least diff --git a/jsonapi.go b/jsonapi.go index 9821e199..22119c4e 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -618,6 +618,30 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ } */ finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), txList}) + // one required string (address), one optional bool, two optional ints. + case "searchrawtransaction": + if len(args) > 4 || len(args) == 0 { + err = fmt.Errorf("wrong number of arguments for %s", message) + return finalMessage, err + } + _, ok1 := args[0].(string) + ok2 := true + ok3 := true + ok4 := true + if len(args) >= 2 { + _, ok2 = args[1].(bool) + } + if len(args) >= 3 { + _, ok3 = args[2].(int) + } + if len(args) == 4 { + _, ok4 = args[3].(int) + } + if !ok1 || !ok2 || !ok3 || !ok4 { + err = fmt.Errorf("arguments must be string, one optional "+ + "bool, and two optional ints for %s", message) + return finalMessage, err + } // Any other message default: err = fmt.Errorf("not a valid command: %s", message) diff --git a/jsonapi_test.go b/jsonapi_test.go index c4e20a27..bb2a608d 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -181,6 +181,12 @@ var cmdtests = []struct { {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", 1, "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", 3, "test4"}, false}, + {"searchrawtransaction", []interface{}{"someaddr"}, true}, + {"searchrawtransaction", []interface{}{"someaddr", true}, true}, + {"searchrawtransaction", []interface{}{"someaddr", false, 1}, true}, + {"searchrawtransaction", []interface{}{"someaddr", true, 5, 500}, true}, + {"searchrawtransaction", []interface{}{"someaddr", true, 5, "test"}, false}, + {"searchrawtransaction", []interface{}{}, false}, {"listsinceblock", []interface{}{"test", "test"}, true}, {"listsinceblock", []interface{}{"test", "test", "test"}, false}, {"listsinceblock", []interface{}{"test"}, true}, diff --git a/jsoncmd.go b/jsoncmd.go index 77c7c3a3..497dd560 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -286,6 +286,9 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "reconsiderblock": cmd = new(ReconsiderBlockCmd) + case "searchrawtransaction": + cmd = new(SearchRawTransactionCmd) + case "sendfrom": cmd = new(SendFromCmd) @@ -5319,6 +5322,146 @@ func (cmd *ReconsiderBlockCmd) UnmarshalJSON(b []byte) error { return nil } +// SearchRawTransactionCmd is a type handling custom marshaling and +// unmarshaling of sendrawtransaction JSON RPC commands. +type SearchRawTransactionCmd struct { + id interface{} + Address string + Verbose bool + Skip int + Count int +} + +// NewSearchRawTransactionCmd creates a new SearchRawTransactionCmd. +func NewSearchRawTransactionCmd(id interface{}, address string, + optArgs ...interface{}) (*SearchRawTransactionCmd, error) { + verbose := true + var skip int + count := 100 + + if len(optArgs) > 3 { + return nil, ErrTooManyOptArgs + } + + if len(optArgs) > 0 { + v, ok := optArgs[0].(bool) + if !ok { + return nil, errors.New("first optional argument verbose is not a bool") + } + + verbose = v + } + if len(optArgs) > 1 { + s, ok := optArgs[1].(int) + if !ok { + return nil, errors.New("second optional argument skip is not an int") + } + skip = s + } + if len(optArgs) > 2 { + c, ok := optArgs[2].(int) + if !ok { + return nil, errors.New("third optional argument count is not an int") + } + + count = c + } + + return &SearchRawTransactionCmd{ + id: id, + Address: address, + Verbose: verbose, + Skip: skip, + Count: count, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *SearchRawTransactionCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *SearchRawTransactionCmd) Method() string { + return "searchrawtransaction" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *SearchRawTransactionCmd) MarshalJSON() ([]byte, error) { + params := make([]interface{}, 1, 4) + params[0] = cmd.Address + if !cmd.Verbose || cmd.Skip != 0 || cmd.Count != 100 { + params = append(params, cmd.Verbose) + } + if cmd.Skip != 0 || cmd.Count != 100 { + params = append(params, cmd.Skip) + } + if cmd.Count != 100 { + params = append(params, cmd.Count) + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *SearchRawTransactionCmd) UnmarshalJSON(b []byte) error { + // Unmarshal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) == 0 || len(r.Params) > 4 { + return ErrWrongNumberOfParams + } + + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) + } + + optArgs := make([]interface{}, 0, 3) + if len(r.Params) > 1 { + var verbose bool + if err := json.Unmarshal(r.Params[1], &verbose); err != nil { + return fmt.Errorf("second optional parameter 'verbose' must be an bool: %v", err) + } + optArgs = append(optArgs, verbose) + } + if len(r.Params) > 2 { + var skip int + if err := json.Unmarshal(r.Params[2], &skip); err != nil { + return fmt.Errorf("third optional parameter 'skip' must be an int: %v", err) + } + optArgs = append(optArgs, skip) + } + if len(r.Params) > 3 { + var count int + if err := json.Unmarshal(r.Params[3], &count); err != nil { + return fmt.Errorf("fourth optional parameter 'count' must be an int: %v", err) + } + optArgs = append(optArgs, count) + } + + newCmd, err := NewSearchRawTransactionCmd(r.Id, address, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// Enforce that SearchRawTransactionCmd satisifies the Cmd interface. +var _ Cmd = &SearchRawTransactionCmd{} + // SendFromCmd is a type handling custom marshaling and // unmarshaling of sendfrom JSON RPC commands. type SendFromCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 1671e55b..1967ad5b 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1204,6 +1204,21 @@ var jsoncmdtests = []struct { BlockHash: "lotsofhex", }, }, + { + name: "basic + optionals", + cmd: "searchrawtransaction", + f: func() (Cmd, error) { + return NewSearchRawTransactionCmd(testID, + "someaddr", true, 5, 200) + }, + result: &SearchRawTransactionCmd{ + id: testID, + Address: "someaddr", + Verbose: true, + Skip: 5, + Count: 200, + }, + }, { name: "basic", cmd: "sendfrom", @@ -1706,6 +1721,7 @@ func TestHelps(t *testing.T) { "move", "ping", "reconsiderblock", + "searchrawtransaction", "sendfrom", "sendmany", "sendrawtransaction", diff --git a/jsonresults.go b/jsonresults.go index 0f970b32..55b751e8 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -217,7 +217,8 @@ type ScriptSig struct { } // Vin models parts of the tx data. It is defined seperately since both -// getrawtransaction and decoderawtransaction use the same structure. +// getrawtransaction, sendrawtransaction, and decoderawtransaction use the +// same structure. type Vin struct { Coinbase string `json:"coinbase"` Txid string `json:"txid"` @@ -269,7 +270,8 @@ type ScriptPubKeyResult struct { } // Vout models parts of the tx data. It is defined seperately since both -// getrawtransaction and decoderawtransaction use the same structure. +// getrawtransaction, sendrawtransaction, and decoderawtransaction use the same +// structure. type Vout struct { Value float64 `json:"value"` N uint32 `json:"n"` @@ -398,7 +400,8 @@ type SignRawTransactionResult struct { Complete bool `json:"complete"` } -// TxRawResult models the data from the getrawtransaction command. +// TxRawResult models the data from the getrawtransaction and sendrawtransaction +// commands type TxRawResult struct { Hex string `json:"hex"` Txid string `json:"txid"` @@ -686,6 +689,24 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { if err == nil { result.Result = res } + + case "searchrawtransaction": + // searchrawtransaction can either return a list of JSON objects + // or a list of hex-encoded strings depending on the verbose flag. + // Choose the right form accordingly. + if bytes.IndexByte(objmap["result"], '{') > -1 { + var res []*TxRawResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } else { + var res []string + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } + } // For commands that return a single item (or no items), we get it with // the correct concrete type for free (but treat them separately // for clarity). diff --git a/jsonresults_test.go b/jsonresults_test.go index 2197093d..b5510e1e 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -61,6 +61,9 @@ var resulttests = []struct { {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, + {"searchrawtransaction", []byte(`{"error":null,"id":1,"result":{"a":"b"}}`), false, false}, + {"searchrawtransaction", []byte(`{"error":null,"id":1,"result":["sometxhex"]}`), false, true}, + {"searchrawtransaction", []byte(`{"error":null,"id":1,"result":[{"hex":"somejunk","version":1}]}`), false, true}, } // TestReadResultCmd tests that readResultCmd can properly unmarshall the diff --git a/test_coverage.txt b/test_coverage.txt index 73731a4a..b489f821 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -3,95 +3,97 @@ github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) +github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (3/3) github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewReconsiderBlockCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewReconsiderBlockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewInvalidateBlockCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) @@ -107,6 +109,7 @@ github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) @@ -116,165 +119,165 @@ github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) +github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.11% (321/334) +github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.29% (337/350) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) +github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.MarshalJSON 91.67% (11/12) github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.54% (85/96) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 88.89% (8/9) +github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.66% (86/97) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) +github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) +github.com/conformal/btcjson/jsoncmd.go NewSearchRawTransactionCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) +github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) @@ -292,54 +295,56 @@ github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.MarshalJSON 80.00 github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) +github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.UnmarshalJSON 75.86% (22/29) github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) +github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) +github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) +github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) @@ -348,23 +353,23 @@ github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/ github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) +github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) @@ -383,20 +388,20 @@ github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) +github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) 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/jsonresults.go ReadResultCmd 64.00% (112/175) 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/jsonresults.go ReadResultCmd 62.05% (103/166) github.com/conformal/btcjson/jsonapi.go rpcCommand 61.54% (8/13) github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.UnmarshalJSON 57.89% (11/19) github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 50.00% (12/24) @@ -416,10 +421,10 @@ github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) +github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go isFloatInt64 0.00% (0/1) github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 77.60% (2380/3067) +github.com/conformal/btcjson --------------------------------------- 77.86% (2458/3157) From 62eb2f219809162ce674e23bdc789ab896da05f2 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Tue, 18 Nov 2014 18:22:10 +0530 Subject: [PATCH 217/229] Accept nil string for account name --- jsoncmd.go | 16 +++++++------- jsoncmd_test.go | 58 ++++++++++++++++++++++++++----------------------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/jsoncmd.go b/jsoncmd.go index 497dd560..d98245b1 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -1712,7 +1712,7 @@ func (cmd *GetAddressesByAccountCmd) UnmarshalJSON(b []byte) error { // unmarshaling of getbalance JSON RPC commands. type GetBalanceCmd struct { id interface{} - Account string + Account *string MinConf int } @@ -1722,7 +1722,7 @@ var _ Cmd = &GetBalanceCmd{} // NewGetBalanceCmd creates a new GetBalanceCmd. Optionally a string for account // and an int for minconf may be provided as arguments. func NewGetBalanceCmd(id interface{}, optArgs ...interface{}) (*GetBalanceCmd, error) { - var account string + var account *string var minconf = 1 if len(optArgs) > 2 { @@ -1733,7 +1733,7 @@ func NewGetBalanceCmd(id interface{}, optArgs ...interface{}) (*GetBalanceCmd, e if !ok { return nil, errors.New("first optional argument account is not a string") } - account = a + account = &a } if len(optArgs) > 1 { @@ -1764,7 +1764,7 @@ func (cmd *GetBalanceCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetBalanceCmd) MarshalJSON() ([]byte, error) { params := make([]interface{}, 0, 2) - if cmd.Account != "" || cmd.MinConf != 1 { + if cmd.Account != nil { params = append(params, cmd.Account) } if cmd.MinConf != 1 { @@ -4709,7 +4709,7 @@ func (cmd *ListSinceBlockCmd) UnmarshalJSON(b []byte) error { // unmarshaling of listtransactions JSON RPC commands. type ListTransactionsCmd struct { id interface{} - Account string + Account *string Count int From int } @@ -4720,7 +4720,7 @@ var _ Cmd = &ListTransactionsCmd{} // NewListTransactionsCmd creates a new ListTransactionsCmd. Optionally a // pointer to a TemplateRequest may be provided. func NewListTransactionsCmd(id interface{}, optArgs ...interface{}) (*ListTransactionsCmd, error) { - account := "" + var account *string count := 10 from := 0 @@ -4732,7 +4732,7 @@ func NewListTransactionsCmd(id interface{}, optArgs ...interface{}) (*ListTransa if !ok { return nil, errors.New("first optional argument account is not a string") } - account = ac + account = &ac } if len(optArgs) > 1 { cnt, ok := optArgs[1].(int) @@ -4771,7 +4771,7 @@ func (cmd *ListTransactionsCmd) Method() string { // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListTransactionsCmd) MarshalJSON() ([]byte, error) { params := make([]interface{}, 0, 3) - if cmd.Account != "" || cmd.Count != 10 || cmd.From != 0 { + if cmd.Account != nil { params = append(params, cmd.Account) } if cmd.Count != 10 || cmd.From != 0 { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index 1967ad5b..fdaee830 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -16,6 +16,9 @@ import ( var testID = float64(1) +var defaultAccount = "" +var testAccount = "account" + var jsoncmdtests = []struct { name string cmd string @@ -33,7 +36,7 @@ var jsoncmdtests = []struct { id: testID, NRequired: 1, Keys: []string{"foo", "bar"}, - Account: "", + Account: defaultAccount, }, }, { @@ -247,11 +250,11 @@ var jsoncmdtests = []struct { cmd: "getaccountaddress", f: func() (Cmd, error) { return NewGetAccountAddressCmd(testID, - "account") + testAccount) }, result: &GetAccountAddressCmd{ id: testID, - Account: "account", + Account: testAccount, }, }, { @@ -294,11 +297,11 @@ var jsoncmdtests = []struct { cmd: "getaddressesbyaccount", f: func() (Cmd, error) { return NewGetAddressesByAccountCmd(testID, - "account") + testAccount) }, result: &GetAddressesByAccountCmd{ id: testID, - Account: "account", + Account: testAccount, }, }, { @@ -316,11 +319,11 @@ var jsoncmdtests = []struct { name: "basic + account", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testID, "account") + return NewGetBalanceCmd(testID, testAccount) }, result: &GetBalanceCmd{ id: testID, - Account: "account", + Account: &testAccount, MinConf: 1, // the default }, }, @@ -328,10 +331,11 @@ var jsoncmdtests = []struct { name: "basic + minconf", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testID, "", 2) + return NewGetBalanceCmd(testID, defaultAccount, 2) }, result: &GetBalanceCmd{ id: testID, + Account: &defaultAccount, MinConf: 2, }, }, @@ -339,11 +343,11 @@ var jsoncmdtests = []struct { name: "basic + account + minconf", cmd: "getbalance", f: func() (Cmd, error) { - return NewGetBalanceCmd(testID, "account", 2) + return NewGetBalanceCmd(testID, testAccount, 2) }, result: &GetBalanceCmd{ id: testID, - Account: "account", + Account: &testAccount, MinConf: 2, }, }, @@ -570,11 +574,11 @@ var jsoncmdtests = []struct { name: "basic", cmd: "getnewaddress", f: func() (Cmd, error) { - return NewGetNewAddressCmd(testID, "account") + return NewGetNewAddressCmd(testID, testAccount) }, result: &GetNewAddressCmd{ id: testID, - Account: "account", + Account: testAccount, }, }, { @@ -1050,7 +1054,7 @@ var jsoncmdtests = []struct { }, result: &ListTransactionsCmd{ id: testID, - Account: "", + Account: nil, Count: 10, From: 0, }, @@ -1059,11 +1063,11 @@ var jsoncmdtests = []struct { name: "+ 1 optarg", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testID, "abcde") + return NewListTransactionsCmd(testID, testAccount) }, result: &ListTransactionsCmd{ id: testID, - Account: "abcde", + Account: &testAccount, Count: 10, From: 0, }, @@ -1072,11 +1076,11 @@ var jsoncmdtests = []struct { name: "+ 2 optargs", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testID, "abcde", 123) + return NewListTransactionsCmd(testID, testAccount, 123) }, result: &ListTransactionsCmd{ id: testID, - Account: "abcde", + Account: &testAccount, Count: 123, From: 0, }, @@ -1085,11 +1089,11 @@ var jsoncmdtests = []struct { name: "+ 3 optargs", cmd: "listtransactions", f: func() (Cmd, error) { - return NewListTransactionsCmd(testID, "abcde", 123, 456) + return NewListTransactionsCmd(testID, testAccount, 123, 456) }, result: &ListTransactionsCmd{ id: testID, - Account: "abcde", + Account: &testAccount, Count: 123, From: 456, }, @@ -1224,14 +1228,14 @@ var jsoncmdtests = []struct { cmd: "sendfrom", f: func() (Cmd, error) { return NewSendFromCmd(testID, - "account", + testAccount, "address", 12, 1) }, result: &SendFromCmd{ id: testID, - FromAccount: "account", + FromAccount: testAccount, ToAddress: "address", Amount: 12, MinConf: 1, // the default @@ -1242,7 +1246,7 @@ var jsoncmdtests = []struct { cmd: "sendfrom", f: func() (Cmd, error) { return NewSendFromCmd(testID, - "account", + testAccount, "address", 12, 1, @@ -1251,7 +1255,7 @@ var jsoncmdtests = []struct { }, result: &SendFromCmd{ id: testID, - FromAccount: "account", + FromAccount: testAccount, ToAddress: "address", Amount: 12, MinConf: 1, // the default @@ -1269,12 +1273,12 @@ var jsoncmdtests = []struct { "address C": 3000, } return NewSendManyCmd(testID, - "account", + testAccount, pairs) }, result: &SendManyCmd{ id: testID, - FromAccount: "account", + FromAccount: testAccount, Amounts: map[string]int64{ "address A": 1000, "address B": 2000, @@ -1293,14 +1297,14 @@ var jsoncmdtests = []struct { "address C": 3000, } return NewSendManyCmd(testID, - "account", + testAccount, pairs, 10, "comment") }, result: &SendManyCmd{ id: testID, - FromAccount: "account", + FromAccount: testAccount, Amounts: map[string]int64{ "address A": 1000, "address B": 2000, From b94598da551c45887de16d96634ed09163a9dcbc Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 15 Jan 2015 11:40:18 -0800 Subject: [PATCH 218/229] Remove `omitempty` fromTxRawResult confirmations * Previously both searchrawtransaction and getrawtransaction would omit the 'Confirmations' field by default if the transaction was found in the mempool. * By removing `omitempty`, a mempool transaction will now have 'Confirmations:0' --- jsonresults.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonresults.go b/jsonresults.go index 55b751e8..f8098e4c 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -410,7 +410,7 @@ type TxRawResult struct { Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` BlockHash string `json:"blockhash,omitempty"` - Confirmations uint64 `json:"confirmations,omitempty"` + Confirmations uint64 `json:"confirmations"` Time int64 `json:"time,omitempty"` Blocktime int64 `json:"blocktime,omitempty"` } From 578d1debc5a33c908a547a5460131663ef4b0c42 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 16 Jan 2015 23:49:20 -0600 Subject: [PATCH 219/229] Update btcjson import paths to new location. --- README.md | 10 +++++----- jsonapi_test.go | 2 +- jsonfxns_test.go | 2 +- jsonresults_test.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e0794bed..6621aba5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ btcjson ======= -[![Build Status](https://travis-ci.org/conformal/btcjson.png?branch=master)] -(https://travis-ci.org/conformal/btcjson) +[![Build Status](https://travis-ci.org/btcsuite/btcjson.png?branch=master)] +(https://travis-ci.org/btcsuite/btcjson) Package btcjson implements the bitcoin JSON-RPC API. There is a test suite which is aiming to reach 100% code coverage. See @@ -46,16 +46,16 @@ useful Go data structures). Full `go doc` style documentation for the project can be viewed online without installing this package by using the GoDoc site -[here](http://godoc.org/github.com/conformal/btcjson). +[here](http://godoc.org/github.com/btcsuite/btcjson). You can also view the documentation locally once the package is installed with the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to -http://localhost:6060/pkg/github.com/conformal/btcjson +http://localhost:6060/pkg/github.com/btcsuite/btcjson ## Installation ```bash -$ go get github.com/conformal/btcjson +$ go get github.com/btcsuite/btcjson ``` ## TODO diff --git a/jsonapi_test.go b/jsonapi_test.go index bb2a608d..3ec97df5 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -11,7 +11,7 @@ import ( "io/ioutil" "testing" - "github.com/conformal/btcjson" + "github.com/btcsuite/btcjson" ) // cmdtests is a table of all the possible commands and a list of inputs, diff --git a/jsonfxns_test.go b/jsonfxns_test.go index 31bb93aa..ffe845a9 100644 --- a/jsonfxns_test.go +++ b/jsonfxns_test.go @@ -9,7 +9,7 @@ import ( "fmt" "testing" - "github.com/conformal/btcjson" + "github.com/btcsuite/btcjson" ) // TestMarshallAndSend tests the MarshallAndSend function to make sure it can diff --git a/jsonresults_test.go b/jsonresults_test.go index b5510e1e..1bac3196 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -9,7 +9,7 @@ import ( "encoding/json" "testing" - "github.com/conformal/btcjson" + "github.com/btcsuite/btcjson" ) var resulttests = []struct { From dc4989461a826fb68c15972716bd21d4dd26d4f7 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 26 Jan 2015 18:50:06 -0800 Subject: [PATCH 220/229] Add new logging subsystem ADXR to debuglevel help --- cmdhelp.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmdhelp.go b/cmdhelp.go index ca3e95fe..f0534f66 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -54,6 +54,7 @@ Alternatively levelspec may be a specification of the form: =,= Where the valid subsystem names are: AMGR, +ADXR, BCDB, BMGR, BTCD, From 1b57f5bf8787714b6363feed6e4e236235ca798d Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 5 Feb 2015 11:35:18 -0800 Subject: [PATCH 221/229] Change searchrawtransaction to be compatible with bitcoind * Pluralise `searchrawtransaction` -> `searchrawtransactions` * Change the `verbose` parameter from a bool to an int. --- cmdhelp.go | 2 +- jsonapi.go | 4 ++-- jsonapi_test.go | 12 ++++++------ jsoncmd.go | 48 ++++++++++++++++++++++----------------------- jsoncmd_test.go | 12 ++++++------ jsonresults.go | 4 ++-- jsonresults_test.go | 6 +++--- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/cmdhelp.go b/cmdhelp.go index f0534f66..5b4a2643 100644 --- a/cmdhelp.go +++ b/cmdhelp.go @@ -652,7 +652,7 @@ getpeerinfo.`, "reconsiderblock": `reconsiderblock "hash" Remove invalid mark from block specified by "hash" so it is considered again.`, - "searchrawtransaction": `searchrawtransaction "address" (verbose=1 skip=0 count=100) + "searchrawtransactions": `searchrawtransactions "address" (verbose=1 skip=0 count=100) Returns raw tx data related to credits or debits to "address". Skip indicates the number of leading transactions to leave out of the final result. Count represents the max number of transactions to return. If verbose is false, a diff --git a/jsonapi.go b/jsonapi.go index 22119c4e..7d4693c9 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -619,7 +619,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ */ finalMessage, err = jsonWithArgs(message, id, []interface{}{args[0].(string), txList}) // one required string (address), one optional bool, two optional ints. - case "searchrawtransaction": + case "searchrawtransactions": if len(args) > 4 || len(args) == 0 { err = fmt.Errorf("wrong number of arguments for %s", message) return finalMessage, err @@ -629,7 +629,7 @@ func CreateMessageWithId(message string, id interface{}, args ...interface{}) ([ ok3 := true ok4 := true if len(args) >= 2 { - _, ok2 = args[1].(bool) + _, ok2 = args[1].(int) } if len(args) >= 3 { _, ok3 = args[2].(int) diff --git a/jsonapi_test.go b/jsonapi_test.go index 3ec97df5..bf91880b 100644 --- a/jsonapi_test.go +++ b/jsonapi_test.go @@ -181,12 +181,12 @@ var cmdtests = []struct { {"signrawtransaction", []interface{}{1.2, "test", "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", 1, "test2", "test3", "test4"}, false}, {"signrawtransaction", []interface{}{"hexstring", "test", "test2", 3, "test4"}, false}, - {"searchrawtransaction", []interface{}{"someaddr"}, true}, - {"searchrawtransaction", []interface{}{"someaddr", true}, true}, - {"searchrawtransaction", []interface{}{"someaddr", false, 1}, true}, - {"searchrawtransaction", []interface{}{"someaddr", true, 5, 500}, true}, - {"searchrawtransaction", []interface{}{"someaddr", true, 5, "test"}, false}, - {"searchrawtransaction", []interface{}{}, false}, + {"searchrawtransactions", []interface{}{"someaddr"}, true}, + {"searchrawtransactions", []interface{}{"someaddr", 1}, true}, + {"searchrawtransactions", []interface{}{"someaddr", 0, 1}, true}, + {"searchrawtransactions", []interface{}{"someaddr", 1, 5, 500}, true}, + {"searchrawtransactions", []interface{}{"someaddr", 1, 5, "test"}, false}, + {"searchrawtransactions", []interface{}{}, false}, {"listsinceblock", []interface{}{"test", "test"}, true}, {"listsinceblock", []interface{}{"test", "test", "test"}, false}, {"listsinceblock", []interface{}{"test"}, true}, diff --git a/jsoncmd.go b/jsoncmd.go index d98245b1..6241a1e2 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -286,8 +286,8 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "reconsiderblock": cmd = new(ReconsiderBlockCmd) - case "searchrawtransaction": - cmd = new(SearchRawTransactionCmd) + case "searchrawtransactions": + cmd = new(SearchRawTransactionsCmd) case "sendfrom": cmd = new(SendFromCmd) @@ -5322,21 +5322,21 @@ func (cmd *ReconsiderBlockCmd) UnmarshalJSON(b []byte) error { return nil } -// SearchRawTransactionCmd is a type handling custom marshaling and -// unmarshaling of sendrawtransaction JSON RPC commands. -type SearchRawTransactionCmd struct { +// SearchRawTransactionsCmd is a type handling custom marshaling and +// unmarshaling of sendrawtransactions JSON RPC commands. +type SearchRawTransactionsCmd struct { id interface{} Address string - Verbose bool + Verbose int Skip int Count int } -// NewSearchRawTransactionCmd creates a new SearchRawTransactionCmd. -func NewSearchRawTransactionCmd(id interface{}, address string, - optArgs ...interface{}) (*SearchRawTransactionCmd, error) { - verbose := true +// NewSearchRawTransactionsCmd creates a new SearchRawTransactionsCmd. +func NewSearchRawTransactionsCmd(id interface{}, address string, + optArgs ...interface{}) (*SearchRawTransactionsCmd, error) { var skip int + verbose := 1 count := 100 if len(optArgs) > 3 { @@ -5344,9 +5344,9 @@ func NewSearchRawTransactionCmd(id interface{}, address string, } if len(optArgs) > 0 { - v, ok := optArgs[0].(bool) + v, ok := optArgs[0].(int) if !ok { - return nil, errors.New("first optional argument verbose is not a bool") + return nil, errors.New("first optional argument verbose is not a int") } verbose = v @@ -5367,7 +5367,7 @@ func NewSearchRawTransactionCmd(id interface{}, address string, count = c } - return &SearchRawTransactionCmd{ + return &SearchRawTransactionsCmd{ id: id, Address: address, Verbose: verbose, @@ -5377,20 +5377,20 @@ func NewSearchRawTransactionCmd(id interface{}, address string, } // Id satisfies the Cmd interface by returning the id of the command. -func (cmd *SearchRawTransactionCmd) Id() interface{} { +func (cmd *SearchRawTransactionsCmd) Id() interface{} { return cmd.id } // Method satisfies the Cmd interface by returning the json method. -func (cmd *SearchRawTransactionCmd) Method() string { - return "searchrawtransaction" +func (cmd *SearchRawTransactionsCmd) Method() string { + return "searchrawtransactions" } // MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. -func (cmd *SearchRawTransactionCmd) MarshalJSON() ([]byte, error) { +func (cmd *SearchRawTransactionsCmd) MarshalJSON() ([]byte, error) { params := make([]interface{}, 1, 4) params[0] = cmd.Address - if !cmd.Verbose || cmd.Skip != 0 || cmd.Count != 100 { + if cmd.Verbose != 1 || cmd.Skip != 0 || cmd.Count != 100 { params = append(params, cmd.Verbose) } if cmd.Skip != 0 || cmd.Count != 100 { @@ -5411,7 +5411,7 @@ func (cmd *SearchRawTransactionCmd) MarshalJSON() ([]byte, error) { // UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of // the Cmd interface. -func (cmd *SearchRawTransactionCmd) UnmarshalJSON(b []byte) error { +func (cmd *SearchRawTransactionsCmd) UnmarshalJSON(b []byte) error { // Unmarshal into a RawCmd var r RawCmd if err := json.Unmarshal(b, &r); err != nil { @@ -5429,9 +5429,9 @@ func (cmd *SearchRawTransactionCmd) UnmarshalJSON(b []byte) error { optArgs := make([]interface{}, 0, 3) if len(r.Params) > 1 { - var verbose bool + var verbose int if err := json.Unmarshal(r.Params[1], &verbose); err != nil { - return fmt.Errorf("second optional parameter 'verbose' must be an bool: %v", err) + return fmt.Errorf("second optional parameter 'verbose' must be an int: %v", err) } optArgs = append(optArgs, verbose) } @@ -5450,7 +5450,7 @@ func (cmd *SearchRawTransactionCmd) UnmarshalJSON(b []byte) error { optArgs = append(optArgs, count) } - newCmd, err := NewSearchRawTransactionCmd(r.Id, address, optArgs...) + newCmd, err := NewSearchRawTransactionsCmd(r.Id, address, optArgs...) if err != nil { return err } @@ -5459,8 +5459,8 @@ func (cmd *SearchRawTransactionCmd) UnmarshalJSON(b []byte) error { return nil } -// Enforce that SearchRawTransactionCmd satisifies the Cmd interface. -var _ Cmd = &SearchRawTransactionCmd{} +// Enforce that SearchRawTransactionsCmd satisifies the Cmd interface. +var _ Cmd = &SearchRawTransactionsCmd{} // SendFromCmd is a type handling custom marshaling and // unmarshaling of sendfrom JSON RPC commands. diff --git a/jsoncmd_test.go b/jsoncmd_test.go index fdaee830..bf719cb7 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -1210,15 +1210,15 @@ var jsoncmdtests = []struct { }, { name: "basic + optionals", - cmd: "searchrawtransaction", + cmd: "searchrawtransactions", f: func() (Cmd, error) { - return NewSearchRawTransactionCmd(testID, - "someaddr", true, 5, 200) + return NewSearchRawTransactionsCmd(testID, + "someaddr", 1, 5, 200) }, - result: &SearchRawTransactionCmd{ + result: &SearchRawTransactionsCmd{ id: testID, Address: "someaddr", - Verbose: true, + Verbose: 1, Skip: 5, Count: 200, }, @@ -1725,7 +1725,7 @@ func TestHelps(t *testing.T) { "move", "ping", "reconsiderblock", - "searchrawtransaction", + "searchrawtransactions", "sendfrom", "sendmany", "sendrawtransaction", diff --git a/jsonresults.go b/jsonresults.go index f8098e4c..b4f6f51d 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -690,8 +690,8 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { result.Result = res } - case "searchrawtransaction": - // searchrawtransaction can either return a list of JSON objects + case "searchrawtransactions": + // searchrawtransactions can either return a list of JSON objects // or a list of hex-encoded strings depending on the verbose flag. // Choose the right form accordingly. if bytes.IndexByte(objmap["result"], '{') > -1 { diff --git a/jsonresults_test.go b/jsonresults_test.go index 1bac3196..83d7f07e 100644 --- a/jsonresults_test.go +++ b/jsonresults_test.go @@ -61,9 +61,9 @@ var resulttests = []struct { {"signrawtransaction", []byte(`{"error":null,"id":1,"result":{false}}`), false, false}, {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid":"something"}]}`), false, true}, {"listunspent", []byte(`{"error":null,"id":1,"result":[{"txid"}]}`), false, false}, - {"searchrawtransaction", []byte(`{"error":null,"id":1,"result":{"a":"b"}}`), false, false}, - {"searchrawtransaction", []byte(`{"error":null,"id":1,"result":["sometxhex"]}`), false, true}, - {"searchrawtransaction", []byte(`{"error":null,"id":1,"result":[{"hex":"somejunk","version":1}]}`), false, true}, + {"searchrawtransactions", []byte(`{"error":null,"id":1,"result":{"a":"b"}}`), false, false}, + {"searchrawtransactions", []byte(`{"error":null,"id":1,"result":["sometxhex"]}`), false, true}, + {"searchrawtransactions", []byte(`{"error":null,"id":1,"result":[{"hex":"somejunk","version":1}]}`), false, true}, } // TestReadResultCmd tests that readResultCmd can properly unmarshall the From 316d92d613a8adfe69a428645774c3b3a974f202 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 6 Feb 2015 10:00:34 -0500 Subject: [PATCH 222/229] Update Go versions for Travis. Also use Travis' container-based build infrastructure. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21402c35..c0233368 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: go go: - - 1.3 - - release - - tip + - 1.3.3 + - 1.4.1 +sudo: false before_install: - gotools=golang.org/x/tools - if [ "$TRAVIS_GO_VERSION" = "release" ] || [ "$TRAVIS_GO_VERSION" = "go1.3.3" ]; then gotools=code.google.com/p/go.tools; fi From 78e2c8401beca63ebec3c708b65e50fc2d27b589 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Tue, 27 Jan 2015 14:08:03 +0530 Subject: [PATCH 223/229] Added new cmds importaddress, importpubkey --- jsoncmd.go | 194 ++++++++++++++++++++++++++++++++++++++++++++++++ jsoncmd_test.go | 52 +++++++++++++ 2 files changed, 246 insertions(+) diff --git a/jsoncmd.go b/jsoncmd.go index 6241a1e2..e1812a22 100644 --- a/jsoncmd.go +++ b/jsoncmd.go @@ -238,6 +238,12 @@ func ParseMarshaledCmd(b []byte) (Cmd, error) { case "help": cmd = new(HelpCmd) + case "importaddress": + cmd = new(ImportAddressCmd) + + case "importpubkey": + cmd = new(ImportPubKeyCmd) + case "importprivkey": cmd = new(ImportPrivKeyCmd) @@ -3842,6 +3848,194 @@ func (cmd *HelpCmd) UnmarshalJSON(b []byte) error { return nil } +// ImportAddressCmd is a type handling custom marshaling and +// unmarshaling of importaddress JSON RPC commands. +type ImportAddressCmd struct { + id interface{} + Address string + Rescan bool +} + +// Enforce that ImportAddressCmd satisifies the Cmd interface. +var _ Cmd = &ImportAddressCmd{} + +// NewImportAddressCmd creates a new ImportAddressCmd. +func NewImportAddressCmd(id interface{}, address string, optArgs ...interface{}) (*ImportAddressCmd, error) { + rescan := true + var ok bool + + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + if len(optArgs) > 0 { + rescan, ok = optArgs[0].(bool) + if !ok { + return nil, errors.New("first optional argument rescan is not a bool") + } + } + return &ImportAddressCmd{ + id: id, + Address: address, + Rescan: rescan, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ImportAddressCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ImportAddressCmd) Method() string { + return "importaddress" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ImportAddressCmd) MarshalJSON() ([]byte, error) { + params := make([]interface{}, 1, 2) + params[0] = cmd.Address + if !cmd.Rescan { + params = append(params, cmd.Rescan) + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ImportAddressCmd) UnmarshalJSON(b []byte) error { + // Unmarshal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) == 0 || len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + var address string + if err := json.Unmarshal(r.Params[0], &address); err != nil { + return fmt.Errorf("first parameter 'address' must be a string: %v", err) + } + + var optArgs []interface{} + if len(r.Params) > 1 { + var rescan bool + if err := json.Unmarshal(r.Params[1], &rescan); err != nil { + return fmt.Errorf("first optional parameter 'rescan' must be a bool: %v", err) + } + optArgs = append(optArgs, rescan) + } + + newCmd, err := NewImportAddressCmd(r.Id, address, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + +// ImportPubKeyCmd is a type handling custom marshaling and +// unmarshaling of importpubkey JSON RPC commands. +type ImportPubKeyCmd struct { + id interface{} + PubKey string + Rescan bool +} + +// Enforce that ImportPubKeyCmd satisifies the Cmd interface. +var _ Cmd = &ImportPubKeyCmd{} + +// NewImportPubKeyCmd creates a new ImportPubKeyCmd. +func NewImportPubKeyCmd(id interface{}, pubkey string, optArgs ...interface{}) (*ImportPubKeyCmd, error) { + rescan := true + var ok bool + + if len(optArgs) > 1 { + return nil, ErrTooManyOptArgs + } + if len(optArgs) > 0 { + rescan, ok = optArgs[0].(bool) + if !ok { + return nil, errors.New("first optional argument rescan is not a bool") + } + } + return &ImportPubKeyCmd{ + id: id, + PubKey: pubkey, + Rescan: rescan, + }, nil +} + +// Id satisfies the Cmd interface by returning the id of the command. +func (cmd *ImportPubKeyCmd) Id() interface{} { + return cmd.id +} + +// Method satisfies the Cmd interface by returning the json method. +func (cmd *ImportPubKeyCmd) Method() string { + return "importpubkey" +} + +// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. +func (cmd *ImportPubKeyCmd) MarshalJSON() ([]byte, error) { + params := make([]interface{}, 1, 2) + params[0] = cmd.PubKey + if !cmd.Rescan { + params = append(params, cmd.Rescan) + } + + // Fill and marshal a RawCmd. + raw, err := NewRawCmd(cmd.id, cmd.Method(), params) + if err != nil { + return nil, err + } + return json.Marshal(raw) +} + +// UnmarshalJSON unmarshals the JSON encoding of cmd into cmd. Part of +// the Cmd interface. +func (cmd *ImportPubKeyCmd) UnmarshalJSON(b []byte) error { + // Unmarshal into a RawCmd + var r RawCmd + if err := json.Unmarshal(b, &r); err != nil { + return err + } + + if len(r.Params) == 0 || len(r.Params) > 2 { + return ErrWrongNumberOfParams + } + + var pubkey string + if err := json.Unmarshal(r.Params[0], &pubkey); err != nil { + return fmt.Errorf("first parameter 'pubkey' must be a string: %v", err) + } + + var optArgs []interface{} + if len(r.Params) > 1 { + var rescan bool + if err := json.Unmarshal(r.Params[1], &rescan); err != nil { + return fmt.Errorf("first optional parameter 'rescan' must be a bool: %v", err) + } + optArgs = append(optArgs, rescan) + } + + newCmd, err := NewImportPubKeyCmd(r.Id, pubkey, optArgs...) + if err != nil { + return err + } + + *cmd = *newCmd + return nil +} + // ImportPrivKeyCmd is a type handling custom marshaling and // unmarshaling of importprivkey JSON RPC commands. type ImportPrivKeyCmd struct { diff --git a/jsoncmd_test.go b/jsoncmd_test.go index bf719cb7..c8e9fdca 100644 --- a/jsoncmd_test.go +++ b/jsoncmd_test.go @@ -812,6 +812,58 @@ var jsoncmdtests = []struct { Command: "getinfo", }, }, + { + name: "basic", + cmd: "importaddress", + f: func() (Cmd, error) { + return NewImportAddressCmd(testID, + "address") + }, + result: &ImportAddressCmd{ + id: testID, + Address: "address", + Rescan: true, + }, + }, + { + name: "basic + optional cmd", + cmd: "importaddress", + f: func() (Cmd, error) { + return NewImportAddressCmd(testID, + "address", false) + }, + result: &ImportAddressCmd{ + id: testID, + Address: "address", + Rescan: false, + }, + }, + { + name: "basic", + cmd: "importpubkey", + f: func() (Cmd, error) { + return NewImportPubKeyCmd(testID, + "pubkey") + }, + result: &ImportPubKeyCmd{ + id: testID, + PubKey: "pubkey", + Rescan: true, + }, + }, + { + name: "basic + optional cmd", + cmd: "importpubkey", + f: func() (Cmd, error) { + return NewImportPubKeyCmd(testID, + "pubkey", false) + }, + result: &ImportPubKeyCmd{ + id: testID, + PubKey: "pubkey", + Rescan: false, + }, + }, { name: "basic", cmd: "importprivkey", From fca277e194ced12d09f754d24d31e772489884ae Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 14 Feb 2015 14:17:56 -0800 Subject: [PATCH 224/229] Extend getpeerinfo result with current block height. * This adds support for displaying the progress of dynamically updating the current height of connected peers. --- jsonresults.go | 1 + 1 file changed, 1 insertion(+) diff --git a/jsonresults.go b/jsonresults.go index b4f6f51d..54a4a636 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -151,6 +151,7 @@ type GetPeerInfoResult struct { SubVer string `json:"subver"` Inbound bool `json:"inbound"` StartingHeight int32 `json:"startingheight"` + CurrentHeight int32 `json:"currentheight,omitempty"` BanScore int32 `json:"banscore,omitempty"` SyncNode bool `json:"syncnode"` } From cb7c24141aee94f82adb57d6dd0c9fa2b45c1043 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 31 Dec 2014 01:05:03 -0600 Subject: [PATCH 225/229] Reimagine btcjson package with version 2. This commit implements a reimagining of the way the btcjson package functions based upon how the project has evolved and lessons learned while using it since it was first written. It therefore contains significant changes to the API. For now, it has been implemented in a v2 subdirectory to prevent breaking existing callers, but the ultimate goal is to update all callers to use the new version and then to replace the old API with the new one. This also removes the need for the btcws completely since those commands have been rolled in. The following is an overview of the changes and some reasoning behind why they were made: - The infrastructure has been completely changed to be reflection based instead of requiring thousands and thousands of lines of manual, and therefore error prone, marshal/unmarshal code - This makes it much easier to add new commands without making marshalling mistakes since it is simply a struct definition and a call to register that new struct (plus a trivial NewCmd function and tests, of course) - It also makes it much easier to gain a lot of information from simply looking at the struct definition which was previously not possible such as the order of the parameters, which parameters are required versus optional, and what the default values for optional parameters are - Each command now has usage flags associated with them that can be queried which are intended to allow classification of the commands such as for chain server and wallet server and websocket-only - The help infrastructure has been completely redone to provide automatic generation with caller provided description map and result types. This is in contrast to the previous method of providing the help directly which meant it would end up in the binary of anything that imported the package - Many of the structs have been renamed to use the terminology from the JSON-RPC specification: - RawCmd/Message is now only a single struct named Request to reflect the fact it is a JSON-RPC request - Error is now called RPCError to reflect the fact it is specifically an RPC error as opposed to many of the other errors that are possible - All RPC error codes except the standard JSON-RPC 2.0 errors have been converted from full structs to only codes since an audit of the codebase has shown that the messages are overridden the vast majority of the time with specifics (as they should be) and removing them also avoids the temptation to return non-specific, and therefore not as helpful, error messages - There is now an Error which provides a type assertable error with error codes so callers can better ascertain failure reasons programatically - The ID is no longer a part of the command and is instead specified at the time the command is marshalled into a JSON-RPC request. This aligns better with the way JSON-RPC functions since it is the caller who manages the ID that is sent with any given _request_, not the package - All Cmd structs now treat non-pointers as required fields and pointers as optional fields - All NewCmd functions now accept the exact number of parameters, with pointers to the appropriate type for optional parameters - This is preferrable to the old vararg syntax since it means the code will fail to compile if the optional arguments are changed now which helps prevent errors creep in over time from missed modifications to optional args - All of the connection related code has been completely eliminated since this package is not intended to used a client, rather it is intended to provide the infrastructure needed to marshal/unmarshal Bitcoin-specific JSON-RPC requests and replies from static types - The btcrpcclient package provides a robust client with connection management and higher-level types that in turn uses the primitives provided by this package - Even if the caller does not wish to use btcrpcclient for some reason, they should still be responsible for connection management since they might want to use any number of connection features which the package would not necessarily support - Synced a few of the commands that have added new optional fields that have since been added to Bitcoin Core - Includes all of the commands and notifications that were previously in btcws - Now provides 100% test coverage with parallel tests - The code is completely golint and go vet clean This has the side effect of addressing nearly everything in, and therefore closes #26. Also fixes #18 and closes #19. --- README.md | 59 +- v2/btcjson/btcdextcmds.go | 50 ++ v2/btcjson/btcdextcmds_test.go | 134 +++ v2/btcjson/btcwalletextcmds.go | 104 +++ v2/btcjson/btcwalletextcmds_test.go | 208 +++++ v2/btcjson/chainsvrcmds.go | 697 +++++++++++++++ v2/btcjson/chainsvrcmds_test.go | 988 +++++++++++++++++++++ v2/btcjson/chainsvrresults.go | 338 ++++++++ v2/btcjson/chainsvrresults_test.go | 63 ++ v2/btcjson/chainsvrwscmds.go | 128 +++ v2/btcjson/chainsvrwscmds_test.go | 213 +++++ v2/btcjson/chainsvrwsntfns.go | 192 ++++ v2/btcjson/chainsvrwsntfns_test.go | 251 ++++++ v2/btcjson/cmdinfo.go | 249 ++++++ v2/btcjson/cmdinfo_test.go | 430 +++++++++ v2/btcjson/cmdparse.go | 550 ++++++++++++ v2/btcjson/cmdparse_test.go | 519 +++++++++++ v2/btcjson/error.go | 111 +++ v2/btcjson/error_test.go | 80 ++ v2/btcjson/export_test.go | 48 + v2/btcjson/help.go | 562 ++++++++++++ v2/btcjson/helpers.go | 69 ++ v2/btcjson/helpers_test.go | 115 +++ v2/btcjson/jsonrpc.go | 150 ++++ v2/btcjson/jsonrpc_test.go | 161 ++++ v2/btcjson/jsonrpcerr.go | 83 ++ v2/btcjson/register.go | 292 +++++++ v2/btcjson/register_test.go | 263 ++++++ v2/btcjson/walletsvrcmds.go | 675 +++++++++++++++ v2/btcjson/walletsvrcmds_test.go | 1250 +++++++++++++++++++++++++++ v2/btcjson/walletsvrresults.go | 138 +++ v2/btcjson/walletsvrwscmds.go | 128 +++ v2/btcjson/walletsvrwscmds_test.go | 259 ++++++ v2/btcjson/walletsvrwsntfns.go | 95 ++ v2/btcjson/walletsvrwsntfns_test.go | 179 ++++ 35 files changed, 9809 insertions(+), 22 deletions(-) create mode 100644 v2/btcjson/btcdextcmds.go create mode 100644 v2/btcjson/btcdextcmds_test.go create mode 100644 v2/btcjson/btcwalletextcmds.go create mode 100644 v2/btcjson/btcwalletextcmds_test.go create mode 100644 v2/btcjson/chainsvrcmds.go create mode 100644 v2/btcjson/chainsvrcmds_test.go create mode 100644 v2/btcjson/chainsvrresults.go create mode 100644 v2/btcjson/chainsvrresults_test.go create mode 100644 v2/btcjson/chainsvrwscmds.go create mode 100644 v2/btcjson/chainsvrwscmds_test.go create mode 100644 v2/btcjson/chainsvrwsntfns.go create mode 100644 v2/btcjson/chainsvrwsntfns_test.go create mode 100644 v2/btcjson/cmdinfo.go create mode 100644 v2/btcjson/cmdinfo_test.go create mode 100644 v2/btcjson/cmdparse.go create mode 100644 v2/btcjson/cmdparse_test.go create mode 100644 v2/btcjson/error.go create mode 100644 v2/btcjson/error_test.go create mode 100644 v2/btcjson/export_test.go create mode 100644 v2/btcjson/help.go create mode 100644 v2/btcjson/helpers.go create mode 100644 v2/btcjson/helpers_test.go create mode 100644 v2/btcjson/jsonrpc.go create mode 100644 v2/btcjson/jsonrpc_test.go create mode 100644 v2/btcjson/jsonrpcerr.go create mode 100644 v2/btcjson/register.go create mode 100644 v2/btcjson/register_test.go create mode 100644 v2/btcjson/walletsvrcmds.go create mode 100644 v2/btcjson/walletsvrcmds_test.go create mode 100644 v2/btcjson/walletsvrresults.go create mode 100644 v2/btcjson/walletsvrwscmds.go create mode 100644 v2/btcjson/walletsvrwscmds_test.go create mode 100644 v2/btcjson/walletsvrwsntfns.go create mode 100644 v2/btcjson/walletsvrwsntfns_test.go diff --git a/README.md b/README.md index 6621aba5..18bd230c 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,31 @@ btcjson [![Build Status](https://travis-ci.org/btcsuite/btcjson.png?branch=master)] (https://travis-ci.org/btcsuite/btcjson) -Package btcjson implements the bitcoin JSON-RPC API. There is a test -suite which is aiming to reach 100% code coverage. See -`test_coverage.txt` for the current coverage (using gocov). On a -UNIX-like OS, the script `cov_report.sh` can be used to generate the -report. Package btcjson is licensed under the liberal ISC license. +Package btcjson implements concrete types for marshalling to and from the +bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure +proper functionality. Package btcjson is licensed under the copyfree ISC +license. This package is one of the core packages from btcd, an alternative full-node implementation of bitcoin which is under active development by Conformal. Although it was primarily written for btcd, this package has intentionally been designed so it can be used as a standalone package for any projects needing to -communicate with a bitcoin client using the json rpc interface. -[BlockSafari](http://blocksafari.com) is one such program that uses -btcjson to communicate with btcd (or bitcoind to help test btcd). +marshal to and from bitcoin JSON-RPC requests and responses. + +Note that although it's possible to use this package directly to implement an +RPC client, it is not recommended since it is only intended as an infrastructure +package. Instead, RPC clients should use the +[btcrpcclient](https://github.com/btcsuite/btcrpcclient) package which provides +a full blown RPC client with many features such as automatic connection +management, websocket support, automatic notification re-registration on +reconnect, and conversion from the raw underlying RPC types (strings, floats, +ints, etc) to higher-level types with many nice and useful properties. ## JSON RPC -Bitcoin provides an extensive API call list to control bitcoind or -bitcoin-qt through json-rpc. These can be used to get information -from the client or to cause the client to perform some action. +Bitcoin provides an extensive API call list to control bitcoind or bitcoin-qt +through JSON-RPC. These can be used to get information from the client or to +cause the client to perform some action. The general form of the commands are: @@ -30,16 +36,28 @@ The general form of the commands are: {"jsonrpc": "1.0", "id":"test", "method": "getinfo", "params": []} ``` -btcjson provides code to easily create these commands from go (as some -of the commands can be fairly complex), to send the commands to a -running bitcoin rpc server, and to handle the replies (putting them in -useful Go data structures). +btcjson provides code to easily create these commands from go (as some of the +commands can be fairly complex), to send the commands to a running bitcoin RPC +server, and to handle the replies (putting them in useful Go data structures). ## Sample Use ```Go - msg, err := btcjson.CreateMessage("getinfo") - reply, err := btcjson.RpcCommand(user, password, server, msg) + // Create a new command. + cmd, err := btcjson.NewGetBlockCountCmd() + if err != nil { + // Handle error + } + + // Marshal the command to a JSON-RPC formatted byte slice. + marshalled, err := btcjson.MarshalCmd(id, cmd) + if err != nil { + // Handle error + } + + // At this point marshalled contains the raw bytes that are ready to send + // to the RPC server to issue the command. + fmt.Printf("%s\n", marshalled) ``` ## Documentation @@ -58,10 +76,6 @@ http://localhost:6060/pkg/github.com/btcsuite/btcjson $ go get github.com/btcsuite/btcjson ``` -## TODO - -- Increase test coverage to 100%. - ## GPG Verification Key All official release tags are signed by Conformal so users can ensure the code @@ -84,4 +98,5 @@ signature perform the following: ## License -Package btcjson is licensed under the liberal ISC License. +Package btcjson is licensed under the [copyfree](http://copyfree.org) ISC +License. diff --git a/v2/btcjson/btcdextcmds.go b/v2/btcjson/btcdextcmds.go new file mode 100644 index 00000000..a56d7d6c --- /dev/null +++ b/v2/btcjson/btcdextcmds.go @@ -0,0 +1,50 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC commands that are supported by +// a chain server with btcd extensions. + +package btcjson + +// DebugLevelCmd defines the debuglevel JSON-RPC command. This command is not a +// standard Bitcoin command. It is an extension for btcd. +type DebugLevelCmd struct { + LevelSpec string +} + +// NewDebugLevelCmd returns a new DebugLevelCmd which can be used to issue a +// debuglevel JSON-RPC command. This command is not a standard Bitcoin command. +// It is an extension for btcd. +func NewDebugLevelCmd(levelSpec string) *DebugLevelCmd { + return &DebugLevelCmd{ + LevelSpec: levelSpec, + } +} + +// GetBestBlockCmd defines the getbestblock JSON-RPC command. +type GetBestBlockCmd struct{} + +// NewGetBestBlockCmd returns a new instance which can be used to issue a +// getbestblock JSON-RPC command. +func NewGetBestBlockCmd() *GetBestBlockCmd { + return &GetBestBlockCmd{} +} + +// GetCurrentNetCmd defines the getcurrentnet JSON-RPC command. +type GetCurrentNetCmd struct{} + +// NewGetCurrentNetCmd returns a new instance which can be used to issue a +// getcurrentnet JSON-RPC command. +func NewGetCurrentNetCmd() *GetCurrentNetCmd { + return &GetCurrentNetCmd{} +} + +func init() { + // No special flags for commands in this file. + flags := UsageFlag(0) + + MustRegisterCmd("debuglevel", (*DebugLevelCmd)(nil), flags) + MustRegisterCmd("getbestblock", (*GetBestBlockCmd)(nil), flags) + MustRegisterCmd("getcurrentnet", (*GetCurrentNetCmd)(nil), flags) +} diff --git a/v2/btcjson/btcdextcmds_test.go b/v2/btcjson/btcdextcmds_test.go new file mode 100644 index 00000000..9e58bc31 --- /dev/null +++ b/v2/btcjson/btcdextcmds_test.go @@ -0,0 +1,134 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestBtcdExtCmds tests all of the btcd extended commands marshal and unmarshal +// into valid results include handling of optional fields being omitted in the +// marshalled command, while optional fields with defaults have the default +// assigned on unmarshalled commands. +func TestBtcdExtCmds(t *testing.T) { + t.Parallel() + + testID := int(1) + tests := []struct { + name string + newCmd func() (interface{}, error) + staticCmd func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "debuglevel", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("debuglevel", "trace") + }, + staticCmd: func() interface{} { + return btcjson.NewDebugLevelCmd("trace") + }, + marshalled: `{"jsonrpc":"1.0","method":"debuglevel","params":["trace"],"id":1}`, + unmarshalled: &btcjson.DebugLevelCmd{ + LevelSpec: "trace", + }, + }, + { + name: "getbestblock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getbestblock") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBestBlockCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getbestblock","params":[],"id":1}`, + unmarshalled: &btcjson.GetBestBlockCmd{}, + }, + { + name: "getcurrentnet", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getcurrentnet") + }, + staticCmd: func() interface{} { + return btcjson.NewGetCurrentNetCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getcurrentnet","params":[],"id":1}`, + unmarshalled: &btcjson.GetCurrentNetCmd{}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the command as created by the new static command + // creation function. + marshalled, err := btcjson.MarshalCmd(testID, test.staticCmd()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the command is created without error via the generic + // new command creation function. + cmd, err := test.newCmd() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the command as created by the generic new command + // creation function. + marshalled, err = btcjson.MarshalCmd(testID, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} diff --git a/v2/btcjson/btcwalletextcmds.go b/v2/btcjson/btcwalletextcmds.go new file mode 100644 index 00000000..0757e102 --- /dev/null +++ b/v2/btcjson/btcwalletextcmds.go @@ -0,0 +1,104 @@ +// Copyright (c) 2015 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC commands that are supported by +// a wallet server with btcwallet extensions. + +package btcjson + +// CreateNewAccountCmd defines the createnewaccount JSON-RPC command. +type CreateNewAccountCmd struct { + Account string +} + +// NewCreateNewAccountCmd returns a new instance which can be used to issue a +// createnewaccount JSON-RPC command. +func NewCreateNewAccountCmd(account string) *CreateNewAccountCmd { + return &CreateNewAccountCmd{ + Account: account, + } +} + +// DumpWalletCmd defines the dumpwallet JSON-RPC command. +type DumpWalletCmd struct { + Filename string +} + +// NewDumpWalletCmd returns a new instance which can be used to issue a +// dumpwallet JSON-RPC command. +func NewDumpWalletCmd(filename string) *DumpWalletCmd { + return &DumpWalletCmd{ + Filename: filename, + } +} + +// ImportAddressCmd defines the importaddress JSON-RPC command. +type ImportAddressCmd struct { + Address string + Rescan *bool `jsonrpcdefault:"true"` +} + +// NewImportAddressCmd returns a new instance which can be used to issue an +// importaddress JSON-RPC command. +func NewImportAddressCmd(address string, rescan *bool) *ImportAddressCmd { + return &ImportAddressCmd{ + Address: address, + Rescan: rescan, + } +} + +// ImportPubKeyCmd defines the importpubkey JSON-RPC command. +type ImportPubKeyCmd struct { + PubKey string + Rescan *bool `jsonrpcdefault:"true"` +} + +// NewImportPubKeyCmd returns a new instance which can be used to issue an +// importpubkey JSON-RPC command. +func NewImportPubKeyCmd(pubKey string, rescan *bool) *ImportPubKeyCmd { + return &ImportPubKeyCmd{ + PubKey: pubKey, + Rescan: rescan, + } +} + +// ImportWalletCmd defines the importwallet JSON-RPC command. +type ImportWalletCmd struct { + Filename string +} + +// NewImportWalletCmd returns a new instance which can be used to issue a +// importwallet JSON-RPC command. +func NewImportWalletCmd(filename string) *ImportWalletCmd { + return &ImportWalletCmd{ + Filename: filename, + } +} + +// RenameAccountCmd defines the renameaccount JSON-RPC command. +type RenameAccountCmd struct { + OldAccount string + NewAccount string +} + +// NewRenameAccountCmd returns a new instance which can be used to issue a +// renameaccount JSON-RPC command. +func NewRenameAccountCmd(oldAccount, newAccount string) *RenameAccountCmd { + return &RenameAccountCmd{ + OldAccount: oldAccount, + NewAccount: newAccount, + } +} + +func init() { + // The commands in this file are only usable with a wallet server. + flags := UFWalletOnly + + MustRegisterCmd("createnewaccount", (*CreateNewAccountCmd)(nil), flags) + MustRegisterCmd("dumpwallet", (*DumpWalletCmd)(nil), flags) + MustRegisterCmd("importaddress", (*ImportAddressCmd)(nil), flags) + MustRegisterCmd("importpubkey", (*ImportPubKeyCmd)(nil), flags) + MustRegisterCmd("importwallet", (*ImportWalletCmd)(nil), flags) + MustRegisterCmd("renameaccount", (*RenameAccountCmd)(nil), flags) +} diff --git a/v2/btcjson/btcwalletextcmds_test.go b/v2/btcjson/btcwalletextcmds_test.go new file mode 100644 index 00000000..ecdace9a --- /dev/null +++ b/v2/btcjson/btcwalletextcmds_test.go @@ -0,0 +1,208 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestBtcWalletExtCmds tests all of the btcwallet extended commands marshal and +// unmarshal into valid results include handling of optional fields being +// omitted in the marshalled command, while optional fields with defaults have +// the default assigned on unmarshalled commands. +func TestBtcWalletExtCmds(t *testing.T) { + t.Parallel() + + testID := int(1) + tests := []struct { + name string + newCmd func() (interface{}, error) + staticCmd func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "createnewaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("createnewaccount", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewCreateNewAccountCmd("acct") + }, + marshalled: `{"jsonrpc":"1.0","method":"createnewaccount","params":["acct"],"id":1}`, + unmarshalled: &btcjson.CreateNewAccountCmd{ + Account: "acct", + }, + }, + { + name: "dumpwallet", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("dumpwallet", "filename") + }, + staticCmd: func() interface{} { + return btcjson.NewDumpWalletCmd("filename") + }, + marshalled: `{"jsonrpc":"1.0","method":"dumpwallet","params":["filename"],"id":1}`, + unmarshalled: &btcjson.DumpWalletCmd{ + Filename: "filename", + }, + }, + { + name: "importaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importaddress", "1Address") + }, + staticCmd: func() interface{} { + return btcjson.NewImportAddressCmd("1Address", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"importaddress","params":["1Address"],"id":1}`, + unmarshalled: &btcjson.ImportAddressCmd{ + Address: "1Address", + Rescan: btcjson.Bool(true), + }, + }, + { + name: "importaddress optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importaddress", "1Address", false) + }, + staticCmd: func() interface{} { + return btcjson.NewImportAddressCmd("1Address", btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"importaddress","params":["1Address",false],"id":1}`, + unmarshalled: &btcjson.ImportAddressCmd{ + Address: "1Address", + Rescan: btcjson.Bool(false), + }, + }, + { + name: "importpubkey", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importpubkey", "031234") + }, + staticCmd: func() interface{} { + return btcjson.NewImportPubKeyCmd("031234", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"importpubkey","params":["031234"],"id":1}`, + unmarshalled: &btcjson.ImportPubKeyCmd{ + PubKey: "031234", + Rescan: btcjson.Bool(true), + }, + }, + { + name: "importpubkey optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importpubkey", "031234", false) + }, + staticCmd: func() interface{} { + return btcjson.NewImportPubKeyCmd("031234", btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"importpubkey","params":["031234",false],"id":1}`, + unmarshalled: &btcjson.ImportPubKeyCmd{ + PubKey: "031234", + Rescan: btcjson.Bool(false), + }, + }, + { + name: "importwallet", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importwallet", "filename") + }, + staticCmd: func() interface{} { + return btcjson.NewImportWalletCmd("filename") + }, + marshalled: `{"jsonrpc":"1.0","method":"importwallet","params":["filename"],"id":1}`, + unmarshalled: &btcjson.ImportWalletCmd{ + Filename: "filename", + }, + }, + { + name: "renameaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("renameaccount", "oldacct", "newacct") + }, + staticCmd: func() interface{} { + return btcjson.NewRenameAccountCmd("oldacct", "newacct") + }, + marshalled: `{"jsonrpc":"1.0","method":"renameaccount","params":["oldacct","newacct"],"id":1}`, + unmarshalled: &btcjson.RenameAccountCmd{ + OldAccount: "oldacct", + NewAccount: "newacct", + }, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the command as created by the new static command + // creation function. + marshalled, err := btcjson.MarshalCmd(testID, test.staticCmd()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the command is created without error via the generic + // new command creation function. + cmd, err := test.newCmd() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the command as created by the generic new command + // creation function. + marshalled, err = btcjson.MarshalCmd(testID, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} diff --git a/v2/btcjson/chainsvrcmds.go b/v2/btcjson/chainsvrcmds.go new file mode 100644 index 00000000..47cedafe --- /dev/null +++ b/v2/btcjson/chainsvrcmds.go @@ -0,0 +1,697 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC commands that are supported by +// a chain server. + +package btcjson + +import ( + "encoding/json" + "fmt" +) + +// AddNodeSubCmd defines the type used in the addnode JSON-RPC command for the +// sub command field. +type AddNodeSubCmd string + +const ( + // ANAdd indicates the specified host should be added as a persistent + // peer. + ANAdd AddNodeSubCmd = "add" + + // ANRemove indicates the specified peer should be removed. + ANRemove AddNodeSubCmd = "remove" + + // ANOneTry indicates the specified host should try to connect once, + // but it should not be made persistent. + ANOneTry AddNodeSubCmd = "onetry" +) + +// AddNodeCmd defines the addnode JSON-RPC command. +type AddNodeCmd struct { + Addr string + SubCmd AddNodeSubCmd `jsonrpcusage:"\"add|remove|onetry\""` +} + +// NewAddNodeCmd returns a new instance which can be used to issue an addnode +// JSON-RPC command. +func NewAddNodeCmd(addr string, subCmd AddNodeSubCmd) *AddNodeCmd { + return &AddNodeCmd{ + Addr: addr, + SubCmd: subCmd, + } +} + +// TransactionInput represents the inputs to a transaction. Specifically a +// transaction hash and output number pair. +type TransactionInput struct { + Txid string `json:"txid"` + Vout uint32 `json:"vout"` +} + +// CreateRawTransactionCmd defines the createrawtransaction JSON-RPC command. +type CreateRawTransactionCmd struct { + Inputs []TransactionInput + Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC +} + +// NewCreateRawTransactionCmd returns a new instance which can be used to issue +// a createrawtransaction JSON-RPC command. +// +// Amounts are in BTC. +func NewCreateRawTransactionCmd(inputs []TransactionInput, amounts map[string]float64) *CreateRawTransactionCmd { + return &CreateRawTransactionCmd{ + Inputs: inputs, + Amounts: amounts, + } +} + +// DecodeRawTransactionCmd defines the decoderawtransaction JSON-RPC command. +type DecodeRawTransactionCmd struct { + HexTx string +} + +// NewDecodeRawTransactionCmd returns a new instance which can be used to issue +// a decoderawtransaction JSON-RPC command. +func NewDecodeRawTransactionCmd(hexTx string) *DecodeRawTransactionCmd { + return &DecodeRawTransactionCmd{ + HexTx: hexTx, + } +} + +// DecodeScriptCmd defines the decodescript JSON-RPC command. +type DecodeScriptCmd struct { + HexScript string +} + +// NewDecodeScriptCmd returns a new instance which can be used to issue a +// decodescript JSON-RPC command. +func NewDecodeScriptCmd(hexScript string) *DecodeScriptCmd { + return &DecodeScriptCmd{ + HexScript: hexScript, + } +} + +// GetAddedNodeInfoCmd defines the getaddednodeinfo JSON-RPC command. +type GetAddedNodeInfoCmd struct { + DNS bool + Node *string +} + +// NewGetAddedNodeInfoCmd returns a new instance which can be used to issue a +// getaddednodeinfo JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetAddedNodeInfoCmd(dns bool, node *string) *GetAddedNodeInfoCmd { + return &GetAddedNodeInfoCmd{ + DNS: dns, + Node: node, + } +} + +// GetBestBlockHashCmd defines the getbestblockhash JSON-RPC command. +type GetBestBlockHashCmd struct{} + +// NewGetBestBlockHashCmd returns a new instance which can be used to issue a +// getbestblockhash JSON-RPC command. +func NewGetBestBlockHashCmd() *GetBestBlockHashCmd { + return &GetBestBlockHashCmd{} +} + +// GetBlockCmd defines the getblock JSON-RPC command. +type GetBlockCmd struct { + Hash string + Verbose *bool `jsonrpcdefault:"true"` + VerboseTx *bool `jsonrpcdefault:"false"` +} + +// NewGetBlockCmd returns a new instance which can be used to issue a getblock +// JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetBlockCmd(hash string, verbose, verboseTx *bool) *GetBlockCmd { + return &GetBlockCmd{ + Hash: hash, + Verbose: verbose, + VerboseTx: verboseTx, + } +} + +// GetBlockChainInfoCmd defines the getblockchaininfo JSON-RPC command. +type GetBlockChainInfoCmd struct{} + +// NewGetBlockChainInfoCmd returns a new instance which can be used to issue a +// getblockchaininfo JSON-RPC command. +func NewGetBlockChainInfoCmd() *GetBlockChainInfoCmd { + return &GetBlockChainInfoCmd{} +} + +// GetBlockCountCmd defines the getblockcount JSON-RPC command. +type GetBlockCountCmd struct{} + +// NewGetBlockCountCmd returns a new instance which can be used to issue a +// getblockcount JSON-RPC command. +func NewGetBlockCountCmd() *GetBlockCountCmd { + return &GetBlockCountCmd{} +} + +// GetBlockHashCmd defines the getblockhash JSON-RPC command. +type GetBlockHashCmd struct { + Index int64 +} + +// NewGetBlockHashCmd returns a new instance which can be used to issue a +// getblockhash JSON-RPC command. +func NewGetBlockHashCmd(index int64) *GetBlockHashCmd { + return &GetBlockHashCmd{ + Index: index, + } +} + +// TemplateRequest is a request object as defined in BIP22 +// (https://en.bitcoin.it/wiki/BIP_0022), it is optionally provided as an +// pointer argument to GetBlockTemplateCmd. +type TemplateRequest struct { + Mode string `json:"mode,omitempty"` + Capabilities []string `json:"capabilities,omitempty"` + + // Optional long polling. + LongPollID string `json:"longpollid,omitempty"` + + // Optional template tweaking. SigOpLimit and SizeLimit can be int64 + // or bool. + SigOpLimit interface{} `json:"sigoplimit,omitempty"` + SizeLimit interface{} `json:"sizelimit,omitempty"` + MaxVersion uint32 `json:"maxversion,omitempty"` + + // Basic pool extension from BIP 0023. + Target string `json:"target,omitempty"` + + // Block proposal from BIP 0023. Data is only provided when Mode is + // "proposal". + Data string `json:"data,omitempty"` + WorkID string `json:"workid,omitempty"` +} + +// convertTemplateRequestField potentially converts the provided value as +// needed. +func convertTemplateRequestField(fieldName string, iface interface{}) (interface{}, error) { + switch val := iface.(type) { + case nil: + return nil, nil + case bool: + return val, nil + case float64: + if val == float64(int64(val)) { + return int64(val), nil + } + } + + str := fmt.Sprintf("the %s field must be unspecified, a boolean, or "+ + "a 64-bit integer", fieldName) + return nil, makeError(ErrInvalidType, str) +} + +// UnmarshalJSON provides a custom Unmarshal method for TemplateRequest. This +// is necessary because the SigOpLimit and SizeLimit fields can only be specific +// types. +func (t *TemplateRequest) UnmarshalJSON(data []byte) error { + type templateRequest TemplateRequest + + request := (*templateRequest)(t) + if err := json.Unmarshal(data, &request); err != nil { + return err + } + + // The SigOpLimit field can only be nil, bool, or int64. + val, err := convertTemplateRequestField("sigoplimit", request.SigOpLimit) + if err != nil { + return err + } + request.SigOpLimit = val + + // The SizeLimit field can only be nil, bool, or int64. + val, err = convertTemplateRequestField("sizelimit", request.SizeLimit) + if err != nil { + return err + } + request.SizeLimit = val + + return nil +} + +// GetBlockTemplateCmd defines the getblocktemplate JSON-RPC command. +type GetBlockTemplateCmd struct { + Request *TemplateRequest +} + +// NewGetBlockTemplateCmd returns a new instance which can be used to issue a +// getblocktemplate JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetBlockTemplateCmd(request *TemplateRequest) *GetBlockTemplateCmd { + return &GetBlockTemplateCmd{ + Request: request, + } +} + +// GetChainTipsCmd defines the getchaintips JSON-RPC command. +type GetChainTipsCmd struct{} + +// NewGetChainTipsCmd returns a new instance which can be used to issue a +// getchaintips JSON-RPC command. +func NewGetChainTipsCmd() *GetChainTipsCmd { + return &GetChainTipsCmd{} +} + +// GetConnectionCountCmd defines the getconnectioncount JSON-RPC command. +type GetConnectionCountCmd struct{} + +// NewGetConnectionCountCmd returns a new instance which can be used to issue a +// getconnectioncount JSON-RPC command. +func NewGetConnectionCountCmd() *GetConnectionCountCmd { + return &GetConnectionCountCmd{} +} + +// GetDifficultyCmd defines the getdifficulty JSON-RPC command. +type GetDifficultyCmd struct{} + +// NewGetDifficultyCmd returns a new instance which can be used to issue a +// getdifficulty JSON-RPC command. +func NewGetDifficultyCmd() *GetDifficultyCmd { + return &GetDifficultyCmd{} +} + +// GetGenerateCmd defines the getgenerate JSON-RPC command. +type GetGenerateCmd struct{} + +// NewGetGenerateCmd returns a new instance which can be used to issue a +// getgenerate JSON-RPC command. +func NewGetGenerateCmd() *GetGenerateCmd { + return &GetGenerateCmd{} +} + +// GetHashesPerSecCmd defines the gethashespersec JSON-RPC command. +type GetHashesPerSecCmd struct{} + +// NewGetHashesPerSecCmd returns a new instance which can be used to issue a +// gethashespersec JSON-RPC command. +func NewGetHashesPerSecCmd() *GetHashesPerSecCmd { + return &GetHashesPerSecCmd{} +} + +// GetInfoCmd defines the getinfo JSON-RPC command. +type GetInfoCmd struct{} + +// NewGetInfoCmd returns a new instance which can be used to issue a +// getinfo JSON-RPC command. +func NewGetInfoCmd() *GetInfoCmd { + return &GetInfoCmd{} +} + +// GetMempoolInfoCmd defines the getmempoolinfo JSON-RPC command. +type GetMempoolInfoCmd struct{} + +// NewGetMempoolInfoCmd returns a new instance which can be used to issue a +// getmempool JSON-RPC command. +func NewGetMempoolInfoCmd() *GetMempoolInfoCmd { + return &GetMempoolInfoCmd{} +} + +// GetMiningInfoCmd defines the getmininginfo JSON-RPC command. +type GetMiningInfoCmd struct{} + +// NewGetMiningInfoCmd returns a new instance which can be used to issue a +// getmininginfo JSON-RPC command. +func NewGetMiningInfoCmd() *GetMiningInfoCmd { + return &GetMiningInfoCmd{} +} + +// GetNetworkInfoCmd defines the getnetworkinfo JSON-RPC command. +type GetNetworkInfoCmd struct{} + +// NewGetNetworkInfoCmd returns a new instance which can be used to issue a +// getnetworkinfo JSON-RPC command. +func NewGetNetworkInfoCmd() *GetNetworkInfoCmd { + return &GetNetworkInfoCmd{} +} + +// GetNetTotalsCmd defines the getnettotals JSON-RPC command. +type GetNetTotalsCmd struct{} + +// NewGetNetTotalsCmd returns a new instance which can be used to issue a +// getnettotals JSON-RPC command. +func NewGetNetTotalsCmd() *GetNetTotalsCmd { + return &GetNetTotalsCmd{} +} + +// GetNetworkHashPSCmd defines the getnetworkhashps JSON-RPC command. +type GetNetworkHashPSCmd struct { + Blocks *int `jsonrpcdefault:"120"` + Height *int `jsonrpcdefault:"-1"` +} + +// NewGetNetworkHashPSCmd returns a new instance which can be used to issue a +// getnetworkhashps JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetNetworkHashPSCmd(numBlocks, height *int) *GetNetworkHashPSCmd { + return &GetNetworkHashPSCmd{ + Blocks: numBlocks, + Height: height, + } +} + +// GetPeerInfoCmd defines the getpeerinfo JSON-RPC command. +type GetPeerInfoCmd struct{} + +// NewGetPeerInfoCmd returns a new instance which can be used to issue a getpeer +// JSON-RPC command. +func NewGetPeerInfoCmd() *GetPeerInfoCmd { + return &GetPeerInfoCmd{} +} + +// GetRawMempoolCmd defines the getmempool JSON-RPC command. +type GetRawMempoolCmd struct { + Verbose *bool `jsonrpcdefault:"false"` +} + +// NewGetRawMempoolCmd returns a new instance which can be used to issue a +// getrawmempool JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetRawMempoolCmd(verbose *bool) *GetRawMempoolCmd { + return &GetRawMempoolCmd{ + Verbose: verbose, + } +} + +// GetRawTransactionCmd defines the getrawtransaction JSON-RPC command. +// +// NOTE: This field is an int versus a bool to remain compatible with Bitcoin +// Core even though it really should be a bool. +type GetRawTransactionCmd struct { + Txid string + Verbose *int `jsonrpcdefault:"0"` +} + +// NewGetRawTransactionCmd returns a new instance which can be used to issue a +// getrawtransaction JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetRawTransactionCmd(txHash string, verbose *int) *GetRawTransactionCmd { + return &GetRawTransactionCmd{ + Txid: txHash, + Verbose: verbose, + } +} + +// GetTxOutCmd defines the gettxout JSON-RPC command. +type GetTxOutCmd struct { + Txid string + Vout int + IncludeMempool *bool `jsonrpcdefault:"true"` +} + +// NewGetTxOutCmd returns a new instance which can be used to issue a gettxout +// JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetTxOutCmd(txHash string, vout int, includeMempool *bool) *GetTxOutCmd { + return &GetTxOutCmd{ + Txid: txHash, + Vout: vout, + IncludeMempool: includeMempool, + } +} + +// GetTxOutSetInfoCmd defines the gettxoutsetinfo JSON-RPC command. +type GetTxOutSetInfoCmd struct{} + +// NewGetTxOutSetInfoCmd returns a new instance which can be used to issue a +// gettxoutsetinfo JSON-RPC command. +func NewGetTxOutSetInfoCmd() *GetTxOutSetInfoCmd { + return &GetTxOutSetInfoCmd{} +} + +// GetWorkCmd defines the getwork JSON-RPC command. +type GetWorkCmd struct { + Data *string +} + +// NewGetWorkCmd returns a new instance which can be used to issue a getwork +// JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetWorkCmd(data *string) *GetWorkCmd { + return &GetWorkCmd{ + Data: data, + } +} + +// HelpCmd defines the help JSON-RPC command. +type HelpCmd struct { + Command *string +} + +// NewHelpCmd returns a new instance which can be used to issue a help JSON-RPC +// command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewHelpCmd(command *string) *HelpCmd { + return &HelpCmd{ + Command: command, + } +} + +// InvalidateBlockCmd defines the invalidateblock JSON-RPC command. +type InvalidateBlockCmd struct { + BlockHash string +} + +// NewInvalidateBlockCmd returns a new instance which can be used to issue a +// invalidateblock JSON-RPC command. +func NewInvalidateBlockCmd(blockHash string) *InvalidateBlockCmd { + return &InvalidateBlockCmd{ + BlockHash: blockHash, + } +} + +// PingCmd defines the ping JSON-RPC command. +type PingCmd struct{} + +// NewPingCmd returns a new instance which can be used to issue a ping JSON-RPC +// command. +func NewPingCmd() *PingCmd { + return &PingCmd{} +} + +// ReconsiderBlockCmd defines the reconsiderblock JSON-RPC command. +type ReconsiderBlockCmd struct { + BlockHash string +} + +// NewReconsiderBlockCmd returns a new instance which can be used to issue a +// reconsiderblock JSON-RPC command. +func NewReconsiderBlockCmd(blockHash string) *ReconsiderBlockCmd { + return &ReconsiderBlockCmd{ + BlockHash: blockHash, + } +} + +// SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command. +type SearchRawTransactionsCmd struct { + Address string + Verbose *bool `jsonrpcdefault:"true"` + Skip *int `jsonrpcdefault:"0"` + Count *int `jsonrpcdefault:"100"` +} + +// NewSearchRawTransactionsCmd returns a new instance which can be used to issue a +// sendrawtransaction JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSearchRawTransactionsCmd(address string, verbose *bool, skip, count *int) *SearchRawTransactionsCmd { + return &SearchRawTransactionsCmd{ + Address: address, + Verbose: verbose, + Skip: skip, + Count: count, + } +} + +// SendRawTransactionCmd defines the sendrawtransaction JSON-RPC command. +type SendRawTransactionCmd struct { + HexTx string + AllowHighFees *bool `jsonrpcdefault:"false"` +} + +// NewSendRawTransactionCmd returns a new instance which can be used to issue a +// sendrawtransaction JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSendRawTransactionCmd(hexTx string, allowHighFees *bool) *SendRawTransactionCmd { + return &SendRawTransactionCmd{ + HexTx: hexTx, + AllowHighFees: allowHighFees, + } +} + +// SetGenerateCmd defines the setgenerate JSON-RPC command. +type SetGenerateCmd struct { + Generate bool + GenProcLimit *int `jsonrpcdefault:"-1"` +} + +// NewSetGenerateCmd returns a new instance which can be used to issue a +// setgenerate JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSetGenerateCmd(generate bool, genProcLimit *int) *SetGenerateCmd { + return &SetGenerateCmd{ + Generate: generate, + GenProcLimit: genProcLimit, + } +} + +// StopCmd defines the stop JSON-RPC command. +type StopCmd struct{} + +// NewStopCmd returns a new instance which can be used to issue a stop JSON-RPC +// command. +func NewStopCmd() *StopCmd { + return &StopCmd{} +} + +// SubmitBlockOptions represents the optional options struct provided with a +// SubmitBlockCmd command. +type SubmitBlockOptions struct { + // must be provided if server provided a workid with template. + WorkID string `json:"workid,omitempty"` +} + +// SubmitBlockCmd defines the submitblock JSON-RPC command. +type SubmitBlockCmd struct { + HexBlock string + Options *SubmitBlockOptions +} + +// NewSubmitBlockCmd returns a new instance which can be used to issue a +// submitblock JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSubmitBlockCmd(hexBlock string, options *SubmitBlockOptions) *SubmitBlockCmd { + return &SubmitBlockCmd{ + HexBlock: hexBlock, + Options: options, + } +} + +// ValidateAddressCmd defines the validateaddress JSON-RPC command. +type ValidateAddressCmd struct { + Address string +} + +// NewValidateAddressCmd returns a new instance which can be used to issue a +// validateaddress JSON-RPC command. +func NewValidateAddressCmd(address string) *ValidateAddressCmd { + return &ValidateAddressCmd{ + Address: address, + } +} + +// VerifyChainCmd defines the verifychain JSON-RPC command. +type VerifyChainCmd struct { + CheckLevel *int32 `jsonrpcdefault:"3"` + CheckDepth *int32 `jsonrpcdefault:"288"` // 0 = all +} + +// NewVerifyChainCmd returns a new instance which can be used to issue a +// verifychain JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewVerifyChainCmd(checkLevel, checkDepth *int32) *VerifyChainCmd { + return &VerifyChainCmd{ + CheckLevel: checkLevel, + CheckDepth: checkDepth, + } +} + +// VerifyMessageCmd defines the verifymessage JSON-RPC command. +type VerifyMessageCmd struct { + Address string + Signature string + Message string +} + +// NewVerifyMessageCmd returns a new instance which can be used to issue a +// verifymessage JSON-RPC command. +func NewVerifyMessageCmd(address, signature, message string) *VerifyMessageCmd { + return &VerifyMessageCmd{ + Address: address, + Signature: signature, + Message: message, + } +} + +func init() { + // No special flags for commands in this file. + flags := UsageFlag(0) + + MustRegisterCmd("addnode", (*AddNodeCmd)(nil), flags) + MustRegisterCmd("createrawtransaction", (*CreateRawTransactionCmd)(nil), flags) + MustRegisterCmd("decoderawtransaction", (*DecodeRawTransactionCmd)(nil), flags) + MustRegisterCmd("decodescript", (*DecodeScriptCmd)(nil), flags) + MustRegisterCmd("getaddednodeinfo", (*GetAddedNodeInfoCmd)(nil), flags) + MustRegisterCmd("getbestblockhash", (*GetBestBlockHashCmd)(nil), flags) + MustRegisterCmd("getblock", (*GetBlockCmd)(nil), flags) + MustRegisterCmd("getblockchaininfo", (*GetBlockChainInfoCmd)(nil), flags) + MustRegisterCmd("getblockcount", (*GetBlockCountCmd)(nil), flags) + MustRegisterCmd("getblockhash", (*GetBlockHashCmd)(nil), flags) + MustRegisterCmd("getblocktemplate", (*GetBlockTemplateCmd)(nil), flags) + MustRegisterCmd("getchaintips", (*GetChainTipsCmd)(nil), flags) + MustRegisterCmd("getconnectioncount", (*GetConnectionCountCmd)(nil), flags) + MustRegisterCmd("getdifficulty", (*GetDifficultyCmd)(nil), flags) + MustRegisterCmd("getgenerate", (*GetGenerateCmd)(nil), flags) + MustRegisterCmd("gethashespersec", (*GetHashesPerSecCmd)(nil), flags) + MustRegisterCmd("getinfo", (*GetInfoCmd)(nil), flags) + MustRegisterCmd("getmempoolinfo", (*GetMempoolInfoCmd)(nil), flags) + MustRegisterCmd("getmininginfo", (*GetMiningInfoCmd)(nil), flags) + MustRegisterCmd("getnetworkinfo", (*GetNetworkInfoCmd)(nil), flags) + MustRegisterCmd("getnettotals", (*GetNetTotalsCmd)(nil), flags) + MustRegisterCmd("getnetworkhashps", (*GetNetworkHashPSCmd)(nil), flags) + MustRegisterCmd("getpeerinfo", (*GetPeerInfoCmd)(nil), flags) + MustRegisterCmd("getrawmempool", (*GetRawMempoolCmd)(nil), flags) + MustRegisterCmd("getrawtransaction", (*GetRawTransactionCmd)(nil), flags) + MustRegisterCmd("gettxout", (*GetTxOutCmd)(nil), flags) + MustRegisterCmd("gettxoutsetinfo", (*GetTxOutSetInfoCmd)(nil), flags) + MustRegisterCmd("getwork", (*GetWorkCmd)(nil), flags) + MustRegisterCmd("help", (*HelpCmd)(nil), flags) + MustRegisterCmd("invalidateblock", (*InvalidateBlockCmd)(nil), flags) + MustRegisterCmd("ping", (*PingCmd)(nil), flags) + MustRegisterCmd("reconsiderblock", (*ReconsiderBlockCmd)(nil), flags) + MustRegisterCmd("searchrawtransactions", (*SearchRawTransactionsCmd)(nil), flags) + MustRegisterCmd("sendrawtransaction", (*SendRawTransactionCmd)(nil), flags) + MustRegisterCmd("setgenerate", (*SetGenerateCmd)(nil), flags) + MustRegisterCmd("stop", (*StopCmd)(nil), flags) + MustRegisterCmd("submitblock", (*SubmitBlockCmd)(nil), flags) + MustRegisterCmd("validateaddress", (*ValidateAddressCmd)(nil), flags) + MustRegisterCmd("verifychain", (*VerifyChainCmd)(nil), flags) + MustRegisterCmd("verifymessage", (*VerifyMessageCmd)(nil), flags) +} diff --git a/v2/btcjson/chainsvrcmds_test.go b/v2/btcjson/chainsvrcmds_test.go new file mode 100644 index 00000000..edbc6c7a --- /dev/null +++ b/v2/btcjson/chainsvrcmds_test.go @@ -0,0 +1,988 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestChainSvrCmds tests all of the chain server commands marshal and unmarshal +// into valid results include handling of optional fields being omitted in the +// marshalled command, while optional fields with defaults have the default +// assigned on unmarshalled commands. +func TestChainSvrCmds(t *testing.T) { + t.Parallel() + + testID := int(1) + tests := []struct { + name string + newCmd func() (interface{}, error) + staticCmd func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "addnode", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("addnode", "127.0.0.1", btcjson.ANRemove) + }, + staticCmd: func() interface{} { + return btcjson.NewAddNodeCmd("127.0.0.1", btcjson.ANRemove) + }, + marshalled: `{"jsonrpc":"1.0","method":"addnode","params":["127.0.0.1","remove"],"id":1}`, + unmarshalled: &btcjson.AddNodeCmd{Addr: "127.0.0.1", SubCmd: btcjson.ANRemove}, + }, + { + name: "createrawtransaction", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("createrawtransaction", `[{"txid":"123","vout":1}]`, + `{"456":0.0123}`) + }, + staticCmd: func() interface{} { + txInputs := []btcjson.TransactionInput{ + {Txid: "123", Vout: 1}, + } + amounts := map[string]float64{"456": .0123} + return btcjson.NewCreateRawTransactionCmd(txInputs, amounts) + }, + marshalled: `{"jsonrpc":"1.0","method":"createrawtransaction","params":[[{"txid":"123","vout":1}],{"456":0.0123}],"id":1}`, + unmarshalled: &btcjson.CreateRawTransactionCmd{ + Inputs: []btcjson.TransactionInput{{Txid: "123", Vout: 1}}, + Amounts: map[string]float64{"456": .0123}, + }, + }, + { + name: "decoderawtransaction", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("decoderawtransaction", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewDecodeRawTransactionCmd("123") + }, + marshalled: `{"jsonrpc":"1.0","method":"decoderawtransaction","params":["123"],"id":1}`, + unmarshalled: &btcjson.DecodeRawTransactionCmd{HexTx: "123"}, + }, + { + name: "decodescript", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("decodescript", "00") + }, + staticCmd: func() interface{} { + return btcjson.NewDecodeScriptCmd("00") + }, + marshalled: `{"jsonrpc":"1.0","method":"decodescript","params":["00"],"id":1}`, + unmarshalled: &btcjson.DecodeScriptCmd{HexScript: "00"}, + }, + { + name: "getaddednodeinfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getaddednodeinfo", true) + }, + staticCmd: func() interface{} { + return btcjson.NewGetAddedNodeInfoCmd(true, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getaddednodeinfo","params":[true],"id":1}`, + unmarshalled: &btcjson.GetAddedNodeInfoCmd{DNS: true, Node: nil}, + }, + { + name: "getaddednodeinfo optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getaddednodeinfo", true, "127.0.0.1") + }, + staticCmd: func() interface{} { + return btcjson.NewGetAddedNodeInfoCmd(true, btcjson.String("127.0.0.1")) + }, + marshalled: `{"jsonrpc":"1.0","method":"getaddednodeinfo","params":[true,"127.0.0.1"],"id":1}`, + unmarshalled: &btcjson.GetAddedNodeInfoCmd{ + DNS: true, + Node: btcjson.String("127.0.0.1"), + }, + }, + { + name: "getbestblockhash", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getbestblockhash") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBestBlockHashCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getbestblockhash","params":[],"id":1}`, + unmarshalled: &btcjson.GetBestBlockHashCmd{}, + }, + { + name: "getblock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblock", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockCmd("123", nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblock","params":["123"],"id":1}`, + unmarshalled: &btcjson.GetBlockCmd{ + Hash: "123", + Verbose: btcjson.Bool(true), + VerboseTx: btcjson.Bool(false), + }, + }, + { + name: "getblock required optional1", + newCmd: func() (interface{}, error) { + // Intentionally use a source param that is + // more pointers than the destination to + // exercise that path. + verbosePtr := btcjson.Bool(true) + return btcjson.NewCmd("getblock", "123", &verbosePtr) + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockCmd("123", btcjson.Bool(true), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblock","params":["123",true],"id":1}`, + unmarshalled: &btcjson.GetBlockCmd{ + Hash: "123", + Verbose: btcjson.Bool(true), + VerboseTx: btcjson.Bool(false), + }, + }, + { + name: "getblock required optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblock", "123", true, true) + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockCmd("123", btcjson.Bool(true), btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblock","params":["123",true,true],"id":1}`, + unmarshalled: &btcjson.GetBlockCmd{ + Hash: "123", + Verbose: btcjson.Bool(true), + VerboseTx: btcjson.Bool(true), + }, + }, + { + name: "getblockchaininfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblockchaininfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockChainInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getblockchaininfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetBlockChainInfoCmd{}, + }, + { + name: "getblockcount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblockcount") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockCountCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getblockcount","params":[],"id":1}`, + unmarshalled: &btcjson.GetBlockCountCmd{}, + }, + { + name: "getblockhash", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblockhash", 123) + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockHashCmd(123) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblockhash","params":[123],"id":1}`, + unmarshalled: &btcjson.GetBlockHashCmd{Index: 123}, + }, + { + name: "getblocktemplate", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblocktemplate") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBlockTemplateCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblocktemplate","params":[],"id":1}`, + unmarshalled: &btcjson.GetBlockTemplateCmd{Request: nil}, + }, + { + name: "getblocktemplate optional - template request", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblocktemplate", `{"mode":"template","capabilities":["longpoll","coinbasetxn"]}`) + }, + staticCmd: func() interface{} { + template := btcjson.TemplateRequest{ + Mode: "template", + Capabilities: []string{"longpoll", "coinbasetxn"}, + } + return btcjson.NewGetBlockTemplateCmd(&template) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblocktemplate","params":[{"mode":"template","capabilities":["longpoll","coinbasetxn"]}],"id":1}`, + unmarshalled: &btcjson.GetBlockTemplateCmd{ + Request: &btcjson.TemplateRequest{ + Mode: "template", + Capabilities: []string{"longpoll", "coinbasetxn"}, + }, + }, + }, + { + name: "getblocktemplate optional - template request with tweaks", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblocktemplate", `{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":500,"sizelimit":100000000,"maxversion":2}`) + }, + staticCmd: func() interface{} { + template := btcjson.TemplateRequest{ + Mode: "template", + Capabilities: []string{"longpoll", "coinbasetxn"}, + SigOpLimit: 500, + SizeLimit: 100000000, + MaxVersion: 2, + } + return btcjson.NewGetBlockTemplateCmd(&template) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblocktemplate","params":[{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":500,"sizelimit":100000000,"maxversion":2}],"id":1}`, + unmarshalled: &btcjson.GetBlockTemplateCmd{ + Request: &btcjson.TemplateRequest{ + Mode: "template", + Capabilities: []string{"longpoll", "coinbasetxn"}, + SigOpLimit: int64(500), + SizeLimit: int64(100000000), + MaxVersion: 2, + }, + }, + }, + { + name: "getblocktemplate optional - template request with tweaks 2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getblocktemplate", `{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":true,"sizelimit":100000000,"maxversion":2}`) + }, + staticCmd: func() interface{} { + template := btcjson.TemplateRequest{ + Mode: "template", + Capabilities: []string{"longpoll", "coinbasetxn"}, + SigOpLimit: true, + SizeLimit: 100000000, + MaxVersion: 2, + } + return btcjson.NewGetBlockTemplateCmd(&template) + }, + marshalled: `{"jsonrpc":"1.0","method":"getblocktemplate","params":[{"mode":"template","capabilities":["longpoll","coinbasetxn"],"sigoplimit":true,"sizelimit":100000000,"maxversion":2}],"id":1}`, + unmarshalled: &btcjson.GetBlockTemplateCmd{ + Request: &btcjson.TemplateRequest{ + Mode: "template", + Capabilities: []string{"longpoll", "coinbasetxn"}, + SigOpLimit: true, + SizeLimit: int64(100000000), + MaxVersion: 2, + }, + }, + }, + { + name: "getchaintips", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getchaintips") + }, + staticCmd: func() interface{} { + return btcjson.NewGetChainTipsCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getchaintips","params":[],"id":1}`, + unmarshalled: &btcjson.GetChainTipsCmd{}, + }, + { + name: "getconnectioncount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getconnectioncount") + }, + staticCmd: func() interface{} { + return btcjson.NewGetConnectionCountCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getconnectioncount","params":[],"id":1}`, + unmarshalled: &btcjson.GetConnectionCountCmd{}, + }, + { + name: "getdifficulty", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getdifficulty") + }, + staticCmd: func() interface{} { + return btcjson.NewGetDifficultyCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getdifficulty","params":[],"id":1}`, + unmarshalled: &btcjson.GetDifficultyCmd{}, + }, + { + name: "getgenerate", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getgenerate") + }, + staticCmd: func() interface{} { + return btcjson.NewGetGenerateCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getgenerate","params":[],"id":1}`, + unmarshalled: &btcjson.GetGenerateCmd{}, + }, + { + name: "gethashespersec", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("gethashespersec") + }, + staticCmd: func() interface{} { + return btcjson.NewGetHashesPerSecCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"gethashespersec","params":[],"id":1}`, + unmarshalled: &btcjson.GetHashesPerSecCmd{}, + }, + { + name: "getinfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getinfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getinfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetInfoCmd{}, + }, + { + name: "getmempoolinfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getmempoolinfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetMempoolInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getmempoolinfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetMempoolInfoCmd{}, + }, + { + name: "getmininginfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getmininginfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetMiningInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getmininginfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetMiningInfoCmd{}, + }, + { + name: "getnetworkinfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnetworkinfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetNetworkInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getnetworkinfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetNetworkInfoCmd{}, + }, + { + name: "getnettotals", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnettotals") + }, + staticCmd: func() interface{} { + return btcjson.NewGetNetTotalsCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getnettotals","params":[],"id":1}`, + unmarshalled: &btcjson.GetNetTotalsCmd{}, + }, + { + name: "getnetworkhashps", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnetworkhashps") + }, + staticCmd: func() interface{} { + return btcjson.NewGetNetworkHashPSCmd(nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getnetworkhashps","params":[],"id":1}`, + unmarshalled: &btcjson.GetNetworkHashPSCmd{ + Blocks: btcjson.Int(120), + Height: btcjson.Int(-1), + }, + }, + { + name: "getnetworkhashps optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnetworkhashps", 200) + }, + staticCmd: func() interface{} { + return btcjson.NewGetNetworkHashPSCmd(btcjson.Int(200), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getnetworkhashps","params":[200],"id":1}`, + unmarshalled: &btcjson.GetNetworkHashPSCmd{ + Blocks: btcjson.Int(200), + Height: btcjson.Int(-1), + }, + }, + { + name: "getnetworkhashps optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnetworkhashps", 200, 123) + }, + staticCmd: func() interface{} { + return btcjson.NewGetNetworkHashPSCmd(btcjson.Int(200), btcjson.Int(123)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getnetworkhashps","params":[200,123],"id":1}`, + unmarshalled: &btcjson.GetNetworkHashPSCmd{ + Blocks: btcjson.Int(200), + Height: btcjson.Int(123), + }, + }, + { + name: "getpeerinfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getpeerinfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetPeerInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"getpeerinfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetPeerInfoCmd{}, + }, + { + name: "getrawmempool", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getrawmempool") + }, + staticCmd: func() interface{} { + return btcjson.NewGetRawMempoolCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getrawmempool","params":[],"id":1}`, + unmarshalled: &btcjson.GetRawMempoolCmd{ + Verbose: btcjson.Bool(false), + }, + }, + { + name: "getrawmempool optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getrawmempool", false) + }, + staticCmd: func() interface{} { + return btcjson.NewGetRawMempoolCmd(btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getrawmempool","params":[false],"id":1}`, + unmarshalled: &btcjson.GetRawMempoolCmd{ + Verbose: btcjson.Bool(false), + }, + }, + { + name: "getrawtransaction", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getrawtransaction", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewGetRawTransactionCmd("123", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getrawtransaction","params":["123"],"id":1}`, + unmarshalled: &btcjson.GetRawTransactionCmd{ + Txid: "123", + Verbose: btcjson.Int(0), + }, + }, + { + name: "getrawtransaction optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getrawtransaction", "123", 1) + }, + staticCmd: func() interface{} { + return btcjson.NewGetRawTransactionCmd("123", btcjson.Int(1)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getrawtransaction","params":["123",1],"id":1}`, + unmarshalled: &btcjson.GetRawTransactionCmd{ + Txid: "123", + Verbose: btcjson.Int(1), + }, + }, + { + name: "gettxout", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("gettxout", "123", 1) + }, + staticCmd: func() interface{} { + return btcjson.NewGetTxOutCmd("123", 1, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"gettxout","params":["123",1],"id":1}`, + unmarshalled: &btcjson.GetTxOutCmd{ + Txid: "123", + Vout: 1, + IncludeMempool: btcjson.Bool(true), + }, + }, + { + name: "gettxout optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("gettxout", "123", 1, true) + }, + staticCmd: func() interface{} { + return btcjson.NewGetTxOutCmd("123", 1, btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"gettxout","params":["123",1,true],"id":1}`, + unmarshalled: &btcjson.GetTxOutCmd{ + Txid: "123", + Vout: 1, + IncludeMempool: btcjson.Bool(true), + }, + }, + { + name: "gettxoutsetinfo", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("gettxoutsetinfo") + }, + staticCmd: func() interface{} { + return btcjson.NewGetTxOutSetInfoCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"gettxoutsetinfo","params":[],"id":1}`, + unmarshalled: &btcjson.GetTxOutSetInfoCmd{}, + }, + { + name: "getwork", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getwork") + }, + staticCmd: func() interface{} { + return btcjson.NewGetWorkCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getwork","params":[],"id":1}`, + unmarshalled: &btcjson.GetWorkCmd{ + Data: nil, + }, + }, + { + name: "getwork optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getwork", "00112233") + }, + staticCmd: func() interface{} { + return btcjson.NewGetWorkCmd(btcjson.String("00112233")) + }, + marshalled: `{"jsonrpc":"1.0","method":"getwork","params":["00112233"],"id":1}`, + unmarshalled: &btcjson.GetWorkCmd{ + Data: btcjson.String("00112233"), + }, + }, + { + name: "help", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("help") + }, + staticCmd: func() interface{} { + return btcjson.NewHelpCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"help","params":[],"id":1}`, + unmarshalled: &btcjson.HelpCmd{ + Command: nil, + }, + }, + { + name: "help optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("help", "getblock") + }, + staticCmd: func() interface{} { + return btcjson.NewHelpCmd(btcjson.String("getblock")) + }, + marshalled: `{"jsonrpc":"1.0","method":"help","params":["getblock"],"id":1}`, + unmarshalled: &btcjson.HelpCmd{ + Command: btcjson.String("getblock"), + }, + }, + { + name: "invalidateblock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("invalidateblock", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewInvalidateBlockCmd("123") + }, + marshalled: `{"jsonrpc":"1.0","method":"invalidateblock","params":["123"],"id":1}`, + unmarshalled: &btcjson.InvalidateBlockCmd{ + BlockHash: "123", + }, + }, + { + name: "ping", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("ping") + }, + staticCmd: func() interface{} { + return btcjson.NewPingCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"ping","params":[],"id":1}`, + unmarshalled: &btcjson.PingCmd{}, + }, + { + name: "reconsiderblock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("reconsiderblock", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewReconsiderBlockCmd("123") + }, + marshalled: `{"jsonrpc":"1.0","method":"reconsiderblock","params":["123"],"id":1}`, + unmarshalled: &btcjson.ReconsiderBlockCmd{ + BlockHash: "123", + }, + }, + { + name: "searchrawtransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("searchrawtransactions", "1Address") + }, + staticCmd: func() interface{} { + return btcjson.NewSearchRawTransactionsCmd("1Address", nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address"],"id":1}`, + unmarshalled: &btcjson.SearchRawTransactionsCmd{ + Address: "1Address", + Verbose: btcjson.Bool(true), + Skip: btcjson.Int(0), + Count: btcjson.Int(100), + }, + }, + { + name: "searchrawtransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("searchrawtransactions", "1Address", false) + }, + staticCmd: func() interface{} { + return btcjson.NewSearchRawTransactionsCmd("1Address", + btcjson.Bool(false), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",false],"id":1}`, + unmarshalled: &btcjson.SearchRawTransactionsCmd{ + Address: "1Address", + Verbose: btcjson.Bool(false), + Skip: btcjson.Int(0), + Count: btcjson.Int(100), + }, + }, + { + name: "searchrawtransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("searchrawtransactions", "1Address", false, 5) + }, + staticCmd: func() interface{} { + return btcjson.NewSearchRawTransactionsCmd("1Address", + btcjson.Bool(false), btcjson.Int(5), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",false,5],"id":1}`, + unmarshalled: &btcjson.SearchRawTransactionsCmd{ + Address: "1Address", + Verbose: btcjson.Bool(false), + Skip: btcjson.Int(5), + Count: btcjson.Int(100), + }, + }, + { + name: "searchrawtransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("searchrawtransactions", "1Address", false, 5, 10) + }, + staticCmd: func() interface{} { + return btcjson.NewSearchRawTransactionsCmd("1Address", + btcjson.Bool(false), btcjson.Int(5), btcjson.Int(10)) + }, + marshalled: `{"jsonrpc":"1.0","method":"searchrawtransactions","params":["1Address",false,5,10],"id":1}`, + unmarshalled: &btcjson.SearchRawTransactionsCmd{ + Address: "1Address", + Verbose: btcjson.Bool(false), + Skip: btcjson.Int(5), + Count: btcjson.Int(10), + }, + }, + { + name: "sendrawtransaction", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendrawtransaction", "1122") + }, + staticCmd: func() interface{} { + return btcjson.NewSendRawTransactionCmd("1122", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendrawtransaction","params":["1122"],"id":1}`, + unmarshalled: &btcjson.SendRawTransactionCmd{ + HexTx: "1122", + AllowHighFees: btcjson.Bool(false), + }, + }, + { + name: "sendrawtransaction optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendrawtransaction", "1122", false) + }, + staticCmd: func() interface{} { + return btcjson.NewSendRawTransactionCmd("1122", btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendrawtransaction","params":["1122",false],"id":1}`, + unmarshalled: &btcjson.SendRawTransactionCmd{ + HexTx: "1122", + AllowHighFees: btcjson.Bool(false), + }, + }, + { + name: "setgenerate", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("setgenerate", true) + }, + staticCmd: func() interface{} { + return btcjson.NewSetGenerateCmd(true, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"setgenerate","params":[true],"id":1}`, + unmarshalled: &btcjson.SetGenerateCmd{ + Generate: true, + GenProcLimit: btcjson.Int(-1), + }, + }, + { + name: "setgenerate optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("setgenerate", true, 6) + }, + staticCmd: func() interface{} { + return btcjson.NewSetGenerateCmd(true, btcjson.Int(6)) + }, + marshalled: `{"jsonrpc":"1.0","method":"setgenerate","params":[true,6],"id":1}`, + unmarshalled: &btcjson.SetGenerateCmd{ + Generate: true, + GenProcLimit: btcjson.Int(6), + }, + }, + { + name: "stop", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("stop") + }, + staticCmd: func() interface{} { + return btcjson.NewStopCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"stop","params":[],"id":1}`, + unmarshalled: &btcjson.StopCmd{}, + }, + { + name: "submitblock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("submitblock", "112233") + }, + staticCmd: func() interface{} { + return btcjson.NewSubmitBlockCmd("112233", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"submitblock","params":["112233"],"id":1}`, + unmarshalled: &btcjson.SubmitBlockCmd{ + HexBlock: "112233", + Options: nil, + }, + }, + { + name: "submitblock optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("submitblock", "112233", `{"workid":"12345"}`) + }, + staticCmd: func() interface{} { + options := btcjson.SubmitBlockOptions{ + WorkID: "12345", + } + return btcjson.NewSubmitBlockCmd("112233", &options) + }, + marshalled: `{"jsonrpc":"1.0","method":"submitblock","params":["112233",{"workid":"12345"}],"id":1}`, + unmarshalled: &btcjson.SubmitBlockCmd{ + HexBlock: "112233", + Options: &btcjson.SubmitBlockOptions{ + WorkID: "12345", + }, + }, + }, + { + name: "validateaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("validateaddress", "1Address") + }, + staticCmd: func() interface{} { + return btcjson.NewValidateAddressCmd("1Address") + }, + marshalled: `{"jsonrpc":"1.0","method":"validateaddress","params":["1Address"],"id":1}`, + unmarshalled: &btcjson.ValidateAddressCmd{ + Address: "1Address", + }, + }, + { + name: "verifychain", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("verifychain") + }, + staticCmd: func() interface{} { + return btcjson.NewVerifyChainCmd(nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"verifychain","params":[],"id":1}`, + unmarshalled: &btcjson.VerifyChainCmd{ + CheckLevel: btcjson.Int32(3), + CheckDepth: btcjson.Int32(288), + }, + }, + { + name: "verifychain optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("verifychain", 2) + }, + staticCmd: func() interface{} { + return btcjson.NewVerifyChainCmd(btcjson.Int32(2), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"verifychain","params":[2],"id":1}`, + unmarshalled: &btcjson.VerifyChainCmd{ + CheckLevel: btcjson.Int32(2), + CheckDepth: btcjson.Int32(288), + }, + }, + { + name: "verifychain optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("verifychain", 2, 500) + }, + staticCmd: func() interface{} { + return btcjson.NewVerifyChainCmd(btcjson.Int32(2), btcjson.Int32(500)) + }, + marshalled: `{"jsonrpc":"1.0","method":"verifychain","params":[2,500],"id":1}`, + unmarshalled: &btcjson.VerifyChainCmd{ + CheckLevel: btcjson.Int32(2), + CheckDepth: btcjson.Int32(500), + }, + }, + { + name: "verifymessage", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("verifymessage", "1Address", "301234", "test") + }, + staticCmd: func() interface{} { + return btcjson.NewVerifyMessageCmd("1Address", "301234", "test") + }, + marshalled: `{"jsonrpc":"1.0","method":"verifymessage","params":["1Address","301234","test"],"id":1}`, + unmarshalled: &btcjson.VerifyMessageCmd{ + Address: "1Address", + Signature: "301234", + Message: "test", + }, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the command as created by the new static command + // creation function. + marshalled, err := btcjson.MarshalCmd(testID, test.staticCmd()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the command is created without error via the generic + // new command creation function. + cmd, err := test.newCmd() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the command as created by the generic new command + // creation function. + marshalled, err = btcjson.MarshalCmd(testID, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} + +// TestChainSvrCmdErrors ensures any errors that occur in the command during +// custom mashal and unmarshal are as expected. +func TestChainSvrCmdErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + result interface{} + marshalled string + err error + }{ + { + name: "template request with invalid type", + result: &btcjson.TemplateRequest{}, + marshalled: `{"mode":1}`, + err: &json.UnmarshalTypeError{}, + }, + { + name: "invalid template request sigoplimit field", + result: &btcjson.TemplateRequest{}, + marshalled: `{"sigoplimit":"invalid"}`, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid template request sizelimit field", + result: &btcjson.TemplateRequest{}, + marshalled: `{"sizelimit":"invalid"}`, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + err := json.Unmarshal([]byte(test.marshalled), &test.result) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + + if terr, ok := test.err.(btcjson.Error); ok { + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != terr.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code "+ + "- got %v (%v), want %v", i, test.name, + gotErrorCode, terr, terr.ErrorCode) + continue + } + } + } +} diff --git a/v2/btcjson/chainsvrresults.go b/v2/btcjson/chainsvrresults.go new file mode 100644 index 00000000..60859f60 --- /dev/null +++ b/v2/btcjson/chainsvrresults.go @@ -0,0 +1,338 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import "encoding/json" + +// GetBlockVerboseResult models the data from the getblock command when the +// verbose flag is set. When the verbose flag is not set, getblock returns a +// hex-encoded string. +type GetBlockVerboseResult struct { + Hash string `json:"hash"` + Confirmations uint64 `json:"confirmations"` + Size int32 `json:"size"` + Height int64 `json:"height"` + Version int32 `json:"version"` + MerkleRoot string `json:"merkleroot"` + Tx []string `json:"tx,omitempty"` + RawTx []TxRawResult `json:"rawtx,omitempty"` + Time int64 `json:"time"` + Nonce uint32 `json:"nonce"` + Bits string `json:"bits"` + Difficulty float64 `json:"difficulty"` + PreviousHash string `json:"previousblockhash"` + NextHash string `json:"nextblockhash"` +} + +// CreateMultiSigResult models the data returned from the createmultisig +// command. +type CreateMultiSigResult struct { + Address string `json:"address"` + RedeemScript string `json:"redeemScript"` +} + +// DecodeScriptResult models the data returned from the decodescript command. +type DecodeScriptResult struct { + Asm string `json:"asm"` + ReqSigs int32 `json:"reqSigs,omitempty"` + Type string `json:"type"` + Addresses []string `json:"addresses,omitempty"` + P2sh string `json:"p2sh"` +} + +// GetAddedNodeInfoResultAddr models the data of the addresses portion of the +// getaddednodeinfo command. +type GetAddedNodeInfoResultAddr struct { + Address string `json:"address"` + Connected string `json:"connected"` +} + +// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. +type GetAddedNodeInfoResult struct { + AddedNode string `json:"addednode"` + Connected *bool `json:"connected,omitempty"` + Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` +} + +// GetBlockChainInfoResult models the data returned from the getblockchaininfo +// command. +type GetBlockChainInfoResult struct { + Chain string `json:"chain"` + Blocks int32 `json:"blocks"` + Headers int32 `json:"headers"` + BestBlockHash string `json:"bestblockhash"` + Difficulty float64 `json:"difficulty"` + VerificationProgress float64 `json:"verificationprogress"` + ChainWork string `json:"chainwork"` +} + +// GetBlockTemplateResultTx models the transactions field of the +// getblocktemplate command. +type GetBlockTemplateResultTx struct { + Data string `json:"data"` + Hash string `json:"hash"` + Depends []int64 `json:"depends"` + Fee int64 `json:"fee"` + SigOps int64 `json:"sigops"` +} + +// GetBlockTemplateResultAux models the coinbaseaux field of the +// getblocktemplate command. +type GetBlockTemplateResultAux struct { + Flags string `json:"flags"` +} + +// GetBlockTemplateResult models the data returned from the getblocktemplate +// command. +type GetBlockTemplateResult struct { + // Base fields from BIP 0022. CoinbaseAux is optional. One of + // CoinbaseTxn or CoinbaseValue must be specified, but not both. + Bits string `json:"bits"` + CurTime int64 `json:"curtime"` + Height int64 `json:"height"` + PreviousHash string `json:"previousblockhash"` + SigOpLimit int64 `json:"sigoplimit,omitempty"` + SizeLimit int64 `json:"sizelimit,omitempty"` + Transactions []GetBlockTemplateResultTx `json:"transactions"` + Version int32 `json:"version"` + CoinbaseAux *GetBlockTemplateResultAux `json:"coinbaseaux,omitempty"` + CoinbaseTxn *GetBlockTemplateResultTx `json:"coinbasetxn,omitempty"` + CoinbaseValue *int64 `json:"coinbasevalue,omitempty"` + WorkID string `json:"workid,omitempty"` + + // Optional long polling from BIP 0022. + LongPollID string `json:"longpollid,omitempty"` + LongPollURI string `json:"longpolluri,omitempty"` + SubmitOld *bool `json:"submitold,omitempty"` + + // Basic pool extension from BIP 0023. + Target string `json:"target,omitempty"` + Expires int64 `json:"expires,omitempty"` + + // Mutations from BIP 0023. + MaxTime int64 `json:"maxtime,omitempty"` + MinTime int64 `json:"mintime,omitempty"` + Mutable []string `json:"mutable,omitempty"` + NonceRange string `json:"noncerange,omitempty"` + + // Block proposal from BIP 0023. + Capabilities []string `json:"capabilities,omitempty"` + RejectReasion string `json:"reject-reason,omitempty"` +} + +// GetNetworkInfoResult models the data returned from the getnetworkinfo +// command. +type GetNetworkInfoResult struct { + Version int32 `json:"version"` + ProtocolVersion int32 `json:"protocolversion"` + TimeOffset int64 `json:"timeoffset"` + Connections int32 `json:"connections"` + Networks []NetworksResult `json:"networks"` + RelayFee float64 `json:"relayfee"` + LocalAddresses []LocalAddressesResult `json:"localaddresses"` +} + +// GetPeerInfoResult models the data returned from the getpeerinfo command. +type GetPeerInfoResult struct { + Addr string `json:"addr"` + AddrLocal string `json:"addrlocal,omitempty"` + Services string `json:"services"` + LastSend int64 `json:"lastsend"` + LastRecv int64 `json:"lastrecv"` + BytesSent uint64 `json:"bytessent"` + BytesRecv uint64 `json:"bytesrecv"` + PingTime float64 `json:"pingtime"` + PingWait float64 `json:"pingwait,omitempty"` + ConnTime int64 `json:"conntime"` + Version uint32 `json:"version"` + SubVer string `json:"subver"` + Inbound bool `json:"inbound"` + StartingHeight int32 `json:"startingheight"` + CurrentHeight int32 `json:"currentheight,omitempty"` + BanScore int32 `json:"banscore"` + SyncNode bool `json:"syncnode"` +} + +// GetRawMempoolVerboseResult models the data returned from the getrawmempool +// command when the verbose flag is set. When the verbose flag is not set, +// getrawmempool returns an array of transaction hashes. +type GetRawMempoolVerboseResult struct { + Size int32 `json:"size"` + Fee float64 `json:"fee"` + Time int64 `json:"time"` + Height int64 `json:"height"` + StartingPriority float64 `json:"startingpriority"` + CurrentPriority float64 `json:"currentpriority"` + Depends []string `json:"depends"` +} + +// ScriptPubKeyResult models the scriptPubKey data of a tx script. It is +// defined separately since it is used by multiple commands. +type ScriptPubKeyResult struct { + Asm string `json:"asm"` + Hex string `json:"hex,omitempty"` + ReqSigs int32 `json:"reqSigs,omitempty"` + Type string `json:"type"` + Addresses []string `json:"addresses,omitempty"` +} + +// GetTxOutResult models the data from the gettxout command. +type GetTxOutResult struct { + BestBlock string `json:"bestblock"` + Confirmations int64 `json:"confirmations"` + Value float64 `json:"value"` + ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"` + Version int32 `json:"version"` + Coinbase bool `json:"coinbase"` +} + +// GetNetTotalsResult models the data returned from the getnettotals command. +type GetNetTotalsResult struct { + TotalBytesRecv uint64 `json:"totalbytesrecv"` + TotalBytesSent uint64 `json:"totalbytessent"` + TimeMillis int64 `json:"timemillis"` +} + +// ScriptSig models a signature script. It is defined seperately since it only +// applies to non-coinbase. Therefore the field in the Vin structure needs +// to be a pointer. +type ScriptSig struct { + Asm string `json:"asm"` + Hex string `json:"hex"` +} + +// Vin models parts of the tx data. It is defined seperately since +// getrawtransaction, decoderawtransaction, and searchrawtransaction use the +// same structure. +type Vin struct { + Coinbase string `json:"coinbase"` + Txid string `json:"txid"` + Vout uint32 `json:"vout"` + ScriptSig *ScriptSig `json:"scriptSig"` + Sequence uint32 `json:"sequence"` +} + +// IsCoinBase returns a bool to show if a Vin is a Coinbase one or not. +func (v *Vin) IsCoinBase() bool { + return len(v.Coinbase) > 0 +} + +// MarshalJSON provides a custom Marshal method for Vin. +func (v *Vin) MarshalJSON() ([]byte, error) { + if v.IsCoinBase() { + coinbaseStruct := struct { + Coinbase string `json:"coinbase"` + Sequence uint32 `json:"sequence"` + }{ + Coinbase: v.Coinbase, + Sequence: v.Sequence, + } + return json.Marshal(coinbaseStruct) + } + + txStruct := struct { + Txid string `json:"txid"` + Vout uint32 `json:"vout"` + ScriptSig *ScriptSig `json:"scriptSig"` + Sequence uint32 `json:"sequence"` + }{ + Txid: v.Txid, + Vout: v.Vout, + ScriptSig: v.ScriptSig, + Sequence: v.Sequence, + } + return json.Marshal(txStruct) +} + +// Vout models parts of the tx data. It is defined seperately since both +// getrawtransaction and decoderawtransaction use the same structure. +type Vout struct { + Value float64 `json:"value"` + N uint32 `json:"n"` + ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"` +} + +// GetMiningInfoResult models the data from the getmininginfo command. +type GetMiningInfoResult struct { + Blocks int64 `json:"blocks"` + CurrentBlockSize uint64 `json:"currentblocksize"` + CurrentBlockTx uint64 `json:"currentblocktx"` + Difficulty float64 `json:"difficulty"` + Errors string `json:"errors"` + Generate bool `json:"generate"` + GenProcLimit int32 `json:"genproclimit"` + HashesPerSec int64 `json:"hashespersec"` + NetworkHashPS int64 `json:"networkhashps"` + PooledTx uint64 `json:"pooledtx"` + TestNet bool `json:"testnet"` +} + +// GetWorkResult models the data from the getwork command. +type GetWorkResult struct { + Data string `json:"data"` + Hash1 string `json:"hash1"` + Midstate string `json:"midstate"` + Target string `json:"target"` +} + +// InfoChainResult models the data returned by the chain server getinfo command. +type InfoChainResult struct { + Version int32 `json:"version"` + ProtocolVersion int32 `json:"protocolversion"` + Blocks int32 `json:"blocks"` + TimeOffset int64 `json:"timeoffset"` + Connections int32 `json:"connections"` + Proxy string `json:"proxy"` + Difficulty float64 `json:"difficulty"` + TestNet bool `json:"testnet"` + RelayFee float64 `json:"relayfee"` +} + +// LocalAddressesResult models the localaddresses data from the getnetworkinfo +// command. +type LocalAddressesResult struct { + Address string `json:"address"` + Port uint16 `json:"port"` + Score int32 `json:"score"` +} + +// NetworksResult models the networks data from the getnetworkinfo command. +type NetworksResult struct { + Name string `json:"name"` + Limited bool `json:"limited"` + Reachable bool `json:"reachable"` + Proxy string `json:"proxy"` +} + +// TxRawResult models the data from the getrawtransaction and +// searchrawtransaction commands. +type TxRawResult struct { + Hex string `json:"hex"` + Txid string `json:"txid"` + Version int32 `json:"version"` + LockTime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` + BlockHash string `json:"blockhash,omitempty"` + Confirmations uint64 `json:"confirmations"` + Time int64 `json:"time,omitempty"` + Blocktime int64 `json:"blocktime,omitempty"` +} + +// TxRawDecodeResult models the data from the decoderawtransaction command. +type TxRawDecodeResult struct { + Txid string `json:"txid"` + Version int32 `json:"version"` + Locktime uint32 `json:"locktime"` + Vin []Vin `json:"vin"` + Vout []Vout `json:"vout"` +} + +// ValidateAddressChainResult models the data returned by the chain server +// validateaddress command. +type ValidateAddressChainResult struct { + IsValid bool `json:"isvalid"` + Address string `json:"address,omitempty"` +} diff --git a/v2/btcjson/chainsvrresults_test.go b/v2/btcjson/chainsvrresults_test.go new file mode 100644 index 00000000..e1ce0b91 --- /dev/null +++ b/v2/btcjson/chainsvrresults_test.go @@ -0,0 +1,63 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "encoding/json" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestChainSvrCustomResults ensures any results that have custom marshalling +// work as inteded. +// and unmarshal code of results are as expected. +func TestChainSvrCustomResults(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + result interface{} + expected string + }{ + { + name: "custom vin marshal with coinbase", + result: &btcjson.Vin{ + Coinbase: "021234", + Sequence: 4294967295, + }, + expected: `{"coinbase":"021234","sequence":4294967295}`, + }, + { + name: "custom vin marshal without coinbase", + result: &btcjson.Vin{ + Txid: "123", + Vout: 1, + ScriptSig: &btcjson.ScriptSig{ + Asm: "0", + Hex: "00", + }, + Sequence: 4294967295, + }, + expected: `{"txid":"123","vout":1,"scriptSig":{"asm":"0","hex":"00"},"sequence":4294967295}`, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + marshalled, err := json.Marshal(test.result) + if err != nil { + t.Errorf("Test #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + if string(marshalled) != test.expected { + t.Errorf("Test #%d (%s) unexpected marhsalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.expected) + continue + } + } +} diff --git a/v2/btcjson/chainsvrwscmds.go b/v2/btcjson/chainsvrwscmds.go new file mode 100644 index 00000000..aae31d38 --- /dev/null +++ b/v2/btcjson/chainsvrwscmds.go @@ -0,0 +1,128 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC commands that are supported by +// a chain server, but are only available via websockets. + +package btcjson + +import ( + "github.com/btcsuite/btcd/wire" +) + +// AuthenticateCmd defines the authenticate JSON-RPC command. +type AuthenticateCmd struct { + Username string + Passphrase string +} + +// NewAuthenticateCmd returns a new instance which can be used to issue an +// authenticate JSON-RPC command. +func NewAuthenticateCmd(username, passphrase string) *AuthenticateCmd { + return &AuthenticateCmd{ + Username: username, + Passphrase: passphrase, + } +} + +// NotifyBlocksCmd defines the notifyblocks JSON-RPC command. +type NotifyBlocksCmd struct{} + +// NewNotifyBlocksCmd returns a new instance which can be used to issue a +// notifyblocks JSON-RPC command. +func NewNotifyBlocksCmd() *NotifyBlocksCmd { + return &NotifyBlocksCmd{} +} + +// NotifyNewTransactionsCmd defines the notifynewtransactions JSON-RPC command. +type NotifyNewTransactionsCmd struct { + Verbose *bool `jsonrpcdefault:"false"` +} + +// NewNotifyNewTransactionsCmd returns a new instance which can be used to issue +// a notifynewtransactions JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewNotifyNewTransactionsCmd(verbose *bool) *NotifyNewTransactionsCmd { + return &NotifyNewTransactionsCmd{ + Verbose: verbose, + } +} + +// NotifyReceivedCmd defines the notifyreceived JSON-RPC command. +type NotifyReceivedCmd struct { + Addresses []string +} + +// NewNotifyReceivedCmd returns a new instance which can be used to issue a +// notifyreceived JSON-RPC command. +func NewNotifyReceivedCmd(addresses []string) *NotifyReceivedCmd { + return &NotifyReceivedCmd{ + Addresses: addresses, + } +} + +// OutPoint describes a transaction outpoint that will be marshalled to and +// from JSON. +type OutPoint struct { + Hash string `json:"hash"` + Index uint32 `json:"index"` +} + +// NewOutPointFromWire creates a new OutPoint from the OutPoint structure +// of the btcwire package. +func NewOutPointFromWire(op *wire.OutPoint) *OutPoint { + return &OutPoint{ + Hash: op.Hash.String(), + Index: op.Index, + } +} + +// NotifySpentCmd defines the notifyspent JSON-RPC command. +type NotifySpentCmd struct { + OutPoints []OutPoint +} + +// NewNotifySpentCmd returns a new instance which can be used to issue a +// notifyspent JSON-RPC command. +func NewNotifySpentCmd(outPoints []OutPoint) *NotifySpentCmd { + return &NotifySpentCmd{ + OutPoints: outPoints, + } +} + +// RescanCmd defines the rescan JSON-RPC command. +type RescanCmd struct { + BeginBlock string + Addresses []string + OutPoints []OutPoint + EndBlock *string +} + +// NewRescanCmd returns a new instance which can be used to issue a rescan +// JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewRescanCmd(beginBlock string, addresses []string, outPoints []OutPoint, endBlock *string) *RescanCmd { + return &RescanCmd{ + BeginBlock: beginBlock, + Addresses: addresses, + OutPoints: outPoints, + EndBlock: endBlock, + } +} + +func init() { + // The commands in this file are only usable by websockets. + flags := UFWebsocketOnly + + MustRegisterCmd("authenticate", (*AuthenticateCmd)(nil), flags) + MustRegisterCmd("notifyblocks", (*NotifyBlocksCmd)(nil), flags) + MustRegisterCmd("notifynewtransactions", (*NotifyNewTransactionsCmd)(nil), flags) + MustRegisterCmd("notifyreceived", (*NotifyReceivedCmd)(nil), flags) + MustRegisterCmd("notifyspent", (*NotifySpentCmd)(nil), flags) + MustRegisterCmd("rescan", (*RescanCmd)(nil), flags) +} diff --git a/v2/btcjson/chainsvrwscmds_test.go b/v2/btcjson/chainsvrwscmds_test.go new file mode 100644 index 00000000..11fe68bb --- /dev/null +++ b/v2/btcjson/chainsvrwscmds_test.go @@ -0,0 +1,213 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestChainSvrWsCmds tests all of the chain server websocket-specific commands +// marshal and unmarshal into valid results include handling of optional fields +// being omitted in the marshalled command, while optional fields with defaults +// have the default assigned on unmarshalled commands. +func TestChainSvrWsCmds(t *testing.T) { + t.Parallel() + + testID := int(1) + tests := []struct { + name string + newCmd func() (interface{}, error) + staticCmd func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "authenticate", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("authenticate", "user", "pass") + }, + staticCmd: func() interface{} { + return btcjson.NewAuthenticateCmd("user", "pass") + }, + marshalled: `{"jsonrpc":"1.0","method":"authenticate","params":["user","pass"],"id":1}`, + unmarshalled: &btcjson.AuthenticateCmd{Username: "user", Passphrase: "pass"}, + }, + { + name: "notifyblocks", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("notifyblocks") + }, + staticCmd: func() interface{} { + return btcjson.NewNotifyBlocksCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"notifyblocks","params":[],"id":1}`, + unmarshalled: &btcjson.NotifyBlocksCmd{}, + }, + { + name: "notifynewtransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("notifynewtransactions") + }, + staticCmd: func() interface{} { + return btcjson.NewNotifyNewTransactionsCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"notifynewtransactions","params":[],"id":1}`, + unmarshalled: &btcjson.NotifyNewTransactionsCmd{ + Verbose: btcjson.Bool(false), + }, + }, + { + name: "notifynewtransactions optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("notifynewtransactions", true) + }, + staticCmd: func() interface{} { + return btcjson.NewNotifyNewTransactionsCmd(btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"notifynewtransactions","params":[true],"id":1}`, + unmarshalled: &btcjson.NotifyNewTransactionsCmd{ + Verbose: btcjson.Bool(true), + }, + }, + { + name: "notifyreceived", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("notifyreceived", []string{"1Address"}) + }, + staticCmd: func() interface{} { + return btcjson.NewNotifyReceivedCmd([]string{"1Address"}) + }, + marshalled: `{"jsonrpc":"1.0","method":"notifyreceived","params":[["1Address"]],"id":1}`, + unmarshalled: &btcjson.NotifyReceivedCmd{ + Addresses: []string{"1Address"}, + }, + }, + { + name: "notifyspent", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("notifyspent", `[{"hash":"123","index":0}]`) + }, + staticCmd: func() interface{} { + ops := []btcjson.OutPoint{{Hash: "123", Index: 0}} + return btcjson.NewNotifySpentCmd(ops) + }, + marshalled: `{"jsonrpc":"1.0","method":"notifyspent","params":[[{"hash":"123","index":0}]],"id":1}`, + unmarshalled: &btcjson.NotifySpentCmd{ + OutPoints: []btcjson.OutPoint{{Hash: "123", Index: 0}}, + }, + }, + { + name: "rescan", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("rescan", "123", `["1Address"]`, `[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]`) + }, + staticCmd: func() interface{} { + addrs := []string{"1Address"} + hash, _ := wire.NewShaHashFromStr("123") + op := wire.NewOutPoint(hash, 0) + ops := []btcjson.OutPoint{*btcjson.NewOutPointFromWire(op)} + return btcjson.NewRescanCmd("123", addrs, ops, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"rescan","params":["123",["1Address"],[{"hash":"0000000000000000000000000000000000000000000000000000000000000123","index":0}]],"id":1}`, + unmarshalled: &btcjson.RescanCmd{ + BeginBlock: "123", + Addresses: []string{"1Address"}, + OutPoints: []btcjson.OutPoint{{Hash: "0000000000000000000000000000000000000000000000000000000000000123", Index: 0}}, + EndBlock: nil, + }, + }, + { + name: "rescan optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("rescan", "123", `["1Address"]`, `[{"hash":"123","index":0}]`, "456") + }, + staticCmd: func() interface{} { + addrs := []string{"1Address"} + ops := []btcjson.OutPoint{{Hash: "123", Index: 0}} + return btcjson.NewRescanCmd("123", addrs, ops, btcjson.String("456")) + }, + marshalled: `{"jsonrpc":"1.0","method":"rescan","params":["123",["1Address"],[{"hash":"123","index":0}],"456"],"id":1}`, + unmarshalled: &btcjson.RescanCmd{ + BeginBlock: "123", + Addresses: []string{"1Address"}, + OutPoints: []btcjson.OutPoint{{Hash: "123", Index: 0}}, + EndBlock: btcjson.String("456"), + }, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the command as created by the new static command + // creation function. + marshalled, err := btcjson.MarshalCmd(testID, test.staticCmd()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the command is created without error via the generic + // new command creation function. + cmd, err := test.newCmd() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the command as created by the generic new command + // creation function. + marshalled, err = btcjson.MarshalCmd(testID, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} diff --git a/v2/btcjson/chainsvrwsntfns.go b/v2/btcjson/chainsvrwsntfns.go new file mode 100644 index 00000000..8a8ef4b3 --- /dev/null +++ b/v2/btcjson/chainsvrwsntfns.go @@ -0,0 +1,192 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC websocket notifications that are +// supported by a chain server. + +package btcjson + +const ( + // BlockConnectedNtfnMethod is the method used for notifications from + // the chain server that a block has been connected. + BlockConnectedNtfnMethod = "blockconnected" + + // BlockDisconnectedNtfnMethod is the method used for notifications from + // the chain server that a block has been disconnected. + BlockDisconnectedNtfnMethod = "blockdisconnected" + + // RecvTxNtfnMethod is the method used for notifications from the chain + // server that a transaction which pays to a registered address has been + // processed. + RecvTxNtfnMethod = "recvtx" + + // RedeemingTxNtfnMethod is the method used for notifications from the + // chain server that a transaction which spends a registered outpoint + // has been processed. + RedeemingTxNtfnMethod = "redeemingtx" + + // RescanFinishedNtfnMethod is the method used for notifications from + // the chain server that a rescan operation has finished. + RescanFinishedNtfnMethod = "rescanfinished" + + // RescanProgressNtfnMethod is the method used for notifications from + // the chain server that a rescan operation this is underway has made + // progress. + RescanProgressNtfnMethod = "rescanprogress" + + // TxAcceptedNtfnMethod is the method used for notifications from the + // chain server that a transaction has been accepted into the mempool. + TxAcceptedNtfnMethod = "txaccepted" + + // TxAcceptedVerboseNtfnMethod is the method used for notifications from + // the chain server that a transaction has been accepted into the + // mempool. This differs from TxAcceptedNtfnMethod in that it provides + // more details in the notification. + TxAcceptedVerboseNtfnMethod = "txacceptedverbose" +) + +// BlockConnectedNtfn defines the blockconnected JSON-RPC notification. +type BlockConnectedNtfn struct { + Hash string + Height int32 +} + +// NewBlockConnectedNtfn returns a new instance which can be used to issue a +// blockconnected JSON-RPC notification. +func NewBlockConnectedNtfn(hash string, height int32) *BlockConnectedNtfn { + return &BlockConnectedNtfn{ + Hash: hash, + Height: height, + } +} + +// BlockDisconnectedNtfn defines the blockdisconnected JSON-RPC notification. +type BlockDisconnectedNtfn struct { + Hash string + Height int32 +} + +// NewBlockDisconnectedNtfn returns a new instance which can be used to issue a +// blockdisconnected JSON-RPC notification. +func NewBlockDisconnectedNtfn(hash string, height int32) *BlockDisconnectedNtfn { + return &BlockDisconnectedNtfn{ + Hash: hash, + Height: height, + } +} + +// BlockDetails describes details of a tx in a block. +type BlockDetails struct { + Height int32 `json:"height"` + Hash string `json:"hash"` + Index int `json:"index"` + Time int64 `json:"time"` +} + +// RecvTxNtfn defines the recvtx JSON-RPC notification. +type RecvTxNtfn struct { + HexTx string + Block BlockDetails +} + +// NewRecvTxNtfn returns a new instance which can be used to issue a recvtx +// JSON-RPC notification. +func NewRecvTxNtfn(hexTx string, block BlockDetails) *RecvTxNtfn { + return &RecvTxNtfn{ + HexTx: hexTx, + Block: block, + } +} + +// RedeemingTxNtfn defines the redeemingtx JSON-RPC notification. +type RedeemingTxNtfn struct { + HexTx string + Block BlockDetails +} + +// NewRedeemingTxNtfn returns a new instance which can be used to issue a +// redeemingtx JSON-RPC notification. +func NewRedeemingTxNtfn(hexTx string, block BlockDetails) *RedeemingTxNtfn { + return &RedeemingTxNtfn{ + HexTx: hexTx, + Block: block, + } +} + +// RescanFinishedNtfn defines the rescanfinished JSON-RPC notification. +type RescanFinishedNtfn struct { + Hash string + Height int32 + Time int64 +} + +// NewRescanFinishedNtfn returns a new instance which can be used to issue a +// rescanfinished JSON-RPC notification. +func NewRescanFinishedNtfn(hash string, height int32, time int64) *RescanFinishedNtfn { + return &RescanFinishedNtfn{ + Hash: hash, + Height: height, + Time: time, + } +} + +// RescanProgressNtfn defines the rescanprogress JSON-RPC notification. +type RescanProgressNtfn struct { + Hash string + Height int32 + Time int64 +} + +// NewRescanProgressNtfn returns a new instance which can be used to issue a +// rescanprogress JSON-RPC notification. +func NewRescanProgressNtfn(hash string, height int32, time int64) *RescanProgressNtfn { + return &RescanProgressNtfn{ + Hash: hash, + Height: height, + Time: time, + } +} + +// TxAcceptedNtfn defines the txaccepted JSON-RPC notification. +type TxAcceptedNtfn struct { + TxID string + Amount float64 +} + +// NewTxAcceptedNtfn returns a new instance which can be used to issue a +// txaccepted JSON-RPC notification. +func NewTxAcceptedNtfn(txHash string, amount float64) *TxAcceptedNtfn { + return &TxAcceptedNtfn{ + TxID: txHash, + Amount: amount, + } +} + +// TxAcceptedVerboseNtfn defines the txacceptedverbose JSON-RPC notification. +type TxAcceptedVerboseNtfn struct { + RawTx TxRawResult +} + +// NewTxAcceptedVerboseNtfn returns a new instance which can be used to issue a +// txacceptedverbose JSON-RPC notification. +func NewTxAcceptedVerboseNtfn(rawTx TxRawResult) *TxAcceptedVerboseNtfn { + return &TxAcceptedVerboseNtfn{ + RawTx: rawTx, + } +} + +func init() { + // The commands in this file are only usable by websockets and are + // notifications. + flags := UFWebsocketOnly | UFNotification + + MustRegisterCmd(BlockConnectedNtfnMethod, (*BlockConnectedNtfn)(nil), flags) + MustRegisterCmd(BlockDisconnectedNtfnMethod, (*BlockDisconnectedNtfn)(nil), flags) + MustRegisterCmd(RecvTxNtfnMethod, (*RecvTxNtfn)(nil), flags) + MustRegisterCmd(RedeemingTxNtfnMethod, (*RedeemingTxNtfn)(nil), flags) + MustRegisterCmd(RescanFinishedNtfnMethod, (*RescanFinishedNtfn)(nil), flags) + MustRegisterCmd(RescanProgressNtfnMethod, (*RescanProgressNtfn)(nil), flags) + MustRegisterCmd(TxAcceptedNtfnMethod, (*TxAcceptedNtfn)(nil), flags) + MustRegisterCmd(TxAcceptedVerboseNtfnMethod, (*TxAcceptedVerboseNtfn)(nil), flags) +} diff --git a/v2/btcjson/chainsvrwsntfns_test.go b/v2/btcjson/chainsvrwsntfns_test.go new file mode 100644 index 00000000..1b8c88d3 --- /dev/null +++ b/v2/btcjson/chainsvrwsntfns_test.go @@ -0,0 +1,251 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestChainSvrWsNtfns tests all of the chain server websocket-specific +// notifications marshal and unmarshal into valid results include handling of +// optional fields being omitted in the marshalled command, while optional +// fields with defaults have the default assigned on unmarshalled commands. +func TestChainSvrWsNtfns(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + newNtfn func() (interface{}, error) + staticNtfn func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "blockconnected", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("blockconnected", "123", 100000) + }, + staticNtfn: func() interface{} { + return btcjson.NewBlockConnectedNtfn("123", 100000) + }, + marshalled: `{"jsonrpc":"1.0","method":"blockconnected","params":["123",100000],"id":null}`, + unmarshalled: &btcjson.BlockConnectedNtfn{ + Hash: "123", + Height: 100000, + }, + }, + { + name: "blockdisconnected", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("blockdisconnected", "123", 100000) + }, + staticNtfn: func() interface{} { + return btcjson.NewBlockDisconnectedNtfn("123", 100000) + }, + marshalled: `{"jsonrpc":"1.0","method":"blockdisconnected","params":["123",100000],"id":null}`, + unmarshalled: &btcjson.BlockDisconnectedNtfn{ + Hash: "123", + Height: 100000, + }, + }, + { + name: "recvtx", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("recvtx", "001122", `{"height":100000,"hash":"123","index":0,"time":12345678}`) + }, + staticNtfn: func() interface{} { + blockDetails := btcjson.BlockDetails{ + Height: 100000, + Hash: "123", + Index: 0, + Time: 12345678, + } + return btcjson.NewRecvTxNtfn("001122", blockDetails) + }, + marshalled: `{"jsonrpc":"1.0","method":"recvtx","params":["001122",{"height":100000,"hash":"123","index":0,"time":12345678}],"id":null}`, + unmarshalled: &btcjson.RecvTxNtfn{ + HexTx: "001122", + Block: btcjson.BlockDetails{ + Height: 100000, + Hash: "123", + Index: 0, + Time: 12345678, + }, + }, + }, + { + name: "redeemingtx", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("redeemingtx", "001122", `{"height":100000,"hash":"123","index":0,"time":12345678}`) + }, + staticNtfn: func() interface{} { + blockDetails := btcjson.BlockDetails{ + Height: 100000, + Hash: "123", + Index: 0, + Time: 12345678, + } + return btcjson.NewRedeemingTxNtfn("001122", blockDetails) + }, + marshalled: `{"jsonrpc":"1.0","method":"redeemingtx","params":["001122",{"height":100000,"hash":"123","index":0,"time":12345678}],"id":null}`, + unmarshalled: &btcjson.RedeemingTxNtfn{ + HexTx: "001122", + Block: btcjson.BlockDetails{ + Height: 100000, + Hash: "123", + Index: 0, + Time: 12345678, + }, + }, + }, + { + name: "rescanfinished", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("rescanfinished", "123", 100000, 12345678) + }, + staticNtfn: func() interface{} { + return btcjson.NewRescanFinishedNtfn("123", 100000, 12345678) + }, + marshalled: `{"jsonrpc":"1.0","method":"rescanfinished","params":["123",100000,12345678],"id":null}`, + unmarshalled: &btcjson.RescanFinishedNtfn{ + Hash: "123", + Height: 100000, + Time: 12345678, + }, + }, + { + name: "rescanprogress", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("rescanprogress", "123", 100000, 12345678) + }, + staticNtfn: func() interface{} { + return btcjson.NewRescanProgressNtfn("123", 100000, 12345678) + }, + marshalled: `{"jsonrpc":"1.0","method":"rescanprogress","params":["123",100000,12345678],"id":null}`, + unmarshalled: &btcjson.RescanProgressNtfn{ + Hash: "123", + Height: 100000, + Time: 12345678, + }, + }, + { + name: "txaccepted", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("txaccepted", "123", 1.5) + }, + staticNtfn: func() interface{} { + return btcjson.NewTxAcceptedNtfn("123", 1.5) + }, + marshalled: `{"jsonrpc":"1.0","method":"txaccepted","params":["123",1.5],"id":null}`, + unmarshalled: &btcjson.TxAcceptedNtfn{ + TxID: "123", + Amount: 1.5, + }, + }, + { + name: "txacceptedverbose", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("txacceptedverbose", `{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null,"confirmations":0}`) + }, + staticNtfn: func() interface{} { + txResult := btcjson.TxRawResult{ + Hex: "001122", + Txid: "123", + Version: 1, + LockTime: 4294967295, + Vin: nil, + Vout: nil, + Confirmations: 0, + } + return btcjson.NewTxAcceptedVerboseNtfn(txResult) + }, + marshalled: `{"jsonrpc":"1.0","method":"txacceptedverbose","params":[{"hex":"001122","txid":"123","version":1,"locktime":4294967295,"vin":null,"vout":null,"confirmations":0}],"id":null}`, + unmarshalled: &btcjson.TxAcceptedVerboseNtfn{ + RawTx: btcjson.TxRawResult{ + Hex: "001122", + Txid: "123", + Version: 1, + LockTime: 4294967295, + Vin: nil, + Vout: nil, + Confirmations: 0, + }, + }, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the notification as created by the new static + // creation function. The ID is nil for notifications. + marshalled, err := btcjson.MarshalCmd(nil, test.staticNtfn()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the notification is created without error via the + // generic new notification creation function. + cmd, err := test.newNtfn() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the notification as created by the generic new + // notification creation function. The ID is nil for + // notifications. + marshalled, err = btcjson.MarshalCmd(nil, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} diff --git a/v2/btcjson/cmdinfo.go b/v2/btcjson/cmdinfo.go new file mode 100644 index 00000000..84799a21 --- /dev/null +++ b/v2/btcjson/cmdinfo.go @@ -0,0 +1,249 @@ +// Copyright (c) 2015 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "fmt" + "reflect" + "strings" +) + +// CmdMethod returns the method for the passed command. The provided command +// type must be a registered type. All commands provided by this package are +// registered by default. +func CmdMethod(cmd interface{}) (string, error) { + // Look up the cmd type and error out if not registered. + rt := reflect.TypeOf(cmd) + registerLock.RLock() + method, ok := concreteTypeToMethod[rt] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", method) + return "", makeError(ErrUnregisteredMethod, str) + } + + return method, nil +} + +// MethodUsageFlags returns the usage flags for the passed command method. The +// provided method must be associated with a registered type. All commands +// provided by this package are registered by default. +func MethodUsageFlags(method string) (UsageFlag, error) { + // Look up details about the provided method and error out if not + // registered. + registerLock.RLock() + info, ok := methodToInfo[method] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", method) + return 0, makeError(ErrUnregisteredMethod, str) + } + + return info.flags, nil +} + +// subStructUsage returns a string for use in the one-line usage for the given +// sub struct. Note that this is specifically for fields which consist of +// structs (or an array/slice of structs) as opposed to the top-level command +// struct. +// +// Any fields that include a jsonrpcusage struct tag will use that instead of +// being automatically generated. +func subStructUsage(structType reflect.Type) string { + numFields := structType.NumField() + fieldUsages := make([]string, 0, numFields) + for i := 0; i < structType.NumField(); i++ { + rtf := structType.Field(i) + + // When the field has a jsonrpcusage struct tag specified use + // that instead of automatically generating it. + if tag := rtf.Tag.Get("jsonrpcusage"); tag != "" { + fieldUsages = append(fieldUsages, tag) + continue + } + + // Create the name/value entry for the field while considering + // the type of the field. Not all possibile types are covered + // here and when one of the types not specifically covered is + // encountered, the field name is simply reused for the value. + fieldName := strings.ToLower(rtf.Name) + fieldValue := fieldName + fieldKind := rtf.Type.Kind() + switch { + case isNumeric(fieldKind): + if fieldKind == reflect.Float32 || fieldKind == reflect.Float64 { + fieldValue = "n.nnn" + } else { + fieldValue = "n" + } + case fieldKind == reflect.String: + fieldValue = `"value"` + + case fieldKind == reflect.Struct: + fieldValue = subStructUsage(rtf.Type) + + case fieldKind == reflect.Array || fieldKind == reflect.Slice: + fieldValue = subArrayUsage(rtf.Type, fieldName) + } + + usage := fmt.Sprintf("%q:%s", fieldName, fieldValue) + fieldUsages = append(fieldUsages, usage) + } + + return fmt.Sprintf("{%s}", strings.Join(fieldUsages, ",")) +} + +// subArrayUsage returns a string for use in the one-line usage for the given +// array or slice. It also contains logic to convert plural field names to +// singular so the generated usage string reads better. +func subArrayUsage(arrayType reflect.Type, fieldName string) string { + // Convert plural field names to singular. Only works for English. + singularFieldName := fieldName + if strings.HasSuffix(fieldName, "ies") { + singularFieldName = strings.TrimSuffix(fieldName, "ies") + singularFieldName = singularFieldName + "y" + } else if strings.HasSuffix(fieldName, "es") { + singularFieldName = strings.TrimSuffix(fieldName, "es") + } else if strings.HasSuffix(fieldName, "s") { + singularFieldName = strings.TrimSuffix(fieldName, "s") + } + + elemType := arrayType.Elem() + switch elemType.Kind() { + case reflect.String: + return fmt.Sprintf("[%q,...]", singularFieldName) + + case reflect.Struct: + return fmt.Sprintf("[%s,...]", subStructUsage(elemType)) + } + + // Fall back to simply showing the field name in array syntax. + return fmt.Sprintf(`[%s,...]`, singularFieldName) +} + +// fieldUsage returns a string for use in the one-line usage for the struct +// field of a command. +// +// Any fields that include a jsonrpcusage struct tag will use that instead of +// being automatically generated. +func fieldUsage(structField reflect.StructField, defaultVal *reflect.Value) string { + // When the field has a jsonrpcusage struct tag specified use that + // instead of automatically generating it. + if tag := structField.Tag.Get("jsonrpcusage"); tag != "" { + return tag + } + + // Indirect the pointer if needed. + fieldType := structField.Type + if fieldType.Kind() == reflect.Ptr { + fieldType = fieldType.Elem() + } + + // When there is a default value, it must also be a pointer due to the + // rules enforced by RegisterCmd. + if defaultVal != nil { + indirect := defaultVal.Elem() + defaultVal = &indirect + } + + // Handle certain types uniquely to provide nicer usage. + fieldName := strings.ToLower(structField.Name) + switch fieldType.Kind() { + case reflect.String: + if defaultVal != nil { + return fmt.Sprintf("%s=%q", fieldName, + defaultVal.Interface()) + } + + return fmt.Sprintf("%q", fieldName) + + case reflect.Array, reflect.Slice: + return subArrayUsage(fieldType, fieldName) + + case reflect.Struct: + return subStructUsage(fieldType) + } + + // Simply return the field name when none of the above special cases + // apply. + if defaultVal != nil { + return fmt.Sprintf("%s=%v", fieldName, defaultVal.Interface()) + } + return fieldName +} + +// methodUsageText returns a one-line usage string for the provided command and +// method info. This is the main work horse for the exported MethodUsageText +// function. +func methodUsageText(rtp reflect.Type, defaults map[int]reflect.Value, method string) string { + // Generate the individual usage for each field in the command. Several + // simplifying assumptions are made here because the RegisterCmd + // function has already rigorously enforced the layout. + rt := rtp.Elem() + numFields := rt.NumField() + reqFieldUsages := make([]string, 0, numFields) + optFieldUsages := make([]string, 0, numFields) + for i := 0; i < numFields; i++ { + rtf := rt.Field(i) + var isOptional bool + if kind := rtf.Type.Kind(); kind == reflect.Ptr { + isOptional = true + } + + var defaultVal *reflect.Value + if defVal, ok := defaults[i]; ok { + defaultVal = &defVal + } + + // Add human-readable usage to the appropriate slice that is + // later used to generate the one-line usage. + usage := fieldUsage(rtf, defaultVal) + if isOptional { + optFieldUsages = append(optFieldUsages, usage) + } else { + reqFieldUsages = append(reqFieldUsages, usage) + } + } + + // Generate and return the one-line usage string. + usageStr := method + if len(reqFieldUsages) > 0 { + usageStr += " " + strings.Join(reqFieldUsages, " ") + } + if len(optFieldUsages) > 0 { + usageStr += fmt.Sprintf(" (%s)", strings.Join(optFieldUsages, " ")) + } + return usageStr +} + +// MethodUsageText returns a one-line usage string for the provided method. The +// provided method must be associated with a registered type. All commands +// provided by this package are registered by default. +func MethodUsageText(method string) (string, error) { + // Look up details about the provided method and error out if not + // registered. + registerLock.RLock() + rtp, ok := methodToConcreteType[method] + info := methodToInfo[method] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", method) + return "", makeError(ErrUnregisteredMethod, str) + } + + // When the usage for this method has already been generated, simply + // return it. + if info.usage != "" { + return info.usage, nil + } + + // Generate and store the usage string for future calls and return it. + usage := methodUsageText(rtp, info.defaults, method) + registerLock.Lock() + info.usage = usage + methodToInfo[method] = info + registerLock.Unlock() + return usage, nil +} diff --git a/v2/btcjson/cmdinfo_test.go b/v2/btcjson/cmdinfo_test.go new file mode 100644 index 00000000..8be185e5 --- /dev/null +++ b/v2/btcjson/cmdinfo_test.go @@ -0,0 +1,430 @@ +// Copyright (c) 2015 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestCmdMethod tests the CmdMethod function to ensure it retuns the expected +// methods and errors. +func TestCmdMethod(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + cmd interface{} + method string + err error + }{ + { + name: "unregistered type", + cmd: (*int)(nil), + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "nil pointer of registered type", + cmd: (*btcjson.GetBlockCmd)(nil), + method: "getblock", + }, + { + name: "nil instance of registered type", + cmd: &btcjson.GetBlockCountCmd{}, + method: "getblockcount", + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + method, err := btcjson.CmdMethod(test.cmd) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[3]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + if err != nil { + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.(btcjson.Error).ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code "+ + "- got %v (%v), want %v", i, test.name, + gotErrorCode, err, + test.err.(btcjson.Error).ErrorCode) + continue + } + + continue + } + + // Ensure method matches the expected value. + if method != test.method { + t.Errorf("Test #%d (%s) mismatched method - got %v, "+ + "want %v", i, test.name, method, test.method) + continue + } + } +} + +// TestMethodUsageFlags tests the MethodUsage function ensure it returns the +// expected flags and errors. +func TestMethodUsageFlags(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + err error + flags btcjson.UsageFlag + }{ + { + name: "unregistered type", + method: "bogusmethod", + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "getblock", + method: "getblock", + flags: 0, + }, + { + name: "walletpassphrase", + method: "walletpassphrase", + flags: btcjson.UFWalletOnly, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + flags, err := btcjson.MethodUsageFlags(test.method) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[3]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + if err != nil { + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.(btcjson.Error).ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code "+ + "- got %v (%v), want %v", i, test.name, + gotErrorCode, err, + test.err.(btcjson.Error).ErrorCode) + continue + } + + continue + } + + // Ensure flags match the expected value. + if flags != test.flags { + t.Errorf("Test #%d (%s) mismatched flags - got %v, "+ + "want %v", i, test.name, flags, test.flags) + continue + } + } +} + +// TestMethodUsageText tests the MethodUsageText function ensure it returns the +// expected text. +func TestMethodUsageText(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + err error + expected string + }{ + { + name: "unregistered type", + method: "bogusmethod", + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "getblockcount", + method: "getblockcount", + expected: "getblockcount", + }, + { + name: "getblock", + method: "getblock", + expected: `getblock "hash" (verbose=true verbosetx=false)`, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + usage, err := btcjson.MethodUsageText(test.method) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[3]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + if err != nil { + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.(btcjson.Error).ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code "+ + "- got %v (%v), want %v", i, test.name, + gotErrorCode, err, + test.err.(btcjson.Error).ErrorCode) + continue + } + + continue + } + + // Ensure usage matches the expected value. + if usage != test.expected { + t.Errorf("Test #%d (%s) mismatched usage - got %v, "+ + "want %v", i, test.name, usage, test.expected) + continue + } + + // Get the usage again to excerise caching. + usage, err = btcjson.MethodUsageText(test.method) + if err != nil { + t.Errorf("Test #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + // Ensure usage still matches the expected value. + if usage != test.expected { + t.Errorf("Test #%d (%s) mismatched usage - got %v, "+ + "want %v", i, test.name, usage, test.expected) + continue + } + } +} + +// TestFieldUsage tests the internal fieldUsage function ensure it returns the +// expected text. +func TestFieldUsage(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + field reflect.StructField + defValue *reflect.Value + expected string + }{ + { + name: "jsonrpcusage tag override", + field: func() reflect.StructField { + type s struct { + Test int `jsonrpcusage:"testvalue"` + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: "testvalue", + }, + { + name: "generic interface", + field: func() reflect.StructField { + type s struct { + Test interface{} + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `test`, + }, + { + name: "string without default value", + field: func() reflect.StructField { + type s struct { + Test string + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `"test"`, + }, + { + name: "string with default value", + field: func() reflect.StructField { + type s struct { + Test string + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: func() *reflect.Value { + value := "default" + rv := reflect.ValueOf(&value) + return &rv + }(), + expected: `test="default"`, + }, + { + name: "array of strings", + field: func() reflect.StructField { + type s struct { + Test []string + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `["test",...]`, + }, + { + name: "array of strings with plural field name 1", + field: func() reflect.StructField { + type s struct { + Keys []string + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `["key",...]`, + }, + { + name: "array of strings with plural field name 2", + field: func() reflect.StructField { + type s struct { + Addresses []string + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `["address",...]`, + }, + { + name: "array of strings with plural field name 3", + field: func() reflect.StructField { + type s struct { + Capabilities []string + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `["capability",...]`, + }, + { + name: "array of structs", + field: func() reflect.StructField { + type s2 struct { + Txid string + } + type s struct { + Capabilities []s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `[{"txid":"value"},...]`, + }, + { + name: "array of ints", + field: func() reflect.StructField { + type s struct { + Test []int + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `[test,...]`, + }, + { + name: "sub struct with jsonrpcusage tag override", + field: func() reflect.StructField { + type s2 struct { + Test string `jsonrpcusage:"testusage"` + } + type s struct { + Test s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `{testusage}`, + }, + { + name: "sub struct with string", + field: func() reflect.StructField { + type s2 struct { + Txid string + } + type s struct { + Test s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `{"txid":"value"}`, + }, + { + name: "sub struct with int", + field: func() reflect.StructField { + type s2 struct { + Vout int + } + type s struct { + Test s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `{"vout":n}`, + }, + { + name: "sub struct with float", + field: func() reflect.StructField { + type s2 struct { + Amount float64 + } + type s struct { + Test s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `{"amount":n.nnn}`, + }, + { + name: "sub struct with sub struct", + field: func() reflect.StructField { + type s3 struct { + Amount float64 + } + type s2 struct { + Template s3 + } + type s struct { + Test s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `{"template":{"amount":n.nnn}}`, + }, + { + name: "sub struct with slice", + field: func() reflect.StructField { + type s2 struct { + Capabilities []string + } + type s struct { + Test s2 + } + return reflect.TypeOf((*s)(nil)).Elem().Field(0) + }(), + defValue: nil, + expected: `{"capabilities":["capability",...]}`, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Ensure usage matches the expected value. + usage := btcjson.TstFieldUsage(test.field, test.defValue) + if usage != test.expected { + t.Errorf("Test #%d (%s) mismatched usage - got %v, "+ + "want %v", i, test.name, usage, test.expected) + continue + } + } +} diff --git a/v2/btcjson/cmdparse.go b/v2/btcjson/cmdparse.go new file mode 100644 index 00000000..fbd2a919 --- /dev/null +++ b/v2/btcjson/cmdparse.go @@ -0,0 +1,550 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "encoding/json" + "fmt" + "reflect" + "strconv" + "strings" +) + +// makeParams creates a slice of interface values for the given struct. +func makeParams(rt reflect.Type, rv reflect.Value) []interface{} { + numFields := rt.NumField() + params := make([]interface{}, 0, numFields) + for i := 0; i < numFields; i++ { + rtf := rt.Field(i) + rvf := rv.Field(i) + if rtf.Type.Kind() == reflect.Ptr { + if rvf.IsNil() { + break + } + rvf.Elem() + } + params = append(params, rvf.Interface()) + } + + return params +} + +// MarshalCmd marshals the passed command to a JSON-RPC request byte slice that +// is suitable for transmission to an RPC server. The provided command type +// must be a registered type. All commands provided by this package are +// registered by default. +func MarshalCmd(id interface{}, cmd interface{}) ([]byte, error) { + // Look up the cmd type and error out if not registered. + rt := reflect.TypeOf(cmd) + registerLock.RLock() + method, ok := concreteTypeToMethod[rt] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", method) + return nil, makeError(ErrUnregisteredMethod, str) + } + + // The provided command must not be nil. + rv := reflect.ValueOf(cmd) + if rv.IsNil() { + str := fmt.Sprint("the specified command is nil") + return nil, makeError(ErrInvalidType, str) + } + + // Create a slice of interface values in the order of the struct fields + // while respecting pointer fields as optional params and only adding + // them if they are non-nil. + params := makeParams(rt.Elem(), rv.Elem()) + + // Generate and marshal the final JSON-RPC request. + rawCmd, err := NewRequest(id, method, params) + if err != nil { + return nil, err + } + return json.Marshal(rawCmd) +} + +// checkNumParams ensures the supplied number of params is at least the minimum +// required number for the command and less than the maximum allowed. +func checkNumParams(numParams int, info *methodInfo) error { + if numParams < info.numReqParams || numParams > info.maxParams { + if info.numReqParams == info.maxParams { + str := fmt.Sprintf("wrong number of params (expected "+ + "%d, received %d)", info.numReqParams, + numParams) + return makeError(ErrNumParams, str) + } + + str := fmt.Sprintf("wrong number of params (expected "+ + "between %d and %d, received %d)", info.numReqParams, + info.maxParams, numParams) + return makeError(ErrNumParams, str) + } + + return nil +} + +// populateDefaults populates default values into any remaining optional struct +// fields that did not have parameters explicitly provided. The caller should +// have previously checked that the number of parameters being passed is at +// least the required number of parameters to avoid unnecessary work in this +// function, but since required fields never have default values, it will work +// properly even without the check. +func populateDefaults(numParams int, info *methodInfo, rv reflect.Value) { + // When there are no more parameters left in the supplied parameters, + // any remaining struct fields must be optional. Thus, populate them + // with their associated default value as needed. + for i := numParams; i < info.maxParams; i++ { + rvf := rv.Field(i) + if defaultVal, ok := info.defaults[i]; ok { + rvf.Set(defaultVal) + } + } +} + +// UnmarshalCmd unmarshals a JSON-RPC request into a suitable concrete command +// so long as the method type contained within the marshalled request is +// registered. +func UnmarshalCmd(r *Request) (interface{}, error) { + registerLock.RLock() + rtp, ok := methodToConcreteType[r.Method] + info := methodToInfo[r.Method] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", r.Method) + return nil, makeError(ErrUnregisteredMethod, str) + } + rt := rtp.Elem() + rvp := reflect.New(rt) + rv := rvp.Elem() + + // Ensure the number of parameters are correct. + numParams := len(r.Params) + if err := checkNumParams(numParams, &info); err != nil { + return nil, err + } + + // Loop through each of the struct fields and unmarshal the associated + // parameter into them. + for i := 0; i < numParams; i++ { + rvf := rv.Field(i) + // Unmarshal the parameter into the struct field. + concreteVal := rvf.Addr().Interface() + if err := json.Unmarshal(r.Params[i], &concreteVal); err != nil { + // The most common error is the wrong type, so + // explicitly detect that error and make it nicer. + fieldName := strings.ToLower(rt.Field(i).Name) + if jerr, ok := err.(*json.UnmarshalTypeError); ok { + str := fmt.Sprintf("parameter #%d '%s' must "+ + "be type %v (got %v)", i+1, fieldName, + jerr.Type, jerr.Value) + return nil, makeError(ErrInvalidType, str) + } + + // Fallback to showing the underlying error. + str := fmt.Sprintf("parameter #%d '%s' failed to "+ + "unmarshal: %v", i+1, fieldName, err) + return nil, makeError(ErrInvalidType, str) + } + } + + // When there are less supplied parameters than the total number of + // params, any remaining struct fields must be optional. Thus, populate + // them with their associated default value as needed. + if numParams < info.maxParams { + populateDefaults(numParams, &info, rv) + } + + return rvp.Interface(), nil +} + +// isNumeric returns whether the passed reflect kind is a signed or unsigned +// integer of any magnitude or a float of any magnitude. +func isNumeric(kind reflect.Kind) bool { + switch kind { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, + reflect.Uint64, reflect.Float32, reflect.Float64: + + return true + } + + return false +} + +// typesMaybeCompatible returns whether the source type can possibly be +// assigned to the destination type. This is intended as a relatively quick +// check to weed out obviously invalid conversions. +func typesMaybeCompatible(dest reflect.Type, src reflect.Type) bool { + // The same types are obviously compatible. + if dest == src { + return true + } + + // When both types are numeric, they are potentially compatibile. + srcKind := src.Kind() + destKind := dest.Kind() + if isNumeric(destKind) && isNumeric(srcKind) { + return true + } + + if srcKind == reflect.String { + // Strings can potentially be converted to numeric types. + if isNumeric(destKind) { + return true + } + + switch destKind { + // Strings can potentially be converted to bools by + // strconv.ParseBool. + case reflect.Bool: + return true + + // Strings can be converted to any other type which has as + // underlying type of string. + case reflect.String: + return true + + // Strings can potentially be converted to arrays, slice, + // structs, and maps via json.Unmarshal. + case reflect.Array, reflect.Slice, reflect.Struct, reflect.Map: + return true + } + } + + return false +} + +// baseType returns the type of the argument after indirecting through all +// pointers along with how many indirections were necessary. +func baseType(arg reflect.Type) (reflect.Type, int) { + var numIndirects int + for arg.Kind() == reflect.Ptr { + arg = arg.Elem() + numIndirects++ + } + return arg, numIndirects +} + +// assignField is the main workhorse for the NewCmd function which handles +// assigning the provided source value to the destination field. It supports +// direct type assignments, indirection, conversion of numeric types, and +// unmarshaling of strings into arrays, slices, structs, and maps via +// json.Unmarshal. +func assignField(paramNum int, fieldName string, dest reflect.Value, src reflect.Value) error { + // Just error now when the types have no chance of being compatible. + destBaseType, destIndirects := baseType(dest.Type()) + srcBaseType, srcIndirects := baseType(src.Type()) + if !typesMaybeCompatible(destBaseType, srcBaseType) { + str := fmt.Sprintf("parameter #%d '%s' must be type %v (got "+ + "%v)", paramNum, fieldName, destBaseType, srcBaseType) + return makeError(ErrInvalidType, str) + } + + // Check if it's possible to simply set the dest to the provided source. + // This is the case when the base types are the same or they are both + // pointers that can be indirected to be the same without needing to + // create pointers for the destination field. + if destBaseType == srcBaseType && srcIndirects >= destIndirects { + for i := 0; i < srcIndirects-destIndirects; i++ { + src = src.Elem() + } + dest.Set(src) + return nil + } + + // When the destination has more indirects than the source, the extra + // pointers have to be created. Only create enough pointers to reach + // the same level of indirection as the source so the dest can simply be + // set to the provided source when the types are the same. + destIndirectsRemaining := destIndirects + if destIndirects > srcIndirects { + indirectDiff := destIndirects - srcIndirects + for i := 0; i < indirectDiff; i++ { + dest.Set(reflect.New(dest.Type().Elem())) + dest = dest.Elem() + destIndirectsRemaining-- + } + } + + if destBaseType == srcBaseType { + dest.Set(src) + return nil + } + + // Make any remaining pointers needed to get to the base dest type since + // the above direct assign was not possible and conversions are done + // against the base types. + for i := 0; i < destIndirectsRemaining; i++ { + dest.Set(reflect.New(dest.Type().Elem())) + dest = dest.Elem() + } + + // Indirect through to the base source value. + for src.Kind() == reflect.Ptr { + src = src.Elem() + } + + // Perform supported type conversions. + switch src.Kind() { + // Source value is a signed integer of various magnitude. + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, + reflect.Int64: + + switch dest.Kind() { + // Destination is a signed integer of various magnitude. + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, + reflect.Int64: + + srcInt := src.Int() + if dest.OverflowInt(srcInt) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + + dest.SetInt(srcInt) + + // Destination is an unsigned integer of various magnitude. + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, + reflect.Uint64: + + srcInt := src.Int() + if srcInt < 0 || dest.OverflowUint(uint64(srcInt)) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetUint(uint64(srcInt)) + + default: + str := fmt.Sprintf("parameter #%d '%s' must be type "+ + "%v (got %v)", paramNum, fieldName, destBaseType, + srcBaseType) + return makeError(ErrInvalidType, str) + } + + // Source value is an unsigned integer of various magnitude. + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, + reflect.Uint64: + + switch dest.Kind() { + // Destination is a signed integer of various magnitude. + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, + reflect.Int64: + + srcUint := src.Uint() + if srcUint > uint64(1<<63)-1 { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + if dest.OverflowInt(int64(srcUint)) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetInt(int64(srcUint)) + + // Destination is an unsigned integer of various magnitude. + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, + reflect.Uint64: + + srcUint := src.Uint() + if dest.OverflowUint(srcUint) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetUint(srcUint) + + default: + str := fmt.Sprintf("parameter #%d '%s' must be type "+ + "%v (got %v)", paramNum, fieldName, destBaseType, + srcBaseType) + return makeError(ErrInvalidType, str) + } + + // Source value is a float. + case reflect.Float32, reflect.Float64: + destKind := dest.Kind() + if destKind != reflect.Float32 && destKind != reflect.Float64 { + str := fmt.Sprintf("parameter #%d '%s' must be type "+ + "%v (got %v)", paramNum, fieldName, destBaseType, + srcBaseType) + return makeError(ErrInvalidType, str) + } + + srcFloat := src.Float() + if dest.OverflowFloat(srcFloat) { + str := fmt.Sprintf("parameter #%d '%s' overflows "+ + "destination type %v", paramNum, fieldName, + destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetFloat(srcFloat) + + // Source value is a string. + case reflect.String: + switch dest.Kind() { + // String -> bool + case reflect.Bool: + b, err := strconv.ParseBool(src.String()) + if err != nil { + str := fmt.Sprintf("parameter #%d '%s' must "+ + "parse to a %v", paramNum, fieldName, + destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetBool(b) + + // String -> signed integer of varying size. + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, + reflect.Int64: + + srcInt, err := strconv.ParseInt(src.String(), 0, 0) + if err != nil { + str := fmt.Sprintf("parameter #%d '%s' must "+ + "parse to a %v", paramNum, fieldName, + destBaseType) + return makeError(ErrInvalidType, str) + } + if dest.OverflowInt(srcInt) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetInt(srcInt) + + // String -> unsigned integer of varying size. + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64: + + srcUint, err := strconv.ParseUint(src.String(), 0, 0) + if err != nil { + str := fmt.Sprintf("parameter #%d '%s' must "+ + "parse to a %v", paramNum, fieldName, + destBaseType) + return makeError(ErrInvalidType, str) + } + if dest.OverflowUint(srcUint) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetUint(srcUint) + + // String -> float of varying size. + case reflect.Float32, reflect.Float64: + srcFloat, err := strconv.ParseFloat(src.String(), 0) + if err != nil { + str := fmt.Sprintf("parameter #%d '%s' must "+ + "parse to a %v", paramNum, fieldName, + destBaseType) + return makeError(ErrInvalidType, str) + } + if dest.OverflowFloat(srcFloat) { + str := fmt.Sprintf("parameter #%d '%s' "+ + "overflows destination type %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.SetFloat(srcFloat) + + // String -> string (typecast). + case reflect.String: + dest.SetString(src.String()) + + // String -> arrays, slices, structs, and maps via + // json.Unmarshal. + case reflect.Array, reflect.Slice, reflect.Struct, reflect.Map: + concreteVal := dest.Addr().Interface() + err := json.Unmarshal([]byte(src.String()), &concreteVal) + if err != nil { + str := fmt.Sprintf("parameter #%d '%s' must "+ + "be valid JSON which unsmarshals to a %v", + paramNum, fieldName, destBaseType) + return makeError(ErrInvalidType, str) + } + dest.Set(reflect.ValueOf(concreteVal).Elem()) + } + } + + return nil +} + +// NewCmd provides a generic mechanism to create a new command that can marshal +// to a JSON-RPC request while respecting the requirements of the provided +// method. The method must have been registered with the package already along +// with its type definition. All methods associated with the commands exported +// by this package are already registered by default. +// +// The arguments are most efficient when they are the exact same type as the +// underlying field in the command struct associated with the the method, +// however this function also will perform a variety of conversions to make it +// more flexible. This allows, for example, command line args which are strings +// to be passed unaltered. In particular, the following conversions are +// supported: +// +// - Conversion between any size signed or unsigned integer so long as the value +// does not overflow the destination type +// - Conversion between float32 and float64 so long as the value does not +// overflow the destination type +// - Conversion from string to boolean for everything strconv.ParseBool +// recognizes +// - Conversion from string to any size integer for everything strconv.ParseInt +// and strconv.ParseUint recognizes +// - Conversion from string to any size float for everything strconv.ParseFloat +// recognizes +// - Conversion from string to arrays, slices, structs, and maps by treating +// the string as marshalled JSON and calling json.Unmarshal into the +// destination field +func NewCmd(method string, args ...interface{}) (interface{}, error) { + // Look up details about the provided method. Any methods that aren't + // registered are an error. + registerLock.RLock() + rtp, ok := methodToConcreteType[method] + info := methodToInfo[method] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", method) + return nil, makeError(ErrUnregisteredMethod, str) + } + + // Ensure the number of parameters are correct. + numParams := len(args) + if err := checkNumParams(numParams, &info); err != nil { + return nil, err + } + + // Create the appropriate command type for the method. Since all types + // are enforced to be a pointer to a struct at registration time, it's + // safe to indirect to the struct now. + rvp := reflect.New(rtp.Elem()) + rv := rvp.Elem() + rt := rtp.Elem() + + // Loop through each of the struct fields and assign the associated + // parameter into them after checking its type validity. + for i := 0; i < numParams; i++ { + // Attempt to assign each of the arguments to the according + // struct field. + rvf := rv.Field(i) + fieldName := strings.ToLower(rt.Field(i).Name) + err := assignField(i+1, fieldName, rvf, reflect.ValueOf(args[i])) + if err != nil { + return nil, err + } + } + + return rvp.Interface(), nil +} diff --git a/v2/btcjson/cmdparse_test.go b/v2/btcjson/cmdparse_test.go new file mode 100644 index 00000000..5c9cbc2c --- /dev/null +++ b/v2/btcjson/cmdparse_test.go @@ -0,0 +1,519 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "encoding/json" + "math" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestAssignField tests the assignField function handles supported combinations +// properly. +func TestAssignField(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + dest interface{} + src interface{} + expected interface{} + }{ + { + name: "same types", + dest: int8(0), + src: int8(100), + expected: int8(100), + }, + { + name: "same types - more source pointers", + dest: int8(0), + src: func() interface{} { + i := int8(100) + return &i + }(), + expected: int8(100), + }, + { + name: "same types - more dest pointers", + dest: func() interface{} { + i := int8(0) + return &i + }(), + src: int8(100), + expected: int8(100), + }, + { + name: "convertible types - more source pointers", + dest: int16(0), + src: func() interface{} { + i := int8(100) + return &i + }(), + expected: int16(100), + }, + { + name: "convertible types - both pointers", + dest: func() interface{} { + i := int8(0) + return &i + }(), + src: func() interface{} { + i := int16(100) + return &i + }(), + expected: int8(100), + }, + { + name: "convertible types - int16 -> int8", + dest: int8(0), + src: int16(100), + expected: int8(100), + }, + { + name: "convertible types - int16 -> uint8", + dest: uint8(0), + src: int16(100), + expected: uint8(100), + }, + { + name: "convertible types - uint16 -> int8", + dest: int8(0), + src: uint16(100), + expected: int8(100), + }, + { + name: "convertible types - uint16 -> uint8", + dest: uint8(0), + src: uint16(100), + expected: uint8(100), + }, + { + name: "convertible types - float32 -> float64", + dest: float64(0), + src: float32(1.5), + expected: float64(1.5), + }, + { + name: "convertible types - float64 -> float32", + dest: float32(0), + src: float64(1.5), + expected: float32(1.5), + }, + { + name: "convertible types - string -> bool", + dest: false, + src: "true", + expected: true, + }, + { + name: "convertible types - string -> int8", + dest: int8(0), + src: "100", + expected: int8(100), + }, + { + name: "convertible types - string -> uint8", + dest: uint8(0), + src: "100", + expected: uint8(100), + }, + { + name: "convertible types - string -> float32", + dest: float32(0), + src: "1.5", + expected: float32(1.5), + }, + { + name: "convertible types - typecase string -> string", + dest: "", + src: func() interface{} { + type foo string + return foo("foo") + }(), + expected: "foo", + }, + { + name: "convertible types - string -> array", + dest: [2]string{}, + src: `["test","test2"]`, + expected: [2]string{"test", "test2"}, + }, + { + name: "convertible types - string -> slice", + dest: []string{}, + src: `["test","test2"]`, + expected: []string{"test", "test2"}, + }, + { + name: "convertible types - string -> struct", + dest: struct{ A int }{}, + src: `{"A":100}`, + expected: struct{ A int }{100}, + }, + { + name: "convertible types - string -> map", + dest: map[string]float64{}, + src: `{"1Address":1.5}`, + expected: map[string]float64{"1Address": 1.5}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + dst := reflect.New(reflect.TypeOf(test.dest)).Elem() + src := reflect.ValueOf(test.src) + err := btcjson.TstAssignField(1, "testField", dst, src) + if err != nil { + t.Errorf("Test #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + // Inidirect through to the base types to ensure their values + // are the same. + for dst.Kind() == reflect.Ptr { + dst = dst.Elem() + } + if !reflect.DeepEqual(dst.Interface(), test.expected) { + t.Errorf("Test #%d (%s) unexpected value - got %v, "+ + "want %v", i, test.name, dst.Interface(), + test.expected) + continue + } + } +} + +// TestAssignFieldErrors tests the assignField function error paths. +func TestAssignFieldErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + dest interface{} + src interface{} + err btcjson.Error + }{ + { + name: "general incompatible int -> string", + dest: string(0), + src: int(0), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow source int -> dest int", + dest: int8(0), + src: int(128), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow source int -> dest uint", + dest: uint8(0), + src: int(256), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "int -> float", + dest: float32(0), + src: int(256), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow source uint64 -> dest int64", + dest: int64(0), + src: uint64(1 << 63), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow source uint -> dest int", + dest: int8(0), + src: uint(128), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow source uint -> dest uint", + dest: uint8(0), + src: uint(256), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "uint -> float", + dest: float32(0), + src: uint(256), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "float -> int", + dest: int(0), + src: float32(1.0), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow float64 -> float32", + dest: float32(0), + src: float64(math.MaxFloat64), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> bool", + dest: true, + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> int", + dest: int8(0), + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow string -> int", + dest: int8(0), + src: "128", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> uint", + dest: uint8(0), + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow string -> uint", + dest: uint8(0), + src: "256", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> float", + dest: float32(0), + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "overflow string -> float", + dest: float32(0), + src: "1.7976931348623157e+308", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> array", + dest: [3]int{}, + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> slice", + dest: []int{}, + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> struct", + dest: struct{ A int }{}, + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid string -> map", + dest: map[string]int{}, + src: "foo", + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + dst := reflect.New(reflect.TypeOf(test.dest)).Elem() + src := reflect.ValueOf(test.src) + err := btcjson.TstAssignField(1, "testField", dst, src) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[3]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code - got "+ + "%v (%v), want %v", i, test.name, gotErrorCode, + err, test.err.ErrorCode) + continue + } + } +} + +// TestNewCmdErrors ensures the error paths of NewCmd behave as expected. +func TestNewCmdErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + args []interface{} + err btcjson.Error + }{ + { + name: "unregistered command", + method: "boguscommand", + args: []interface{}{}, + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "too few parameters to command with required + optional", + method: "getblock", + args: []interface{}{}, + err: btcjson.Error{ErrorCode: btcjson.ErrNumParams}, + }, + { + name: "too many parameters to command with no optional", + method: "getblockcount", + args: []interface{}{"123"}, + err: btcjson.Error{ErrorCode: btcjson.ErrNumParams}, + }, + { + name: "incorrect parameter type", + method: "getblock", + args: []interface{}{1}, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + _, err := btcjson.NewCmd(test.method, test.args...) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code - got "+ + "%v (%v), want %v", i, test.name, gotErrorCode, + err, test.err.ErrorCode) + continue + } + } +} + +// TestMarshalCmdErrors tests the error paths of the MarshalCmd function. +func TestMarshalCmdErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + id interface{} + cmd interface{} + err btcjson.Error + }{ + { + name: "unregistered type", + id: 1, + cmd: (*int)(nil), + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "nil instance of registered type", + id: 1, + cmd: (*btcjson.GetBlockCmd)(nil), + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "nil instance of registered type", + id: []int{0, 1}, + cmd: &btcjson.GetBlockCountCmd{}, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + _, err := btcjson.MarshalCmd(test.id, test.cmd) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code - got "+ + "%v (%v), want %v", i, test.name, gotErrorCode, + err, test.err.ErrorCode) + continue + } + } +} + +// TestUnmarshalCmdErrors tests the error paths of the UnmarshalCmd function. +func TestUnmarshalCmdErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + request btcjson.Request + err btcjson.Error + }{ + { + name: "unregistered type", + request: btcjson.Request{ + Jsonrpc: "1.0", + Method: "bogusmethod", + Params: nil, + ID: nil, + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "incorrect number of params", + request: btcjson.Request{ + Jsonrpc: "1.0", + Method: "getblockcount", + Params: []json.RawMessage{[]byte(`"bogusparam"`)}, + ID: nil, + }, + err: btcjson.Error{ErrorCode: btcjson.ErrNumParams}, + }, + { + name: "invalid type for a parameter", + request: btcjson.Request{ + Jsonrpc: "1.0", + Method: "getblock", + Params: []json.RawMessage{[]byte("1")}, + ID: nil, + }, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid JSON for a parameter", + request: btcjson.Request{ + Jsonrpc: "1.0", + Method: "getblock", + Params: []json.RawMessage{[]byte(`"1`)}, + ID: nil, + }, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + _, err := btcjson.UnmarshalCmd(&test.request) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code - got "+ + "%v (%v), want %v", i, test.name, gotErrorCode, + err, test.err.ErrorCode) + continue + } + } +} diff --git a/v2/btcjson/error.go b/v2/btcjson/error.go new file mode 100644 index 00000000..6b22e919 --- /dev/null +++ b/v2/btcjson/error.go @@ -0,0 +1,111 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "fmt" +) + +// ErrorCode identifies a kind of error. These error codes are NOT used for +// JSON-RPC response errors. +type ErrorCode int + +// These constants are used to identify a specific RuleError. +const ( + // ErrDuplicateMethod indicates a command with the specified method + // already exists. + ErrDuplicateMethod ErrorCode = iota + + // ErrInvalidUsageFlags indicates one or more unrecognized flag bits + // were specified. + ErrInvalidUsageFlags + + // ErrInvalidType indicates a type was passed that is not the required + // type. + ErrInvalidType + + // ErrEmbeddedType indicates the provided command struct contains an + // embedded type which is not not supported. + ErrEmbeddedType + + // ErrUnexportedField indiciates the provided command struct contains an + // unexported field which is not supported. + ErrUnexportedField + + // ErrUnsupportedFieldType indicates the type of a field in the provided + // command struct is not one of the supported types. + ErrUnsupportedFieldType + + // ErrNonOptionalField indicates a non-optional field was specified + // after an optional field. + ErrNonOptionalField + + // ErrNonOptionalDefault indicates a 'jsonrpcdefault' struct tag was + // specified for a non-optional field. + ErrNonOptionalDefault + + // ErrMismatchedDefault indicates a 'jsonrpcdefault' struct tag contains + // a value that doesn't match the type of the field. + ErrMismatchedDefault + + // ErrUnregisteredMethod indicates a method was specified that has not + // been registered. + ErrUnregisteredMethod + + // ErrMissingDescription indicates a description required to generate + // help is missing. + ErrMissingDescription + + // ErrNumParams inidcates the number of params supplied do not + // match the requirements of the associated command. + ErrNumParams + + // numErrorCodes is the maximum error code number used in tests. + numErrorCodes +) + +// Map of ErrorCode values back to their constant names for pretty printing. +var errorCodeStrings = map[ErrorCode]string{ + ErrDuplicateMethod: "ErrDuplicateMethod", + ErrInvalidUsageFlags: "ErrInvalidUsageFlags", + ErrInvalidType: "ErrInvalidType", + ErrEmbeddedType: "ErrEmbeddedType", + ErrUnexportedField: "ErrUnexportedField", + ErrUnsupportedFieldType: "ErrUnsupportedFieldType", + ErrNonOptionalField: "ErrNonOptionalField", + ErrNonOptionalDefault: "ErrNonOptionalDefault", + ErrMismatchedDefault: "ErrMismatchedDefault", + ErrUnregisteredMethod: "ErrUnregisteredMethod", + ErrMissingDescription: "ErrMissingDescription", + ErrNumParams: "ErrNumParams", +} + +// String returns the ErrorCode as a human-readable name. +func (e ErrorCode) String() string { + if s := errorCodeStrings[e]; s != "" { + return s + } + return fmt.Sprintf("Unknown ErrorCode (%d)", int(e)) +} + +// Error identifies a general error. This differs from an RPCError in that this +// error typically is used more by the consumers of the package as opposed to +// RPCErrors which are intended to be returned to the client across the wire via +// a JSON-RPC Response. The caller can use type assertions to determine the +// specific error and access the ErrorCode field. +type Error struct { + ErrorCode ErrorCode // Describes the kind of error + Description string // Human readable description of the issue +} + +// Error satisfies the error interface and prints human-readable errors. +func (e Error) Error() string { + return e.Description +} + +// makeError creates an Error given a set of arguments. +func makeError(c ErrorCode, desc string) Error { + return Error{ErrorCode: c, Description: desc} +} diff --git a/v2/btcjson/error_test.go b/v2/btcjson/error_test.go new file mode 100644 index 00000000..d7e7e3fc --- /dev/null +++ b/v2/btcjson/error_test.go @@ -0,0 +1,80 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestErrorCodeStringer tests the stringized output for the ErrorCode type. +func TestErrorCodeStringer(t *testing.T) { + t.Parallel() + + tests := []struct { + in btcjson.ErrorCode + want string + }{ + {btcjson.ErrDuplicateMethod, "ErrDuplicateMethod"}, + {btcjson.ErrInvalidUsageFlags, "ErrInvalidUsageFlags"}, + {btcjson.ErrInvalidType, "ErrInvalidType"}, + {btcjson.ErrEmbeddedType, "ErrEmbeddedType"}, + {btcjson.ErrUnexportedField, "ErrUnexportedField"}, + {btcjson.ErrUnsupportedFieldType, "ErrUnsupportedFieldType"}, + {btcjson.ErrNonOptionalField, "ErrNonOptionalField"}, + {btcjson.ErrNonOptionalDefault, "ErrNonOptionalDefault"}, + {btcjson.ErrMismatchedDefault, "ErrMismatchedDefault"}, + {btcjson.ErrUnregisteredMethod, "ErrUnregisteredMethod"}, + {btcjson.ErrNumParams, "ErrNumParams"}, + {btcjson.ErrMissingDescription, "ErrMissingDescription"}, + {0xffff, "Unknown ErrorCode (65535)"}, + } + + // Detect additional error codes that don't have the stringer added. + if len(tests)-1 != int(btcjson.TstNumErrorCodes) { + t.Errorf("It appears an error code was added without adding an " + + "associated stringer test") + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.in.String() + if result != test.want { + t.Errorf("String #%d\n got: %s want: %s", i, result, + test.want) + continue + } + } +} + +// TestError tests the error output for the Error type. +func TestError(t *testing.T) { + t.Parallel() + + tests := []struct { + in btcjson.Error + want string + }{ + { + btcjson.Error{Description: "some error"}, + "some error", + }, + { + btcjson.Error{Description: "human-readable error"}, + "human-readable error", + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.in.Error() + if result != test.want { + t.Errorf("Error #%d\n got: %s want: %s", i, result, + test.want) + continue + } + } +} diff --git a/v2/btcjson/export_test.go b/v2/btcjson/export_test.go new file mode 100644 index 00000000..971a2b4a --- /dev/null +++ b/v2/btcjson/export_test.go @@ -0,0 +1,48 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +// TstHighestUsageFlagBit makes the internal highestUsageFlagBit parameter +// available to the test package. +var TstHighestUsageFlagBit = highestUsageFlagBit + +// TstNumErrorCodes makes the internal numErrorCodes parameter available to the +// test package. +var TstNumErrorCodes = numErrorCodes + +// TstAssignField makes the internal assignField function available to the test +// package. +var TstAssignField = assignField + +// TstFieldUsage makes the internal fieldUsage function available to the test +// package. +var TstFieldUsage = fieldUsage + +// TstReflectTypeToJSONType makes the internal reflectTypeToJSONType function +// available to the test package. +var TstReflectTypeToJSONType = reflectTypeToJSONType + +// TstResultStructHelp makes the internal resultStructHelp function available to +// the test package. +var TstResultStructHelp = resultStructHelp + +// TstReflectTypeToJSONExample makes the internal reflectTypeToJSONExample +// function available to the test package. +var TstReflectTypeToJSONExample = reflectTypeToJSONExample + +// TstResultTypeHelp makes the internal resultTypeHelp function available to the +// test package. +var TstResultTypeHelp = resultTypeHelp + +// TstArgHelp makes the internal argHelp function available to the test package. +var TstArgHelp = argHelp + +// TestMethodHelp makes the internal methodHelp function available to the test +// package. +var TestMethodHelp = methodHelp + +// TstIsValidResultType makes the internal isValidResultType function available +// to the test package. +var TstIsValidResultType = isValidResultType diff --git a/v2/btcjson/help.go b/v2/btcjson/help.go new file mode 100644 index 00000000..80a66786 --- /dev/null +++ b/v2/btcjson/help.go @@ -0,0 +1,562 @@ +// Copyright (c) 2015 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "bytes" + "fmt" + "reflect" + "strings" + "text/tabwriter" +) + +// baseHelpDescs house the various help labels, types, and example values used +// when generating help. The per-command synopsis, field descriptions, +// conditions, and result descriptions are to be provided by the caller. +var baseHelpDescs = map[string]string{ + // Misc help labels and output. + "help-arguments": "Arguments", + "help-arguments-none": "None", + "help-result": "Result", + "help-result-nothing": "Nothing", + "help-default": "default", + "help-optional": "optional", + "help-required": "required", + + // JSON types. + "json-type-numeric": "numeric", + "json-type-string": "string", + "json-type-bool": "boolean", + "json-type-array": "array of ", + "json-type-object": "object", + "json-type-value": "value", + + // JSON examples. + "json-example-string": "value", + "json-example-bool": "true|false", + "json-example-map-data": "data", + "json-example-unknown": "unknown", +} + +// descLookupFunc is a function which is used to lookup a description given +// a key. +type descLookupFunc func(string) string + +// reflectTypeToJSONType returns a string that represents the JSON type +// associated with the provided Go type. +func reflectTypeToJSONType(xT descLookupFunc, rt reflect.Type) string { + kind := rt.Kind() + if isNumeric(kind) { + return xT("json-type-numeric") + } + + switch kind { + case reflect.String: + return xT("json-type-string") + + case reflect.Bool: + return xT("json-type-bool") + + case reflect.Array, reflect.Slice: + return xT("json-type-array") + reflectTypeToJSONType(xT, + rt.Elem()) + + case reflect.Struct: + return xT("json-type-object") + + case reflect.Map: + return xT("json-type-object") + } + + return xT("json-type-value") +} + +// resultStructHelp returns a slice of strings containing the result help output +// for a struct. Each line makes use of tabs to separate the relevant pieces so +// a tabwriter can be used later to line everything up. The descriptions are +// pulled from the active help descriptions map based on the lowercase version +// of the provided reflect type and json name (or the lowercase version of the +// field name if no json tag was specified). +func resultStructHelp(xT descLookupFunc, rt reflect.Type, indentLevel int) []string { + indent := strings.Repeat(" ", indentLevel) + typeName := strings.ToLower(rt.Name()) + + // Generate the help for each of the fields in the result struct. + numField := rt.NumField() + results := make([]string, 0, numField) + for i := 0; i < numField; i++ { + rtf := rt.Field(i) + + // The field name to display is the json name when it's + // available, otherwise use the lowercase field name. + var fieldName string + if tag := rtf.Tag.Get("json"); tag != "" { + fieldName = strings.Split(tag, ",")[0] + } else { + fieldName = strings.ToLower(rtf.Name) + } + + // Deference pointer if needed. + rtfType := rtf.Type + if rtfType.Kind() == reflect.Ptr { + rtfType = rtf.Type.Elem() + } + + // Generate the JSON example for the result type of this struct + // field. When it is a complex type, examine the type and + // adjust the opening bracket and brace combination accordingly. + fieldType := reflectTypeToJSONType(xT, rtfType) + fieldDescKey := typeName + "-" + fieldName + fieldExamples, isComplex := reflectTypeToJSONExample(xT, + rtfType, indentLevel, fieldDescKey) + if isComplex { + var brace string + kind := rtfType.Kind() + if kind == reflect.Array || kind == reflect.Slice { + brace = "[{" + } else { + brace = "{" + } + result := fmt.Sprintf("%s\"%s\": %s\t(%s)\t%s", indent, + fieldName, brace, fieldType, xT(fieldDescKey)) + results = append(results, result) + for _, example := range fieldExamples { + results = append(results, example) + } + } else { + result := fmt.Sprintf("%s\"%s\": %s,\t(%s)\t%s", indent, + fieldName, fieldExamples[0], fieldType, + xT(fieldDescKey)) + results = append(results, result) + } + } + + return results +} + +// reflectTypeToJSONExample generates example usage in the format used by the +// help output. It handles arrays, slices and structs recursively. The output +// is returned as a slice of lines so the final help can be nicely aligned via +// a tab writer. A bool is also returned which specifies whether or not the +// type results in a complex JSON object since they need to be handled +// differently. +func reflectTypeToJSONExample(xT descLookupFunc, rt reflect.Type, indentLevel int, fieldDescKey string) ([]string, bool) { + // Indirect pointer if needed. + if rt.Kind() == reflect.Ptr { + rt = rt.Elem() + } + kind := rt.Kind() + if isNumeric(kind) { + if kind == reflect.Float32 || kind == reflect.Float64 { + return []string{"n.nnn"}, false + } + + return []string{"n"}, false + } + + switch kind { + case reflect.String: + return []string{`"` + xT("json-example-string") + `"`}, false + + case reflect.Bool: + return []string{xT("json-example-bool")}, false + + case reflect.Struct: + indent := strings.Repeat(" ", indentLevel) + results := resultStructHelp(xT, rt, indentLevel+1) + + // An opening brace is needed for the first indent level. For + // all others, it will be included as a part of the previous + // field. + if indentLevel == 0 { + newResults := make([]string, len(results)+1) + newResults[0] = "{" + copy(newResults[1:], results) + results = newResults + } + + // The closing brace has a comma after it except for the first + // indent level. The final tabs are necessary so the tab writer + // lines things up properly. + closingBrace := indent + "}" + if indentLevel > 0 { + closingBrace += "," + } + results = append(results, closingBrace+"\t\t") + return results, true + + case reflect.Array, reflect.Slice: + results, isComplex := reflectTypeToJSONExample(xT, rt.Elem(), + indentLevel, fieldDescKey) + + // When the result is complex, it is because this is an array of + // objects. + if isComplex { + // When this is at indent level zero, there is no + // previous field to house the opening array bracket, so + // replace the opening object brace with the array + // syntax. Also, replace the final closing object brace + // with the variadiac array closing syntax. + indent := strings.Repeat(" ", indentLevel) + if indentLevel == 0 { + results[0] = indent + "[{" + results[len(results)-1] = indent + "},...]" + return results, true + } + + // At this point, the indent level is greater than 0, so + // the opening array bracket and object brace are + // already a part of the previous field. However, the + // closing entry is a simple object brace, so replace it + // with the variadiac array closing syntax. The final + // tabs are necessary so the tab writer lines things up + // properly. + results[len(results)-1] = indent + "},...],\t\t" + return results, true + } + + // It's an array of primitives, so return the formatted text + // accordingly. + return []string{fmt.Sprintf("[%s,...]", results[0])}, false + + case reflect.Map: + indent := strings.Repeat(" ", indentLevel) + results := make([]string, 0, 3) + + // An opening brace is needed for the first indent level. For + // all others, it will be included as a part of the previous + // field. + if indentLevel == 0 { + results = append(results, indent+"{") + } + + // Maps are a bit special in that they need to have the key, + // value, and description of the object entry specifically + // called out. + innerIndent := strings.Repeat(" ", indentLevel+1) + result := fmt.Sprintf("%s%q: %s, (%s) %s", innerIndent, + xT(fieldDescKey+"--key"), xT(fieldDescKey+"--value"), + reflectTypeToJSONType(xT, rt), xT(fieldDescKey+"--desc")) + results = append(results, result) + results = append(results, innerIndent+"...") + + results = append(results, indent+"}") + return results, true + } + + return []string{xT("json-example-unknown")}, false +} + +// resultTypeHelp generates and returns formatted help for the provided result +// type. +func resultTypeHelp(xT descLookupFunc, rt reflect.Type, fieldDescKey string) string { + // Generate the JSON example for the result type. + results, isComplex := reflectTypeToJSONExample(xT, rt, 0, fieldDescKey) + + // When this is a primitive type, add the associated JSON type and + // result description into the final string, format it accordingly, + // and return it. + if !isComplex { + return fmt.Sprintf("%s (%s) %s", results[0], + reflectTypeToJSONType(xT, rt), xT(fieldDescKey)) + } + + // At this point, this is a complex type that already has the JSON types + // and descriptions in the results. Thus, use a tab writer to nicely + // align the help text. + var formatted bytes.Buffer + w := new(tabwriter.Writer) + w.Init(&formatted, 0, 4, 1, ' ', 0) + for i, text := range results { + if i == len(results)-1 { + fmt.Fprintf(w, text) + } else { + fmt.Fprintln(w, text) + } + } + w.Flush() + return formatted.String() +} + +// argTypeHelp returns the type of provided command argument as a string in the +// format used by the help output. In particular, it includes the JSON type +// (boolean, numeric, string, array, object) along with optional and the default +// value if applicable. +func argTypeHelp(xT descLookupFunc, structField reflect.StructField, defaultVal *reflect.Value) string { + // Indirect the pointer if needed and track if it's an optional field. + fieldType := structField.Type + var isOptional bool + if fieldType.Kind() == reflect.Ptr { + fieldType = fieldType.Elem() + isOptional = true + } + + // When there is a default value, it must also be a pointer due to the + // rules enforced by RegisterCmd. + if defaultVal != nil { + indirect := defaultVal.Elem() + defaultVal = &indirect + } + + // Convert the field type to a JSON type. + details := make([]string, 0, 3) + details = append(details, reflectTypeToJSONType(xT, fieldType)) + + // Add optional and default value to the details if needed. + if isOptional { + details = append(details, xT("help-optional")) + + // Add the default value if there is one. This is only checked + // when the field is optional since a non-optional field can't + // have a default value. + if defaultVal != nil { + val := defaultVal.Interface() + if defaultVal.Kind() == reflect.String { + val = fmt.Sprintf(`"%s"`, val) + } + str := fmt.Sprintf("%s=%v", xT("help-default"), val) + details = append(details, str) + } + } else { + details = append(details, xT("help-required")) + } + + return strings.Join(details, ", ") +} + +// argHelp generates and returns formatted help for the provided command. +func argHelp(xT descLookupFunc, rtp reflect.Type, defaults map[int]reflect.Value, method string) string { + // Return now if the command has no arguments. + rt := rtp.Elem() + numFields := rt.NumField() + if numFields == 0 { + return "" + } + + // Generate the help for each argument in the command. Several + // simplifying assumptions are made here because the RegisterCmd + // function has already rigorously enforced the layout. + args := make([]string, 0, numFields) + for i := 0; i < numFields; i++ { + rtf := rt.Field(i) + var defaultVal *reflect.Value + if defVal, ok := defaults[i]; ok { + defaultVal = &defVal + } + + fieldName := strings.ToLower(rtf.Name) + helpText := fmt.Sprintf("%d.\t%s\t(%s)\t%s", i+1, fieldName, + argTypeHelp(xT, rtf, defaultVal), + xT(method+"-"+fieldName)) + args = append(args, helpText) + + // For types which require a JSON object, or an array of JSON + // objects, generate the full syntax for the argument. + fieldType := rtf.Type + if fieldType.Kind() == reflect.Ptr { + fieldType = fieldType.Elem() + } + kind := fieldType.Kind() + switch kind { + case reflect.Struct: + fieldDescKey := fmt.Sprintf("%s-%s", method, fieldName) + resultText := resultTypeHelp(xT, fieldType, fieldDescKey) + args = append(args, resultText) + + case reflect.Map: + fieldDescKey := fmt.Sprintf("%s-%s", method, fieldName) + resultText := resultTypeHelp(xT, fieldType, fieldDescKey) + args = append(args, resultText) + + case reflect.Array, reflect.Slice: + fieldDescKey := fmt.Sprintf("%s-%s", method, fieldName) + if rtf.Type.Elem().Kind() == reflect.Struct { + resultText := resultTypeHelp(xT, fieldType, + fieldDescKey) + args = append(args, resultText) + } + } + } + + // Add argument names, types, and descriptions if there are any. Use a + // tab writer to nicely align the help text. + var formatted bytes.Buffer + w := new(tabwriter.Writer) + w.Init(&formatted, 0, 4, 1, ' ', 0) + for _, text := range args { + fmt.Fprintln(w, text) + } + w.Flush() + return formatted.String() +} + +// methodHelp generates and returns the help output for the provided command +// and method info. This is the main work horse for the exported MethodHelp +// function. +func methodHelp(xT descLookupFunc, rtp reflect.Type, defaults map[int]reflect.Value, method string, resultTypes []interface{}) string { + // Start off with the method usage and help synopsis. + help := fmt.Sprintf("%s\n\n%s\n", methodUsageText(rtp, defaults, method), + xT(method+"--synopsis")) + + // Generate the help for each argument in the command. + if argText := argHelp(xT, rtp, defaults, method); argText != "" { + help += fmt.Sprintf("\n%s:\n%s", xT("help-arguments"), + argText) + } else { + help += fmt.Sprintf("\n%s:\n%s\n", xT("help-arguments"), + xT("help-arguments-none")) + } + + // Generate the help text for each result type. + resultTexts := make([]string, 0, len(resultTypes)) + for i := range resultTypes { + rtp := reflect.TypeOf(resultTypes[i]) + fieldDescKey := fmt.Sprintf("%s--result%d", method, i) + if resultTypes[i] == nil { + resultText := xT("help-result-nothing") + resultTexts = append(resultTexts, resultText) + continue + } + + resultText := resultTypeHelp(xT, rtp.Elem(), fieldDescKey) + resultTexts = append(resultTexts, resultText) + } + + // Add result types and descriptions. When there is more than one + // result type, also add the condition which triggers it. + if len(resultTexts) > 1 { + for i, resultText := range resultTexts { + condKey := fmt.Sprintf("%s--condition%d", method, i) + help += fmt.Sprintf("\n%s (%s):\n%s\n", + xT("help-result"), xT(condKey), resultText) + } + } else if len(resultTexts) > 0 { + help += fmt.Sprintf("\n%s:\n%s\n", xT("help-result"), + resultTexts[0]) + } else { + help += fmt.Sprintf("\n%s:\n%s\n", xT("help-result"), + xT("help-result-nothing")) + } + return help +} + +// isValidResultType returns whether the passed reflect kind is one of the +// acceptable types for results. +func isValidResultType(kind reflect.Kind) bool { + if isNumeric(kind) { + return true + } + + switch kind { + case reflect.String, reflect.Struct, reflect.Array, reflect.Slice, + reflect.Bool, reflect.Map: + + return true + } + + return false +} + +// GenerateHelp generates and returns help output for the provided method and +// result types given a map to provide the appropriate keys for the method +// synopsis, field descriptions, conditions, and result descriptions. The +// method must be associated with a registered type. All commands provided by +// this package are registered by default. +// +// The resultTypes must be pointer-to-types which represent the specific types +// of values the command returns. For example, if the command only returns a +// boolean value, there should only be a single entry of (*bool)(nil). Note +// that each type must be a single pointer to the type. Therefore, it is +// recommended to simply pass a nil pointer cast to the appropriate type as +// previously shown. +// +// The provided descriptions map must contain all of the keys or an error will +// be returned which includes the missing key, or the final missing key when +// there is more than one key missing. The generated help in the case of such +// an error will use the key in place of the description. +// +// The following outlines the required keys: +// - "--synopsis" Synopsis for the command +// - "-" Description for each command argument +// - "-" Description for each object field +// - "--condition<#>" Description for each result condition +// - "--result<#>" Description for each primitive result num +// +// Notice that the "special" keys synopsis, condition<#>, and result<#> are +// preceded by a double dash to ensure they don't conflict with field names. +// +// The condition keys are only required when there is more than on result type, +// and the result key for a given result type is only required if it's not an +// object. +// +// For example, consider the 'help' command itself. There are two possible +// returns depending on the provided parameters. So, the help would be +// generated by calling the function as follows +// GenerateHelp("help", descs, (*string)(nil), (*string)(nil)). +// +// The following keys would then be required in the provided descriptions map: +// +// - "help--synopsis": "Returns a list of all commands or help for ...." +// - "help-command": "The command to retrieve help for", +// - "help--condition0": "no command provided" +// - "help--condition1": "command specified" +// - "help--result0": "List of commands" +// - "help--result1": "Help for specified command" +func GenerateHelp(method string, descs map[string]string, resultTypes ...interface{}) (string, error) { + // Look up details about the provided method and error out if not + // registered. + registerLock.RLock() + rtp, ok := methodToConcreteType[method] + info := methodToInfo[method] + registerLock.RUnlock() + if !ok { + str := fmt.Sprintf("%q is not registered", method) + return "", makeError(ErrUnregisteredMethod, str) + } + + // Validate each result type is a pointer to a supported type (or nil). + for i, resultType := range resultTypes { + if resultType == nil { + continue + } + + rtp := reflect.TypeOf(resultType) + if rtp.Kind() != reflect.Ptr { + str := fmt.Sprintf("result #%d (%v) is not a pointer", + i, rtp.Kind()) + return "", makeError(ErrInvalidType, str) + } + + elemKind := rtp.Elem().Kind() + if !isValidResultType(elemKind) { + str := fmt.Sprintf("result #%d (%v) is not an allowed "+ + "type", i, elemKind) + return "", makeError(ErrInvalidType, str) + } + } + + // Create a closure for the description lookup function which falls back + // to the base help descritptions map for unrecognized keys and tracks + // and missing keys. + var missingKey string + xT := func(key string) string { + if desc, ok := descs[key]; ok { + return desc + } + if desc, ok := baseHelpDescs[key]; ok { + return desc + } + + missingKey = key + return key + } + + // Generate and return the help for the method. + help := methodHelp(xT, rtp, info.defaults, method, resultTypes) + if missingKey != "" { + return help, makeError(ErrMissingDescription, missingKey) + } + return help, nil +} diff --git a/v2/btcjson/helpers.go b/v2/btcjson/helpers.go new file mode 100644 index 00000000..a3d66a10 --- /dev/null +++ b/v2/btcjson/helpers.go @@ -0,0 +1,69 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +// Bool is a helper routine that allocates a new bool value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Bool(v bool) *bool { + p := new(bool) + *p = v + return p +} + +// Int is a helper routine that allocates a new int value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Int(v int) *int { + p := new(int) + *p = v + return p +} + +// Uint is a helper routine that allocates a new uint value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Uint(v uint) *uint { + p := new(uint) + *p = v + return p +} + +// Int32 is a helper routine that allocates a new int32 value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Int32(v int32) *int32 { + p := new(int32) + *p = v + return p +} + +// Uint32 is a helper routine that allocates a new uint32 value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Uint32(v uint32) *uint32 { + p := new(uint32) + *p = v + return p +} + +// Int64 is a helper routine that allocates a new int64 value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Int64(v int64) *int64 { + p := new(int64) + *p = v + return p +} + +// Uint64 is a helper routine that allocates a new uint64 value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func Uint64(v uint64) *uint64 { + p := new(uint64) + *p = v + return p +} + +// String is a helper routine that allocates a new string value to store v and +// returns a pointer to it. This is useful when assigning optional parameters. +func String(v string) *string { + p := new(string) + *p = v + return p +} diff --git a/v2/btcjson/helpers_test.go b/v2/btcjson/helpers_test.go new file mode 100644 index 00000000..25b9ac77 --- /dev/null +++ b/v2/btcjson/helpers_test.go @@ -0,0 +1,115 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestHelpers tests the various helper functions which create pointers to +// primitive types. +func TestHelpers(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + f func() interface{} + expected interface{} + }{ + { + name: "bool", + f: func() interface{} { + return btcjson.Bool(true) + }, + expected: func() interface{} { + val := true + return &val + }(), + }, + { + name: "int", + f: func() interface{} { + return btcjson.Int(5) + }, + expected: func() interface{} { + val := int(5) + return &val + }(), + }, + { + name: "uint", + f: func() interface{} { + return btcjson.Uint(5) + }, + expected: func() interface{} { + val := uint(5) + return &val + }(), + }, + { + name: "int32", + f: func() interface{} { + return btcjson.Int32(5) + }, + expected: func() interface{} { + val := int32(5) + return &val + }(), + }, + { + name: "uint32", + f: func() interface{} { + return btcjson.Uint32(5) + }, + expected: func() interface{} { + val := uint32(5) + return &val + }(), + }, + { + name: "int64", + f: func() interface{} { + return btcjson.Int64(5) + }, + expected: func() interface{} { + val := int64(5) + return &val + }(), + }, + { + name: "uint64", + f: func() interface{} { + return btcjson.Uint64(5) + }, + expected: func() interface{} { + val := uint64(5) + return &val + }(), + }, + { + name: "string", + f: func() interface{} { + return btcjson.String("abc") + }, + expected: func() interface{} { + val := "abc" + return &val + }(), + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.f() + if !reflect.DeepEqual(result, test.expected) { + t.Errorf("Test #%d (%s) unexpected value - got %v, "+ + "want %v", i, test.name, result, test.expected) + continue + } + } +} diff --git a/v2/btcjson/jsonrpc.go b/v2/btcjson/jsonrpc.go new file mode 100644 index 00000000..f356b0e3 --- /dev/null +++ b/v2/btcjson/jsonrpc.go @@ -0,0 +1,150 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "encoding/json" + "fmt" +) + +// RPCErrorCode represents an error code to be used as a part of an RPCError +// which is in turn used in a JSON-RPC Response object. +// +// A specific type is used to help ensure the wrong errors aren't used. +type RPCErrorCode int + +// RPCError represents an error that is used as a part of a JSON-RPC Response +// object. +type RPCError struct { + Code RPCErrorCode `json:"code,omitempty"` + Message string `json:"message,omitempty"` +} + +// Guarantee RPCError satisifies the builtin error interface. +var _, _ error = RPCError{}, (*RPCError)(nil) + +// Error returns a string describing the RPC error. This satisifies the +// builtin error interface. +func (e RPCError) Error() string { + return fmt.Sprintf("%d: %s", e.Code, e.Message) +} + +// NewRPCError constructs and returns a new JSON-RPC error that is suitable +// for use in a JSON-RPC Response object. +func NewRPCError(code RPCErrorCode, message string) *RPCError { + return &RPCError{ + Code: code, + Message: message, + } +} + +// IsValidIDType checks that the ID field (which can go in any of the JSON-RPC +// requests, responses, or notifications) is valid. JSON-RPC 1.0 allows any +// valid JSON type. JSON-RPC 2.0 (which bitcoind follows for some parts) only +// allows string, number, or null, so this function restricts the allowed types +// to that list. This funciton is only provided in case the caller is manually +// marshalling for some reason. The functions which accept an ID in this +// package already call this function to ensure the provided id is valid. +func IsValidIDType(id interface{}) bool { + switch id.(type) { + case int, int8, int16, int32, int64, + uint, uint8, uint16, uint32, uint64, + float32, float64, + string, + nil: + return true + default: + return false + } +} + +// Request is a type for raw JSON-RPC 1.0 requests. The Method field identifies +// the specific command type which in turns leads to different parameters. +// Callers typically will not use this directly since this package provides a +// statically typed command infrastructure which handles creation of these +// requests, however this struct it being exported in case the caller wants to +// construct raw requests for some reason. +type Request struct { + Jsonrpc string `json:"jsonrpc"` + Method string `json:"method"` + Params []json.RawMessage `json:"params"` + ID interface{} `json:"id"` +} + +// NewRequest returns a new JSON-RPC 1.0 request object given the provided id, +// method, and parameters. The parameters are marshalled into a json.RawMessage +// for the Params field of the returned request object. This function is only +// provided in case the caller wants to construct raw requests for some reason. +// +// Typically callers will instead want to create a registered concrete command +// type with the NewCmd or NewCmd functions and call the MarshalCmd +// function with that command to generate the marshalled JSON-RPC request. +func NewRequest(id interface{}, method string, params []interface{}) (*Request, error) { + if !IsValidIDType(id) { + str := fmt.Sprintf("the id of type '%T' is invalid", id) + return nil, makeError(ErrInvalidType, str) + } + + rawParams := make([]json.RawMessage, 0, len(params)) + for _, param := range params { + marshalledParam, err := json.Marshal(param) + if err != nil { + return nil, err + } + rawMessage := json.RawMessage(marshalledParam) + rawParams = append(rawParams, rawMessage) + } + + return &Request{ + Jsonrpc: "1.0", + ID: id, + Method: method, + Params: rawParams, + }, nil +} + +// Response is the general form of a JSON-RPC response. The type of the Result +// field varies from one command to the next, so it is implemented as an +// interface. The ID field has to be a pointer for Go to put a null in it when +// empty. +type Response struct { + Result json.RawMessage `json:"result"` + Error *RPCError `json:"error"` + ID *interface{} `json:"id"` +} + +// NewResponse returns a new JSON-RPC response object given the provided id, +// marshalled result, and RPC error. This function is only provided in case the +// caller wants to construct raw responses for some reason. +// +// Typically callers will instead want to create the fully marshalled JSON-RPC +// response to send over the wire with the MarshalResponse function. +func NewResponse(id interface{}, marshalledResult []byte, rpcErr *RPCError) (*Response, error) { + if !IsValidIDType(id) { + str := fmt.Sprintf("the id of type '%T' is invalid", id) + return nil, makeError(ErrInvalidType, str) + } + + pid := &id + return &Response{ + Result: marshalledResult, + Error: rpcErr, + ID: pid, + }, nil +} + +// MarshalResponse marshals the passed id, result, and RPCError to a JSON-RPC +// response byte slice that is suitable for transmission to a JSON-RPC client. +func MarshalResponse(id interface{}, result interface{}, rpcErr *RPCError) ([]byte, error) { + marshalledResult, err := json.Marshal(result) + if err != nil { + return nil, err + } + response, err := NewResponse(id, marshalledResult, rpcErr) + if err != nil { + return nil, err + } + return json.Marshal(&response) +} diff --git a/v2/btcjson/jsonrpc_test.go b/v2/btcjson/jsonrpc_test.go new file mode 100644 index 00000000..1f1f9fc5 --- /dev/null +++ b/v2/btcjson/jsonrpc_test.go @@ -0,0 +1,161 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "encoding/json" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestIsValidIDType ensures the IsValidIDType function behaves as expected. +func TestIsValidIDType(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + id interface{} + isValid bool + }{ + {"int", int(1), true}, + {"int8", int8(1), true}, + {"int16", int16(1), true}, + {"int32", int32(1), true}, + {"int64", int64(1), true}, + {"uint", uint(1), true}, + {"uint8", uint8(1), true}, + {"uint16", uint16(1), true}, + {"uint32", uint32(1), true}, + {"uint64", uint64(1), true}, + {"string", "1", true}, + {"nil", nil, true}, + {"float32", float32(1), true}, + {"float64", float64(1), true}, + {"bool", true, false}, + {"chan int", make(chan int), false}, + {"complex64", complex64(1), false}, + {"complex128", complex128(1), false}, + {"func", func() {}, false}, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + if btcjson.IsValidIDType(test.id) != test.isValid { + t.Errorf("Test #%d (%s) valid mismatch - got %v, "+ + "want %v", i, test.name, !test.isValid, + test.isValid) + continue + } + } +} + +// TestMarshalResponse ensures the MarshalResponse function works as expected. +func TestMarshalResponse(t *testing.T) { + t.Parallel() + + testID := 1 + tests := []struct { + name string + result interface{} + jsonErr *btcjson.RPCError + expected []byte + }{ + { + name: "ordinary bool result with no error", + result: true, + jsonErr: nil, + expected: []byte(`{"result":true,"error":null,"id":1}`), + }, + { + name: "result with error", + result: nil, + jsonErr: func() *btcjson.RPCError { + return btcjson.NewRPCError(btcjson.ErrRPCBlockNotFound, "123 not found") + }(), + expected: []byte(`{"result":null,"error":{"code":-5,"message":"123 not found"},"id":1}`), + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + _, _ = i, test + marshalled, err := btcjson.MarshalResponse(testID, test.result, test.jsonErr) + if err != nil { + t.Errorf("Test #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(marshalled, test.expected) { + t.Errorf("Test #%d (%s) mismatched result - got %s, "+ + "want %s", i, test.name, marshalled, + test.expected) + } + } +} + +// TestMiscErrors tests a few error conditions not covered elsewhere. +func TestMiscErrors(t *testing.T) { + t.Parallel() + + // Force an error in NewRequest by giving it a parameter type that is + // not supported. + _, err := btcjson.NewRequest(nil, "test", []interface{}{make(chan int)}) + if err == nil { + t.Error("NewRequest: did not receive error") + return + } + + // Force an error in MarshalResponse by giving it an id type that is not + // supported. + wantErr := btcjson.Error{ErrorCode: btcjson.ErrInvalidType} + _, err = btcjson.MarshalResponse(make(chan int), nil, nil) + if jerr, ok := err.(btcjson.Error); !ok || jerr.ErrorCode != wantErr.ErrorCode { + t.Errorf("MarshalResult: did not receive expected error - got "+ + "%v (%[1]T), want %v (%[2]T)", err, wantErr) + return + } + + // Force an error in MarshalResponse by giving it a result type that + // can't be marshalled. + _, err = btcjson.MarshalResponse(1, make(chan int), nil) + if _, ok := err.(*json.UnsupportedTypeError); !ok { + wantErr := &json.UnsupportedTypeError{} + t.Errorf("MarshalResult: did not receive expected error - got "+ + "%v (%[1]T), want %T", err, wantErr) + return + } +} + +// TestRPCError tests the error output for the RPCError type. +func TestRPCError(t *testing.T) { + t.Parallel() + + tests := []struct { + in *btcjson.RPCError + want string + }{ + { + btcjson.ErrRPCInvalidRequest, + "-32600: Invalid request", + }, + { + btcjson.ErrRPCMethodNotFound, + "-32601: Method not found", + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.in.Error() + if result != test.want { + t.Errorf("Error #%d\n got: %s want: %s", i, result, + test.want) + continue + } + } +} diff --git a/v2/btcjson/jsonrpcerr.go b/v2/btcjson/jsonrpcerr.go new file mode 100644 index 00000000..8ed3bad7 --- /dev/null +++ b/v2/btcjson/jsonrpcerr.go @@ -0,0 +1,83 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +// Standard JSON-RPC 2.0 errors. +var ( + ErrRPCInvalidRequest = &RPCError{ + Code: -32600, + Message: "Invalid request", + } + ErrRPCMethodNotFound = &RPCError{ + Code: -32601, + Message: "Method not found", + } + ErrRPCInvalidParams = &RPCError{ + Code: -32602, + Message: "Invalid parameters", + } + ErrRPCInternal = &RPCError{ + Code: -32603, + Message: "Internal error", + } + ErrRPCParse = &RPCError{ + Code: -32700, + Message: "Parse error", + } +) + +// General application defined JSON errors. +const ( + ErrRPCMisc RPCErrorCode = -1 + ErrRPCForbiddenBySafeMode RPCErrorCode = -2 + ErrRPCType RPCErrorCode = -3 + ErrRPCInvalidAddressOrKey RPCErrorCode = -5 + ErrRPCOutOfMemory RPCErrorCode = -7 + ErrRPCInvalidParameter RPCErrorCode = -8 + ErrRPCDatabase RPCErrorCode = -20 + ErrRPCDeserialization RPCErrorCode = -22 + ErrRPCVerify RPCErrorCode = -25 +) + +// Peer-to-peer client errors. +const ( + ErrRPCClientNotConnected RPCErrorCode = -9 + ErrRPCClientInInitialDownload RPCErrorCode = -10 +) + +// Wallet JSON errors +const ( + ErrRPCWallet RPCErrorCode = -4 + ErrRPCWalletInsufficientFunds RPCErrorCode = -6 + ErrRPCWalletInvalidAccountName RPCErrorCode = -11 + ErrRPCWalletKeypoolRanOut RPCErrorCode = -12 + ErrRPCWalletUnlockNeeded RPCErrorCode = -13 + ErrRPCWalletPassphraseIncorrect RPCErrorCode = -14 + ErrRPCWalletWrongEncState RPCErrorCode = -15 + ErrRPCWalletEncryptionFailed RPCErrorCode = -16 + ErrRPCWalletAlreadyUnlocked RPCErrorCode = -17 +) + +// Specific Errors related to commands. These are the ones a user of the RPC +// server are most likely to see. Generally, the codes should match one of the +// more general errors above. +const ( + ErrRPCBlockNotFound RPCErrorCode = -5 + ErrRPCBlockCount RPCErrorCode = -5 + ErrRPCBestBlockHash RPCErrorCode = -5 + ErrRPCDifficulty RPCErrorCode = -5 + ErrRPCOutOfRange RPCErrorCode = -1 + ErrRPCNoTxInfo RPCErrorCode = -5 + ErrRPCNoNewestBlockInfo RPCErrorCode = -5 + ErrRPCInvalidTxVout RPCErrorCode = -5 + ErrRPCRawTxString RPCErrorCode = -32602 + ErrRPCDecodeHexString RPCErrorCode = -22 +) + +// Errors that are specific to btcd. +const ( + ErrRPCNoWallet RPCErrorCode = -1 + ErrRPCUnimplemented RPCErrorCode = -1 +) diff --git a/v2/btcjson/register.go b/v2/btcjson/register.go new file mode 100644 index 00000000..ac18ce0b --- /dev/null +++ b/v2/btcjson/register.go @@ -0,0 +1,292 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +import ( + "encoding/json" + "fmt" + "reflect" + "sort" + "strconv" + "strings" + "sync" +) + +// UsageFlag define flags that specify additional properties about the +// circumstances under which a command can be used. +type UsageFlag uint32 + +const ( + // UFWalletOnly indicates that the command can only be used with an RPC + // server that supports wallet commands. + UFWalletOnly UsageFlag = 1 << iota + + // UFWebsocketOnly indicates that the command can only be used when + // communicating with an RPC server over websockets. This typically + // applies to notifications and notification registration functions + // since neiher makes since when using a single-shot HTTP-POST request. + UFWebsocketOnly + + // UFNotification indicates that the command is actually a notification. + // This means when it is marshalled, the ID must be nil. + UFNotification + + // highestUsageFlagBit is the maximum usage flag bit and is used in the + // stringer and tests to ensure all of the above constants have been + // tested. + highestUsageFlagBit +) + +// Map of UsageFlag values back to their constant names for pretty printing. +var usageFlagStrings = map[UsageFlag]string{ + UFWalletOnly: "UFWalletOnly", + UFWebsocketOnly: "UFWebsocketOnly", + UFNotification: "UFNotification", +} + +// String returns the UsageFlag in human-readable form. +func (fl UsageFlag) String() string { + // No flags are set. + if fl == 0 { + return "0x0" + } + + // Add individual bit flags. + s := "" + for flag := UFWalletOnly; flag < highestUsageFlagBit; flag <<= 1 { + if fl&flag == flag { + s += usageFlagStrings[flag] + "|" + fl -= flag + } + } + + // Add remaining value as raw hex. + s = strings.TrimRight(s, "|") + if fl != 0 { + s += "|0x" + strconv.FormatUint(uint64(fl), 16) + } + s = strings.TrimLeft(s, "|") + return s +} + +// methodInfo keeps track of information about each registered method such as +// the parameter information. +type methodInfo struct { + maxParams int + numReqParams int + numOptParams int + defaults map[int]reflect.Value + flags UsageFlag + usage string +} + +var ( + // These fields are used to map the registered types to method names. + registerLock sync.RWMutex + methodToConcreteType = make(map[string]reflect.Type) + methodToInfo = make(map[string]methodInfo) + concreteTypeToMethod = make(map[reflect.Type]string) +) + +// baseKindString returns the base kind for a given reflect.Type after +// indirecting through all pointers. +func baseKindString(rt reflect.Type) string { + numIndirects := 0 + for rt.Kind() == reflect.Ptr { + numIndirects++ + rt = rt.Elem() + } + + return fmt.Sprintf("%s%s", strings.Repeat("*", numIndirects), rt.Kind()) +} + +// isAcceptableKind returns whether or not the passed field type is a supported +// type. It is called after the first pointer indirection, so further pointers +// are not supported. +func isAcceptableKind(kind reflect.Kind) bool { + switch kind { + case reflect.Chan: + fallthrough + case reflect.Complex64: + fallthrough + case reflect.Complex128: + fallthrough + case reflect.Func: + fallthrough + case reflect.Ptr: + fallthrough + case reflect.Interface: + return false + } + + return true +} + +// RegisterCmd registers a new command that will automatically marshal to and +// from JSON-RPC with full type checking and positional parameter support. It +// also accepts usage flags which identify the circumstances under which the +// command can be used. +// +// This package automatically registers all of the exported commands by default +// using this function, however it is also exported so callers can easily +// register custom types. +// +// The type format is very strict since it needs to be able to automatically +// marshal to and from JSON-RPC 1.0. The following enumerates the requirements: +// +// - The provided command must be a single pointer to a struct +// - All fields must be exported +// - The order of the positional parameters in the marshalled JSON will be in +// the same order as declared in the struct definition +// - Struct embedding is not supported +// - Struct fields may NOT be channels, functions, complex, or interface +// - A field in the provided struct with a pointer is treated as optional +// - Multiple indirections (i.e **int) are not supported +// - Once the first optional field (pointer) is encountered, the remaining +// fields must also be optional fields (pointers) as required by positional +// params +// - A field that has a 'jsonrpcdefault' struct tag must be an optional field +// (pointer) +// +// NOTE: This function only needs to be able to examine the structure of the +// passed struct, so it does not need to be an actual instance. Therefore, it +// is recommended to simply pass a nil pointer cast to the appropriate type. +// For example, (*FooCmd)(nil). +func RegisterCmd(method string, cmd interface{}, flags UsageFlag) error { + registerLock.Lock() + defer registerLock.Unlock() + + if _, ok := methodToConcreteType[method]; ok { + str := fmt.Sprintf("method %q is already registered", method) + return makeError(ErrDuplicateMethod, str) + } + + // Ensure that no unrecognized flag bits were specified. + if ^(highestUsageFlagBit-1)&flags != 0 { + str := fmt.Sprintf("invalid usage flags specified for method "+ + "%s: %v", method, flags) + return makeError(ErrInvalidUsageFlags, str) + } + + rtp := reflect.TypeOf(cmd) + if rtp.Kind() != reflect.Ptr { + str := fmt.Sprintf("type must be *struct not '%s (%s)'", rtp, + rtp.Kind()) + return makeError(ErrInvalidType, str) + } + rt := rtp.Elem() + if rt.Kind() != reflect.Struct { + str := fmt.Sprintf("type must be *struct not '%s (*%s)'", + rtp, rt.Kind()) + return makeError(ErrInvalidType, str) + } + + // Enumerate the struct fields to validate them and gather parameter + // information. + numFields := rt.NumField() + numOptFields := 0 + defaults := make(map[int]reflect.Value) + for i := 0; i < numFields; i++ { + rtf := rt.Field(i) + if rtf.Anonymous { + str := fmt.Sprintf("embedded fields are not supported "+ + "(field name: %q)", rtf.Name) + return makeError(ErrEmbeddedType, str) + } + if rtf.PkgPath != "" { + str := fmt.Sprintf("unexported fields are not supported "+ + "(field name: %q)", rtf.Name) + return makeError(ErrUnexportedField, str) + } + + // Disallow types that can't be JSON encoded. Also, determine + // if the field is optional based on it being a pointer. + var isOptional bool + switch kind := rtf.Type.Kind(); kind { + case reflect.Ptr: + isOptional = true + kind = rtf.Type.Elem().Kind() + fallthrough + default: + if !isAcceptableKind(kind) { + str := fmt.Sprintf("unsupported field type "+ + "'%s (%s)' (field name %q)", rtf.Type, + baseKindString(rtf.Type), rtf.Name) + return makeError(ErrUnsupportedFieldType, str) + } + } + + // Count the optional fields and ensure all fields after the + // first optional field are also optional. + if isOptional { + numOptFields++ + } else { + if numOptFields > 0 { + str := fmt.Sprintf("all fields after the first "+ + "optional field must also be optional "+ + "(field name %q)", rtf.Name) + return makeError(ErrNonOptionalField, str) + } + } + + // Ensure the default value can be unsmarshalled into the type + // and that defaults are only specified for optional fields. + if tag := rtf.Tag.Get("jsonrpcdefault"); tag != "" { + if !isOptional { + str := fmt.Sprintf("required fields must not "+ + "have a default specified (field name "+ + "%q)", rtf.Name) + return makeError(ErrNonOptionalDefault, str) + } + + rvf := reflect.New(rtf.Type.Elem()) + err := json.Unmarshal([]byte(tag), rvf.Interface()) + if err != nil { + str := fmt.Sprintf("default value of %q is "+ + "the wrong type (field name %q)", tag, + rtf.Name) + return makeError(ErrMismatchedDefault, str) + } + defaults[i] = rvf + } + } + + // Update the registration maps. + methodToConcreteType[method] = rtp + methodToInfo[method] = methodInfo{ + maxParams: numFields, + numReqParams: numFields - numOptFields, + numOptParams: numOptFields, + defaults: defaults, + flags: flags, + } + concreteTypeToMethod[rtp] = method + return nil +} + +// MustRegisterCmd performs the same function as RegisterCmd except it panics +// if there is an error. This should only be called from package init +// functions. +func MustRegisterCmd(method string, cmd interface{}, flags UsageFlag) { + if err := RegisterCmd(method, cmd, flags); err != nil { + panic(fmt.Sprintf("failed to register type %q: %v\n", method, + err)) + } +} + +// RegisteredCmdMethods returns a sorted list of methods for all registered +// commands. +func RegisteredCmdMethods() []string { + registerLock.Lock() + defer registerLock.Unlock() + + methods := make([]string, 0, len(methodToInfo)) + for k := range methodToInfo { + methods = append(methods, k) + } + + sort.Sort(sort.StringSlice(methods)) + return methods +} diff --git a/v2/btcjson/register_test.go b/v2/btcjson/register_test.go new file mode 100644 index 00000000..9fac1172 --- /dev/null +++ b/v2/btcjson/register_test.go @@ -0,0 +1,263 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "reflect" + "sort" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestUsageFlagStringer tests the stringized output for the UsageFlag type. +func TestUsageFlagStringer(t *testing.T) { + t.Parallel() + + tests := []struct { + in btcjson.UsageFlag + want string + }{ + {0, "0x0"}, + {btcjson.UFWalletOnly, "UFWalletOnly"}, + {btcjson.UFWebsocketOnly, "UFWebsocketOnly"}, + {btcjson.UFNotification, "UFNotification"}, + {btcjson.UFWalletOnly | btcjson.UFWebsocketOnly, + "UFWalletOnly|UFWebsocketOnly"}, + {btcjson.UFWalletOnly | btcjson.UFWebsocketOnly | (1 << 31), + "UFWalletOnly|UFWebsocketOnly|0x80000000"}, + } + + // Detect additional usage flags that don't have the stringer added. + numUsageFlags := 0 + highestUsageFlagBit := btcjson.TstHighestUsageFlagBit + for highestUsageFlagBit > 1 { + numUsageFlags++ + highestUsageFlagBit >>= 1 + } + if len(tests)-3 != numUsageFlags { + t.Errorf("It appears a usage flag was added without adding " + + "an associated stringer test") + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + result := test.in.String() + if result != test.want { + t.Errorf("String #%d\n got: %s want: %s", i, result, + test.want) + continue + } + } +} + +// TestRegisterCmdErrors ensures the RegisterCmd function returns the expected +// error when provided with invalid types. +func TestRegisterCmdErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + cmdFunc func() interface{} + flags btcjson.UsageFlag + err btcjson.Error + }{ + { + name: "duplicate method", + method: "getblock", + cmdFunc: func() interface{} { + return struct{}{} + }, + err: btcjson.Error{ErrorCode: btcjson.ErrDuplicateMethod}, + }, + { + name: "invalid usage flags", + method: "registertestcmd", + cmdFunc: func() interface{} { + return 0 + }, + flags: btcjson.TstHighestUsageFlagBit, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidUsageFlags}, + }, + { + name: "invalid type", + method: "registertestcmd", + cmdFunc: func() interface{} { + return 0 + }, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid type 2", + method: "registertestcmd", + cmdFunc: func() interface{} { + return &[]string{} + }, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "embedded field", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ int } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrEmbeddedType}, + }, + { + name: "unexported field", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ a int } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnexportedField}, + }, + { + name: "unsupported field type 1", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ A **int } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnsupportedFieldType}, + }, + { + name: "unsupported field type 2", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ A chan int } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnsupportedFieldType}, + }, + { + name: "unsupported field type 3", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ A complex64 } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnsupportedFieldType}, + }, + { + name: "unsupported field type 4", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ A complex128 } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnsupportedFieldType}, + }, + { + name: "unsupported field type 5", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ A func() } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnsupportedFieldType}, + }, + { + name: "unsupported field type 6", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct{ A interface{} } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrUnsupportedFieldType}, + }, + { + name: "required after optional", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct { + A *int + B int + } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrNonOptionalField}, + }, + { + name: "non-optional with default", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct { + A int `jsonrpcdefault:"1"` + } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrNonOptionalDefault}, + }, + { + name: "mismatched default", + method: "registertestcmd", + cmdFunc: func() interface{} { + type test struct { + A *int `jsonrpcdefault:"1.7"` + } + return (*test)(nil) + }, + err: btcjson.Error{ErrorCode: btcjson.ErrMismatchedDefault}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + err := btcjson.RegisterCmd(test.method, test.cmdFunc(), + test.flags) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T, "+ + "want %T", i, test.name, err, test.err) + continue + } + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code - got "+ + "%v, want %v", i, test.name, gotErrorCode, + test.err.ErrorCode) + continue + } + } +} + +// TestMustRegisterCmdPanic ensures the MustRegisterCmd function panics when +// used to register an invalid type. +func TestMustRegisterCmdPanic(t *testing.T) { + t.Parallel() + + // Setup a defer to catch the expected panic to ensure it actually + // paniced. + defer func() { + if err := recover(); err == nil { + t.Error("MustRegisterCmd did not panic as expected") + } + }() + + // Intentionally try to register an invalid type to force a panic. + btcjson.MustRegisterCmd("panicme", 0, 0) +} + +// TestRegisteredCmdMethods tests the RegisteredCmdMethods function ensure it +// works as expected. +func TestRegisteredCmdMethods(t *testing.T) { + t.Parallel() + + // Ensure the registerd methods are returned. + methods := btcjson.RegisteredCmdMethods() + if len(methods) == 0 { + t.Fatal("RegisteredCmdMethods: no methods") + } + + // Ensure the returnd methods are sorted. + sortedMethods := make([]string, len(methods)) + copy(sortedMethods, methods) + sort.Sort(sort.StringSlice(sortedMethods)) + if !reflect.DeepEqual(sortedMethods, methods) { + t.Fatal("RegisteredCmdMethods: methods are not sorted") + } +} diff --git a/v2/btcjson/walletsvrcmds.go b/v2/btcjson/walletsvrcmds.go new file mode 100644 index 00000000..bafbbacd --- /dev/null +++ b/v2/btcjson/walletsvrcmds.go @@ -0,0 +1,675 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC commands that are supported by +// a wallet server. + +package btcjson + +// AddMultisigAddressCmd defines the addmutisigaddress JSON-RPC command. +type AddMultisigAddressCmd struct { + NRequired int + Keys []string + Account *string `jsonrpcdefault:"\"\""` +} + +// NewAddMultisigAddressCmd returns a new instance which can be used to issue a +// addmultisigaddress JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewAddMultisigAddressCmd(nRequired int, keys []string, account *string) *AddMultisigAddressCmd { + return &AddMultisigAddressCmd{ + NRequired: nRequired, + Keys: keys, + Account: account, + } +} + +// CreateMultisigCmd defines the createmultisig JSON-RPC command. +type CreateMultisigCmd struct { + NRequired int + Keys []string +} + +// NewCreateMultisigCmd returns a new instance which can be used to issue a +// createmultisig JSON-RPC command. +func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd { + return &CreateMultisigCmd{ + NRequired: nRequired, + Keys: keys, + } +} + +// DumpPrivKeyCmd defines the dumpprivkey JSON-RPC command. +type DumpPrivKeyCmd struct { + Address string +} + +// NewDumpPrivKeyCmd returns a new instance which can be used to issue a +// dumpprivkey JSON-RPC command. +func NewDumpPrivKeyCmd(address string) *DumpPrivKeyCmd { + return &DumpPrivKeyCmd{ + Address: address, + } +} + +// EncryptWalletCmd defines the encryptwallet JSON-RPC command. +type EncryptWalletCmd struct { + Passphrase string +} + +// NewEncryptWalletCmd returns a new instance which can be used to issue a +// encryptwallet JSON-RPC command. +func NewEncryptWalletCmd(passphrase string) *EncryptWalletCmd { + return &EncryptWalletCmd{ + Passphrase: passphrase, + } +} + +// EstimateFeeCmd defines the estimatefee JSON-RPC command. +type EstimateFeeCmd struct { + NumBlocks int64 +} + +// NewEstimateFeeCmd returns a new instance which can be used to issue a +// estimatefee JSON-RPC command. +func NewEstimateFeeCmd(numBlocks int64) *EstimateFeeCmd { + return &EstimateFeeCmd{ + NumBlocks: numBlocks, + } +} + +// EstimatePriorityCmd defines the estimatepriority JSON-RPC command. +type EstimatePriorityCmd struct { + NumBlocks int64 +} + +// NewEstimatePriorityCmd returns a new instance which can be used to issue a +// estimatepriority JSON-RPC command. +func NewEstimatePriorityCmd(numBlocks int64) *EstimatePriorityCmd { + return &EstimatePriorityCmd{ + NumBlocks: numBlocks, + } +} + +// GetAccountCmd defines the getaccount JSON-RPC command. +type GetAccountCmd struct { + Address string +} + +// NewGetAccountCmd returns a new instance which can be used to issue a +// getaccount JSON-RPC command. +func NewGetAccountCmd(address string) *GetAccountCmd { + return &GetAccountCmd{ + Address: address, + } +} + +// GetAccountAddressCmd defines the getaccountaddress JSON-RPC command. +type GetAccountAddressCmd struct { + Account string +} + +// NewGetAccountAddressCmd returns a new instance which can be used to issue a +// getaccountaddress JSON-RPC command. +func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd { + return &GetAccountAddressCmd{ + Account: account, + } +} + +// GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command. +type GetAddressesByAccountCmd struct { + Account string +} + +// NewGetAddressesByAccountCmd returns a new instance which can be used to issue +// a getaddressesbyaccount JSON-RPC command. +func NewGetAddressesByAccountCmd(account string) *GetAddressesByAccountCmd { + return &GetAddressesByAccountCmd{ + Account: account, + } +} + +// GetBalanceCmd defines the getbalance JSON-RPC command. +type GetBalanceCmd struct { + Account *string `jsonrpcdefault:"\"*\""` + MinConf *int `jsonrpcdefault:"1"` +} + +// NewGetBalanceCmd returns a new instance which can be used to issue a +// getbalance JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd { + return &GetBalanceCmd{ + Account: account, + MinConf: minConf, + } +} + +// GetNewAddressCmd defines the getnewaddress JSON-RPC command. +type GetNewAddressCmd struct { + Account *string `jsonrpcdefault:"\"\""` +} + +// NewGetNewAddressCmd returns a new instance which can be used to issue a +// getnewaddress JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetNewAddressCmd(account *string) *GetNewAddressCmd { + return &GetNewAddressCmd{ + Account: account, + } +} + +// GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command. +type GetRawChangeAddressCmd struct { + Account *string `jsonrpcdefault:"\"\""` +} + +// NewGetRawChangeAddressCmd returns a new instance which can be used to issue a +// getrawchangeaddress JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd { + return &GetRawChangeAddressCmd{ + Account: account, + } +} + +// GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command. +type GetReceivedByAccountCmd struct { + Account string + MinConf *int `jsonrpcdefault:"1"` +} + +// NewGetReceivedByAccountCmd returns a new instance which can be used to issue +// a getreceivedbyaccount JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetReceivedByAccountCmd(account string, minConf *int) *GetReceivedByAccountCmd { + return &GetReceivedByAccountCmd{ + Account: account, + MinConf: minConf, + } +} + +// GetReceivedByAddressCmd defines the getreceivedbyaddress JSON-RPC command. +type GetReceivedByAddressCmd struct { + Address string + MinConf *int `jsonrpcdefault:"1"` +} + +// NewGetReceivedByAddressCmd returns a new instance which can be used to issue +// a getreceivedbyaddress JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetReceivedByAddressCmd(address string, minConf *int) *GetReceivedByAddressCmd { + return &GetReceivedByAddressCmd{ + Address: address, + MinConf: minConf, + } +} + +// GetTransactionCmd defines the gettransaction JSON-RPC command. +type GetTransactionCmd struct { + Txid string + IncludeWatchOnly *bool `jsonrpcdefault:"false"` +} + +// NewGetTransactionCmd returns a new instance which can be used to issue a +// gettransaction JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetTransactionCmd(txHash string, includeWatchOnly *bool) *GetTransactionCmd { + return &GetTransactionCmd{ + Txid: txHash, + IncludeWatchOnly: includeWatchOnly, + } +} + +// ImportPrivKeyCmd defines the importprivkey JSON-RPC command. +type ImportPrivKeyCmd struct { + PrivKey string + Label *string `jsonrpcdefault:"\"\""` + Rescan *bool `jsonrpcdefault:"true"` +} + +// NewImportPrivKeyCmd returns a new instance which can be used to issue a +// importprivkey JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewImportPrivKeyCmd(privKey string, label *string, rescan *bool) *ImportPrivKeyCmd { + return &ImportPrivKeyCmd{ + PrivKey: privKey, + Label: label, + Rescan: rescan, + } +} + +// KeyPoolRefillCmd defines the keypoolrefill JSON-RPC command. +type KeyPoolRefillCmd struct { + NewSize *uint `jsonrpcdefault:"100"` +} + +// NewKeyPoolRefillCmd returns a new instance which can be used to issue a +// keypoolrefill JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewKeyPoolRefillCmd(newSize *uint) *KeyPoolRefillCmd { + return &KeyPoolRefillCmd{ + NewSize: newSize, + } +} + +// ListAccountsCmd defines the listaccounts JSON-RPC command. +type ListAccountsCmd struct { + MinConf *int `jsonrpcdefault:"1"` +} + +// NewListAccountsCmd returns a new instance which can be used to issue a +// listaccounts JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListAccountsCmd(minConf *int) *ListAccountsCmd { + return &ListAccountsCmd{ + MinConf: minConf, + } +} + +// ListAddressGroupingsCmd defines the listaddressgroupings JSON-RPC command. +type ListAddressGroupingsCmd struct{} + +// NewListAddressGroupingsCmd returns a new instance which can be used to issue +// a listaddressgroupoings JSON-RPC command. +func NewListAddressGroupingsCmd() *ListAddressGroupingsCmd { + return &ListAddressGroupingsCmd{} +} + +// ListLockUnspentCmd defines the listlockunspent JSON-RPC command. +type ListLockUnspentCmd struct{} + +// NewListLockUnspentCmd returns a new instance which can be used to issue a +// listlockunspent JSON-RPC command. +func NewListLockUnspentCmd() *ListLockUnspentCmd { + return &ListLockUnspentCmd{} +} + +// ListReceivedByAccountCmd defines the listreceivedbyaccount JSON-RPC command. +type ListReceivedByAccountCmd struct { + MinConf *int `jsonrpcdefault:"1"` + IncludeEmpty *bool `jsonrpcdefault:"false"` + IncludeWatchOnly *bool `jsonrpcdefault:"false"` +} + +// NewListReceivedByAccountCmd returns a new instance which can be used to issue +// a listreceivedbyaccount JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListReceivedByAccountCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAccountCmd { + return &ListReceivedByAccountCmd{ + MinConf: minConf, + IncludeEmpty: includeEmpty, + IncludeWatchOnly: includeWatchOnly, + } +} + +// ListReceivedByAddressCmd defines the listreceivedbyaddress JSON-RPC command. +type ListReceivedByAddressCmd struct { + MinConf *int `jsonrpcdefault:"1"` + IncludeEmpty *bool `jsonrpcdefault:"false"` + IncludeWatchOnly *bool `jsonrpcdefault:"false"` +} + +// NewListReceivedByAddressCmd returns a new instance which can be used to issue +// a listreceivedbyaddress JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListReceivedByAddressCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAddressCmd { + return &ListReceivedByAddressCmd{ + MinConf: minConf, + IncludeEmpty: includeEmpty, + IncludeWatchOnly: includeWatchOnly, + } +} + +// ListSinceBlockCmd defines the listsinceblock JSON-RPC command. +type ListSinceBlockCmd struct { + BlockHash *string + TargetConfirmations *int `jsonrpcdefault:"1"` + IncludeWatchOnly *bool `jsonrpcdefault:"false"` +} + +// NewListSinceBlockCmd returns a new instance which can be used to issue a +// listsinceblock JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListSinceBlockCmd(blockHash *string, targetConfirms *int, includeWatchOnly *bool) *ListSinceBlockCmd { + return &ListSinceBlockCmd{ + BlockHash: blockHash, + TargetConfirmations: targetConfirms, + IncludeWatchOnly: includeWatchOnly, + } +} + +// ListTransactionsCmd defines the listtransactions JSON-RPC command. +type ListTransactionsCmd struct { + Account *string + Count *int `jsonrpcdefault:"10"` + From *int `jsonrpcdefault:"0"` + IncludeWatchOnly *bool `jsonrpcdefault:"false"` +} + +// NewListTransactionsCmd returns a new instance which can be used to issue a +// listtransactions JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListTransactionsCmd(account *string, count, from *int, includeWatchOnly *bool) *ListTransactionsCmd { + return &ListTransactionsCmd{ + Account: account, + Count: count, + From: from, + IncludeWatchOnly: includeWatchOnly, + } +} + +// ListUnspentCmd defines the listunspent JSON-RPC command. +type ListUnspentCmd struct { + MinConf *int `jsonrpcdefault:"1"` + MaxConf *int `jsonrpcdefault:"9999999"` + Addresses *[]string +} + +// NewListUnspentCmd returns a new instance which can be used to issue a +// listunspent JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListUnspentCmd(minConf, maxConf *int, addresses *[]string) *ListUnspentCmd { + return &ListUnspentCmd{ + MinConf: minConf, + MaxConf: maxConf, + Addresses: addresses, + } +} + +// LockUnspentCmd defines the lockunspent JSON-RPC command. +type LockUnspentCmd struct { + Unlock bool + Transactions []TransactionInput +} + +// NewLockUnspentCmd returns a new instance which can be used to issue a +// lockunspent JSON-RPC command. +func NewLockUnspentCmd(unlock bool, transactions []TransactionInput) *LockUnspentCmd { + return &LockUnspentCmd{ + Unlock: unlock, + Transactions: transactions, + } +} + +// MoveCmd defines the move JSON-RPC command. +type MoveCmd struct { + FromAccount string + ToAccount string + Amount float64 // In BTC + MinConf *int `jsonrpcdefault:"1"` + Comment *string +} + +// NewMoveCmd returns a new instance which can be used to issue a move JSON-RPC +// command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewMoveCmd(fromAccount, toAccount string, amount float64, minConf *int, comment *string) *MoveCmd { + return &MoveCmd{ + FromAccount: fromAccount, + ToAccount: toAccount, + Amount: amount, + MinConf: minConf, + Comment: comment, + } +} + +// SendFromCmd defines the sendfrom JSON-RPC command. +type SendFromCmd struct { + FromAccount string + ToAddress string + Amount float64 // In BTC + MinConf *int `jsonrpcdefault:"1"` + Comment *string + CommentTo *string +} + +// NewSendFromCmd returns a new instance which can be used to issue a sendfrom +// JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSendFromCmd(fromAccount, toAddress string, amount float64, minConf *int, comment, commentTo *string) *SendFromCmd { + return &SendFromCmd{ + FromAccount: fromAccount, + ToAddress: toAddress, + Amount: amount, + MinConf: minConf, + Comment: comment, + CommentTo: commentTo, + } +} + +// SendManyCmd defines the sendmany JSON-RPC command. +type SendManyCmd struct { + FromAccount string + Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In BTC + MinConf *int `jsonrpcdefault:"1"` + Comment *string +} + +// NewSendManyCmd returns a new instance which can be used to issue a sendmany +// JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSendManyCmd(fromAccount string, amounts map[string]float64, minConf *int, comment *string) *SendManyCmd { + return &SendManyCmd{ + FromAccount: fromAccount, + Amounts: amounts, + MinConf: minConf, + Comment: comment, + } +} + +// SendToAddressCmd defines the sendtoaddress JSON-RPC command. +type SendToAddressCmd struct { + Address string + Amount float64 + Comment *string + CommentTo *string +} + +// NewSendToAddressCmd returns a new instance which can be used to issue a +// sendtoaddress JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSendToAddressCmd(address string, amount float64, comment, commentTo *string) *SendToAddressCmd { + return &SendToAddressCmd{ + Address: address, + Amount: amount, + Comment: comment, + CommentTo: commentTo, + } +} + +// SetAccountCmd defines the setaccount JSON-RPC command. +type SetAccountCmd struct { + Address string + Account string +} + +// NewSetAccountCmd returns a new instance which can be used to issue a +// setaccount JSON-RPC command. +func NewSetAccountCmd(address, account string) *SetAccountCmd { + return &SetAccountCmd{ + Address: address, + Account: account, + } +} + +// SetTxFeeCmd defines the settxfee JSON-RPC command. +type SetTxFeeCmd struct { + Amount float64 // In BTC +} + +// NewSetTxFeeCmd returns a new instance which can be used to issue a settxfee +// JSON-RPC command. +func NewSetTxFeeCmd(amount float64) *SetTxFeeCmd { + return &SetTxFeeCmd{ + Amount: amount, + } +} + +// SignMessageCmd defines the signmessage JSON-RPC command. +type SignMessageCmd struct { + Address string + Message string +} + +// NewSignMessageCmd returns a new instance which can be used to issue a +// signmessage JSON-RPC command. +func NewSignMessageCmd(address, message string) *SignMessageCmd { + return &SignMessageCmd{ + Address: address, + Message: message, + } +} + +// RawTxInput models the data needed for raw transaction input that is used in +// the SignRawTransactionCmd struct. +type RawTxInput struct { + Txid string `json:"txid"` + Vout uint32 `json:"vout"` + ScriptPubKey string `json:"scriptPubKey"` + RedeemScript string `json:"redeemScript"` +} + +// SignRawTransactionCmd defines the signrawtransaction JSON-RPC command. +type SignRawTransactionCmd struct { + RawTx string + Inputs *[]RawTxInput + PrivKeys *[]string + Flags *string `jsonrpcdefault:"\"ALL\""` +} + +// NewSignRawTransactionCmd returns a new instance which can be used to issue a +// signrawtransaction JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKeys *[]string, flags *string) *SignRawTransactionCmd { + return &SignRawTransactionCmd{ + RawTx: hexEncodedTx, + Inputs: inputs, + PrivKeys: privKeys, + Flags: flags, + } +} + +// WalletLockCmd defines the walletlock JSON-RPC command. +type WalletLockCmd struct{} + +// NewWalletLockCmd returns a new instance which can be used to issue a +// walletlock JSON-RPC command. +func NewWalletLockCmd() *WalletLockCmd { + return &WalletLockCmd{} +} + +// WalletPassphraseCmd defines the walletpassphrase JSON-RPC command. +type WalletPassphraseCmd struct { + Passphrase string + Timeout int64 +} + +// NewWalletPassphraseCmd returns a new instance which can be used to issue a +// walletpassphrase JSON-RPC command. +func NewWalletPassphraseCmd(passphrase string, timeout int64) *WalletPassphraseCmd { + return &WalletPassphraseCmd{ + Passphrase: passphrase, + Timeout: timeout, + } +} + +// WalletPassphraseChangeCmd defines the walletpassphrase JSON-RPC command. +type WalletPassphraseChangeCmd struct { + OldPassphrase string + NewPassphrase string +} + +// NewWalletPassphraseChangeCmd returns a new instance which can be used to +// issue a walletpassphrasechange JSON-RPC command. +func NewWalletPassphraseChangeCmd(oldPassphrase, newPassphrase string) *WalletPassphraseChangeCmd { + return &WalletPassphraseChangeCmd{ + OldPassphrase: oldPassphrase, + NewPassphrase: newPassphrase, + } +} + +func init() { + // The commands in this file are only usable with a wallet server. + flags := UFWalletOnly + + MustRegisterCmd("addmultisigaddress", (*AddMultisigAddressCmd)(nil), flags) + MustRegisterCmd("createmultisig", (*CreateMultisigCmd)(nil), flags) + MustRegisterCmd("dumpprivkey", (*DumpPrivKeyCmd)(nil), flags) + MustRegisterCmd("encryptwallet", (*EncryptWalletCmd)(nil), flags) + MustRegisterCmd("estimatefee", (*EstimateFeeCmd)(nil), flags) + MustRegisterCmd("estimatepriority", (*EstimatePriorityCmd)(nil), flags) + MustRegisterCmd("getaccount", (*GetAccountCmd)(nil), flags) + MustRegisterCmd("getaccountaddress", (*GetAccountAddressCmd)(nil), flags) + MustRegisterCmd("getaddressesbyaccount", (*GetAddressesByAccountCmd)(nil), flags) + MustRegisterCmd("getbalance", (*GetBalanceCmd)(nil), flags) + MustRegisterCmd("getnewaddress", (*GetNewAddressCmd)(nil), flags) + MustRegisterCmd("getrawchangeaddress", (*GetRawChangeAddressCmd)(nil), flags) + MustRegisterCmd("getreceivedbyaccount", (*GetReceivedByAccountCmd)(nil), flags) + MustRegisterCmd("getreceivedbyaddress", (*GetReceivedByAddressCmd)(nil), flags) + MustRegisterCmd("gettransaction", (*GetTransactionCmd)(nil), flags) + MustRegisterCmd("importprivkey", (*ImportPrivKeyCmd)(nil), flags) + MustRegisterCmd("keypoolrefill", (*KeyPoolRefillCmd)(nil), flags) + MustRegisterCmd("listaccounts", (*ListAccountsCmd)(nil), flags) + MustRegisterCmd("listaddressgroupings", (*ListAddressGroupingsCmd)(nil), flags) + MustRegisterCmd("listlockunspent", (*ListLockUnspentCmd)(nil), flags) + MustRegisterCmd("listreceivedbyaccount", (*ListReceivedByAccountCmd)(nil), flags) + MustRegisterCmd("listreceivedbyaddress", (*ListReceivedByAddressCmd)(nil), flags) + MustRegisterCmd("listsinceblock", (*ListSinceBlockCmd)(nil), flags) + MustRegisterCmd("listtransactions", (*ListTransactionsCmd)(nil), flags) + MustRegisterCmd("listunspent", (*ListUnspentCmd)(nil), flags) + MustRegisterCmd("lockunspent", (*LockUnspentCmd)(nil), flags) + MustRegisterCmd("move", (*MoveCmd)(nil), flags) + MustRegisterCmd("sendfrom", (*SendFromCmd)(nil), flags) + MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags) + MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags) + MustRegisterCmd("setaccount", (*SetAccountCmd)(nil), flags) + MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags) + MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags) + MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags) + MustRegisterCmd("walletlock", (*WalletLockCmd)(nil), flags) + MustRegisterCmd("walletpassphrase", (*WalletPassphraseCmd)(nil), flags) + MustRegisterCmd("walletpassphrasechange", (*WalletPassphraseChangeCmd)(nil), flags) +} diff --git a/v2/btcjson/walletsvrcmds_test.go b/v2/btcjson/walletsvrcmds_test.go new file mode 100644 index 00000000..99ec4a5d --- /dev/null +++ b/v2/btcjson/walletsvrcmds_test.go @@ -0,0 +1,1250 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestWalletSvrCmds tests all of the wallet server commands marshal and +// unmarshal into valid results include handling of optional fields being +// omitted in the marshalled command, while optional fields with defaults have +// the default assigned on unmarshalled commands. +func TestWalletSvrCmds(t *testing.T) { + t.Parallel() + + testID := int(1) + tests := []struct { + name string + newCmd func() (interface{}, error) + staticCmd func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "addmultisigaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("addmultisigaddress", 2, []string{"031234", "035678"}) + }, + staticCmd: func() interface{} { + keys := []string{"031234", "035678"} + return btcjson.NewAddMultisigAddressCmd(2, keys, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"addmultisigaddress","params":[2,["031234","035678"]],"id":1}`, + unmarshalled: &btcjson.AddMultisigAddressCmd{ + NRequired: 2, + Keys: []string{"031234", "035678"}, + Account: btcjson.String(""), + }, + }, + { + name: "addmultisigaddress optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("addmultisigaddress", 2, []string{"031234", "035678"}, "test") + }, + staticCmd: func() interface{} { + keys := []string{"031234", "035678"} + return btcjson.NewAddMultisigAddressCmd(2, keys, btcjson.String("test")) + }, + marshalled: `{"jsonrpc":"1.0","method":"addmultisigaddress","params":[2,["031234","035678"],"test"],"id":1}`, + unmarshalled: &btcjson.AddMultisigAddressCmd{ + NRequired: 2, + Keys: []string{"031234", "035678"}, + Account: btcjson.String("test"), + }, + }, + { + name: "createmultisig", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("createmultisig", 2, []string{"031234", "035678"}) + }, + staticCmd: func() interface{} { + keys := []string{"031234", "035678"} + return btcjson.NewCreateMultisigCmd(2, keys) + }, + marshalled: `{"jsonrpc":"1.0","method":"createmultisig","params":[2,["031234","035678"]],"id":1}`, + unmarshalled: &btcjson.CreateMultisigCmd{ + NRequired: 2, + Keys: []string{"031234", "035678"}, + }, + }, + { + name: "dumpprivkey", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("dumpprivkey", "1Address") + }, + staticCmd: func() interface{} { + return btcjson.NewDumpPrivKeyCmd("1Address") + }, + marshalled: `{"jsonrpc":"1.0","method":"dumpprivkey","params":["1Address"],"id":1}`, + unmarshalled: &btcjson.DumpPrivKeyCmd{ + Address: "1Address", + }, + }, + { + name: "encryptwallet", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("encryptwallet", "pass") + }, + staticCmd: func() interface{} { + return btcjson.NewEncryptWalletCmd("pass") + }, + marshalled: `{"jsonrpc":"1.0","method":"encryptwallet","params":["pass"],"id":1}`, + unmarshalled: &btcjson.EncryptWalletCmd{ + Passphrase: "pass", + }, + }, + { + name: "estimatefee", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("estimatefee", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewEstimateFeeCmd(6) + }, + marshalled: `{"jsonrpc":"1.0","method":"estimatefee","params":[6],"id":1}`, + unmarshalled: &btcjson.EstimateFeeCmd{ + NumBlocks: 6, + }, + }, + { + name: "estimatepriority", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("estimatepriority", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewEstimatePriorityCmd(6) + }, + marshalled: `{"jsonrpc":"1.0","method":"estimatepriority","params":[6],"id":1}`, + unmarshalled: &btcjson.EstimatePriorityCmd{ + NumBlocks: 6, + }, + }, + { + name: "getaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getaccount", "1Address") + }, + staticCmd: func() interface{} { + return btcjson.NewGetAccountCmd("1Address") + }, + marshalled: `{"jsonrpc":"1.0","method":"getaccount","params":["1Address"],"id":1}`, + unmarshalled: &btcjson.GetAccountCmd{ + Address: "1Address", + }, + }, + { + name: "getaccountaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getaccountaddress", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetAccountAddressCmd("acct") + }, + marshalled: `{"jsonrpc":"1.0","method":"getaccountaddress","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetAccountAddressCmd{ + Account: "acct", + }, + }, + { + name: "getaddressesbyaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getaddressesbyaccount", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetAddressesByAccountCmd("acct") + }, + marshalled: `{"jsonrpc":"1.0","method":"getaddressesbyaccount","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetAddressesByAccountCmd{ + Account: "acct", + }, + }, + { + name: "getbalance", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getbalance") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBalanceCmd(nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":[],"id":1}`, + unmarshalled: &btcjson.GetBalanceCmd{ + Account: btcjson.String("*"), + MinConf: btcjson.Int(1), + }, + }, + { + name: "getbalance optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getbalance", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetBalanceCmd(btcjson.String("acct"), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetBalanceCmd{ + Account: btcjson.String("acct"), + MinConf: btcjson.Int(1), + }, + }, + { + name: "getbalance optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getbalance", "acct", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewGetBalanceCmd(btcjson.String("acct"), btcjson.Int(6)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getbalance","params":["acct",6],"id":1}`, + unmarshalled: &btcjson.GetBalanceCmd{ + Account: btcjson.String("acct"), + MinConf: btcjson.Int(6), + }, + }, + { + name: "getnewaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnewaddress") + }, + staticCmd: func() interface{} { + return btcjson.NewGetNewAddressCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":[],"id":1}`, + unmarshalled: &btcjson.GetNewAddressCmd{ + Account: btcjson.String(""), + }, + }, + { + name: "getnewaddress optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getnewaddress", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetNewAddressCmd(btcjson.String("acct")) + }, + marshalled: `{"jsonrpc":"1.0","method":"getnewaddress","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetNewAddressCmd{ + Account: btcjson.String("acct"), + }, + }, + { + name: "getrawchangeaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getrawchangeaddress") + }, + staticCmd: func() interface{} { + return btcjson.NewGetRawChangeAddressCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":[],"id":1}`, + unmarshalled: &btcjson.GetRawChangeAddressCmd{ + Account: btcjson.String(""), + }, + }, + { + name: "getrawchangeaddress optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getrawchangeaddress", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetRawChangeAddressCmd(btcjson.String("acct")) + }, + marshalled: `{"jsonrpc":"1.0","method":"getrawchangeaddress","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetRawChangeAddressCmd{ + Account: btcjson.String("acct"), + }, + }, + { + name: "getreceivedbyaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getreceivedbyaccount", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetReceivedByAccountCmd("acct", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaccount","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetReceivedByAccountCmd{ + Account: "acct", + MinConf: btcjson.Int(1), + }, + }, + { + name: "getreceivedbyaccount optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getreceivedbyaccount", "acct", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewGetReceivedByAccountCmd("acct", btcjson.Int(6)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaccount","params":["acct",6],"id":1}`, + unmarshalled: &btcjson.GetReceivedByAccountCmd{ + Account: "acct", + MinConf: btcjson.Int(6), + }, + }, + { + name: "getreceivedbyaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getreceivedbyaddress", "1Address") + }, + staticCmd: func() interface{} { + return btcjson.NewGetReceivedByAddressCmd("1Address", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaddress","params":["1Address"],"id":1}`, + unmarshalled: &btcjson.GetReceivedByAddressCmd{ + Address: "1Address", + MinConf: btcjson.Int(1), + }, + }, + { + name: "getreceivedbyaddress optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getreceivedbyaddress", "1Address", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewGetReceivedByAddressCmd("1Address", btcjson.Int(6)) + }, + marshalled: `{"jsonrpc":"1.0","method":"getreceivedbyaddress","params":["1Address",6],"id":1}`, + unmarshalled: &btcjson.GetReceivedByAddressCmd{ + Address: "1Address", + MinConf: btcjson.Int(6), + }, + }, + { + name: "gettransaction", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("gettransaction", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewGetTransactionCmd("123", nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"gettransaction","params":["123"],"id":1}`, + unmarshalled: &btcjson.GetTransactionCmd{ + Txid: "123", + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "gettransaction optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("gettransaction", "123", true) + }, + staticCmd: func() interface{} { + return btcjson.NewGetTransactionCmd("123", btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"gettransaction","params":["123",true],"id":1}`, + unmarshalled: &btcjson.GetTransactionCmd{ + Txid: "123", + IncludeWatchOnly: btcjson.Bool(true), + }, + }, + { + name: "importprivkey", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importprivkey", "abc") + }, + staticCmd: func() interface{} { + return btcjson.NewImportPrivKeyCmd("abc", nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"importprivkey","params":["abc"],"id":1}`, + unmarshalled: &btcjson.ImportPrivKeyCmd{ + PrivKey: "abc", + Label: btcjson.String(""), + Rescan: btcjson.Bool(true), + }, + }, + { + name: "importprivkey optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importprivkey", "abc", "label") + }, + staticCmd: func() interface{} { + return btcjson.NewImportPrivKeyCmd("abc", btcjson.String("label"), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"importprivkey","params":["abc","label"],"id":1}`, + unmarshalled: &btcjson.ImportPrivKeyCmd{ + PrivKey: "abc", + Label: btcjson.String("label"), + Rescan: btcjson.Bool(true), + }, + }, + { + name: "importprivkey optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("importprivkey", "abc", "label", false) + }, + staticCmd: func() interface{} { + return btcjson.NewImportPrivKeyCmd("abc", btcjson.String("label"), btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"importprivkey","params":["abc","label",false],"id":1}`, + unmarshalled: &btcjson.ImportPrivKeyCmd{ + PrivKey: "abc", + Label: btcjson.String("label"), + Rescan: btcjson.Bool(false), + }, + }, + { + name: "keypoolrefill", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("keypoolrefill") + }, + staticCmd: func() interface{} { + return btcjson.NewKeyPoolRefillCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"keypoolrefill","params":[],"id":1}`, + unmarshalled: &btcjson.KeyPoolRefillCmd{ + NewSize: btcjson.Uint(100), + }, + }, + { + name: "keypoolrefill optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("keypoolrefill", 200) + }, + staticCmd: func() interface{} { + return btcjson.NewKeyPoolRefillCmd(btcjson.Uint(200)) + }, + marshalled: `{"jsonrpc":"1.0","method":"keypoolrefill","params":[200],"id":1}`, + unmarshalled: &btcjson.KeyPoolRefillCmd{ + NewSize: btcjson.Uint(200), + }, + }, + { + name: "listaccounts", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listaccounts") + }, + staticCmd: func() interface{} { + return btcjson.NewListAccountsCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listaccounts","params":[],"id":1}`, + unmarshalled: &btcjson.ListAccountsCmd{ + MinConf: btcjson.Int(1), + }, + }, + { + name: "listaccounts optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listaccounts", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewListAccountsCmd(btcjson.Int(6)) + }, + marshalled: `{"jsonrpc":"1.0","method":"listaccounts","params":[6],"id":1}`, + unmarshalled: &btcjson.ListAccountsCmd{ + MinConf: btcjson.Int(6), + }, + }, + { + name: "listaddressgroupings", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listaddressgroupings") + }, + staticCmd: func() interface{} { + return btcjson.NewListAddressGroupingsCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"listaddressgroupings","params":[],"id":1}`, + unmarshalled: &btcjson.ListAddressGroupingsCmd{}, + }, + { + name: "listlockunspent", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listlockunspent") + }, + staticCmd: func() interface{} { + return btcjson.NewListLockUnspentCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"listlockunspent","params":[],"id":1}`, + unmarshalled: &btcjson.ListLockUnspentCmd{}, + }, + { + name: "listreceivedbyaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaccount") + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAccountCmd(nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaccount","params":[],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAccountCmd{ + MinConf: btcjson.Int(1), + IncludeEmpty: btcjson.Bool(false), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaccount optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaccount", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAccountCmd(btcjson.Int(6), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaccount","params":[6],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAccountCmd{ + MinConf: btcjson.Int(6), + IncludeEmpty: btcjson.Bool(false), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaccount optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaccount", 6, true) + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAccountCmd(btcjson.Int(6), btcjson.Bool(true), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaccount","params":[6,true],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAccountCmd{ + MinConf: btcjson.Int(6), + IncludeEmpty: btcjson.Bool(true), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaccount optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaccount", 6, true, false) + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAccountCmd(btcjson.Int(6), btcjson.Bool(true), btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaccount","params":[6,true,false],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAccountCmd{ + MinConf: btcjson.Int(6), + IncludeEmpty: btcjson.Bool(true), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaddress") + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAddressCmd(nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaddress","params":[],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAddressCmd{ + MinConf: btcjson.Int(1), + IncludeEmpty: btcjson.Bool(false), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaddress optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaddress", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAddressCmd(btcjson.Int(6), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaddress","params":[6],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAddressCmd{ + MinConf: btcjson.Int(6), + IncludeEmpty: btcjson.Bool(false), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaddress optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaddress", 6, true) + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAddressCmd(btcjson.Int(6), btcjson.Bool(true), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaddress","params":[6,true],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAddressCmd{ + MinConf: btcjson.Int(6), + IncludeEmpty: btcjson.Bool(true), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listreceivedbyaddress optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listreceivedbyaddress", 6, true, false) + }, + staticCmd: func() interface{} { + return btcjson.NewListReceivedByAddressCmd(btcjson.Int(6), btcjson.Bool(true), btcjson.Bool(false)) + }, + marshalled: `{"jsonrpc":"1.0","method":"listreceivedbyaddress","params":[6,true,false],"id":1}`, + unmarshalled: &btcjson.ListReceivedByAddressCmd{ + MinConf: btcjson.Int(6), + IncludeEmpty: btcjson.Bool(true), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listsinceblock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listsinceblock") + }, + staticCmd: func() interface{} { + return btcjson.NewListSinceBlockCmd(nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listsinceblock","params":[],"id":1}`, + unmarshalled: &btcjson.ListSinceBlockCmd{ + BlockHash: nil, + TargetConfirmations: btcjson.Int(1), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listsinceblock optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listsinceblock", "123") + }, + staticCmd: func() interface{} { + return btcjson.NewListSinceBlockCmd(btcjson.String("123"), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listsinceblock","params":["123"],"id":1}`, + unmarshalled: &btcjson.ListSinceBlockCmd{ + BlockHash: btcjson.String("123"), + TargetConfirmations: btcjson.Int(1), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listsinceblock optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listsinceblock", "123", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewListSinceBlockCmd(btcjson.String("123"), btcjson.Int(6), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listsinceblock","params":["123",6],"id":1}`, + unmarshalled: &btcjson.ListSinceBlockCmd{ + BlockHash: btcjson.String("123"), + TargetConfirmations: btcjson.Int(6), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listsinceblock optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listsinceblock", "123", 6, true) + }, + staticCmd: func() interface{} { + return btcjson.NewListSinceBlockCmd(btcjson.String("123"), btcjson.Int(6), btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"listsinceblock","params":["123",6,true],"id":1}`, + unmarshalled: &btcjson.ListSinceBlockCmd{ + BlockHash: btcjson.String("123"), + TargetConfirmations: btcjson.Int(6), + IncludeWatchOnly: btcjson.Bool(true), + }, + }, + { + name: "listtransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listtransactions") + }, + staticCmd: func() interface{} { + return btcjson.NewListTransactionsCmd(nil, nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":[],"id":1}`, + unmarshalled: &btcjson.ListTransactionsCmd{ + Account: nil, + Count: btcjson.Int(10), + From: btcjson.Int(0), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listtransactions optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listtransactions", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewListTransactionsCmd(btcjson.String("acct"), nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":["acct"],"id":1}`, + unmarshalled: &btcjson.ListTransactionsCmd{ + Account: btcjson.String("acct"), + Count: btcjson.Int(10), + From: btcjson.Int(0), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listtransactions optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listtransactions", "acct", 20) + }, + staticCmd: func() interface{} { + return btcjson.NewListTransactionsCmd(btcjson.String("acct"), btcjson.Int(20), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":["acct",20],"id":1}`, + unmarshalled: &btcjson.ListTransactionsCmd{ + Account: btcjson.String("acct"), + Count: btcjson.Int(20), + From: btcjson.Int(0), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listtransactions optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listtransactions", "acct", 20, 1) + }, + staticCmd: func() interface{} { + return btcjson.NewListTransactionsCmd(btcjson.String("acct"), btcjson.Int(20), + btcjson.Int(1), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":["acct",20,1],"id":1}`, + unmarshalled: &btcjson.ListTransactionsCmd{ + Account: btcjson.String("acct"), + Count: btcjson.Int(20), + From: btcjson.Int(1), + IncludeWatchOnly: btcjson.Bool(false), + }, + }, + { + name: "listtransactions optional4", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listtransactions", "acct", 20, 1, true) + }, + staticCmd: func() interface{} { + return btcjson.NewListTransactionsCmd(btcjson.String("acct"), btcjson.Int(20), + btcjson.Int(1), btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"listtransactions","params":["acct",20,1,true],"id":1}`, + unmarshalled: &btcjson.ListTransactionsCmd{ + Account: btcjson.String("acct"), + Count: btcjson.Int(20), + From: btcjson.Int(1), + IncludeWatchOnly: btcjson.Bool(true), + }, + }, + { + name: "listunspent", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listunspent") + }, + staticCmd: func() interface{} { + return btcjson.NewListUnspentCmd(nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listunspent","params":[],"id":1}`, + unmarshalled: &btcjson.ListUnspentCmd{ + MinConf: btcjson.Int(1), + MaxConf: btcjson.Int(9999999), + Addresses: nil, + }, + }, + { + name: "listunspent optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listunspent", 6) + }, + staticCmd: func() interface{} { + return btcjson.NewListUnspentCmd(btcjson.Int(6), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listunspent","params":[6],"id":1}`, + unmarshalled: &btcjson.ListUnspentCmd{ + MinConf: btcjson.Int(6), + MaxConf: btcjson.Int(9999999), + Addresses: nil, + }, + }, + { + name: "listunspent optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listunspent", 6, 100) + }, + staticCmd: func() interface{} { + return btcjson.NewListUnspentCmd(btcjson.Int(6), btcjson.Int(100), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listunspent","params":[6,100],"id":1}`, + unmarshalled: &btcjson.ListUnspentCmd{ + MinConf: btcjson.Int(6), + MaxConf: btcjson.Int(100), + Addresses: nil, + }, + }, + { + name: "listunspent optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listunspent", 6, 100, []string{"1Address", "1Address2"}) + }, + staticCmd: func() interface{} { + return btcjson.NewListUnspentCmd(btcjson.Int(6), btcjson.Int(100), + &[]string{"1Address", "1Address2"}) + }, + marshalled: `{"jsonrpc":"1.0","method":"listunspent","params":[6,100,["1Address","1Address2"]],"id":1}`, + unmarshalled: &btcjson.ListUnspentCmd{ + MinConf: btcjson.Int(6), + MaxConf: btcjson.Int(100), + Addresses: &[]string{"1Address", "1Address2"}, + }, + }, + { + name: "lockunspent", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("lockunspent", true, `[{"txid":"123","vout":1}]`) + }, + staticCmd: func() interface{} { + txInputs := []btcjson.TransactionInput{ + {Txid: "123", Vout: 1}, + } + return btcjson.NewLockUnspentCmd(true, txInputs) + }, + marshalled: `{"jsonrpc":"1.0","method":"lockunspent","params":[true,[{"txid":"123","vout":1}]],"id":1}`, + unmarshalled: &btcjson.LockUnspentCmd{ + Unlock: true, + Transactions: []btcjson.TransactionInput{ + {Txid: "123", Vout: 1}, + }, + }, + }, + { + name: "move", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("move", "from", "to", 0.5) + }, + staticCmd: func() interface{} { + return btcjson.NewMoveCmd("from", "to", 0.5, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"move","params":["from","to",0.5],"id":1}`, + unmarshalled: &btcjson.MoveCmd{ + FromAccount: "from", + ToAccount: "to", + Amount: 0.5, + MinConf: btcjson.Int(1), + Comment: nil, + }, + }, + { + name: "move optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("move", "from", "to", 0.5, 6) + }, + staticCmd: func() interface{} { + return btcjson.NewMoveCmd("from", "to", 0.5, btcjson.Int(6), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"move","params":["from","to",0.5,6],"id":1}`, + unmarshalled: &btcjson.MoveCmd{ + FromAccount: "from", + ToAccount: "to", + Amount: 0.5, + MinConf: btcjson.Int(6), + Comment: nil, + }, + }, + { + name: "move optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("move", "from", "to", 0.5, 6, "comment") + }, + staticCmd: func() interface{} { + return btcjson.NewMoveCmd("from", "to", 0.5, btcjson.Int(6), btcjson.String("comment")) + }, + marshalled: `{"jsonrpc":"1.0","method":"move","params":["from","to",0.5,6,"comment"],"id":1}`, + unmarshalled: &btcjson.MoveCmd{ + FromAccount: "from", + ToAccount: "to", + Amount: 0.5, + MinConf: btcjson.Int(6), + Comment: btcjson.String("comment"), + }, + }, + { + name: "sendfrom", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5) + }, + staticCmd: func() interface{} { + return btcjson.NewSendFromCmd("from", "1Address", 0.5, nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5],"id":1}`, + unmarshalled: &btcjson.SendFromCmd{ + FromAccount: "from", + ToAddress: "1Address", + Amount: 0.5, + MinConf: btcjson.Int(1), + Comment: nil, + CommentTo: nil, + }, + }, + { + name: "sendfrom optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6) + }, + staticCmd: func() interface{} { + return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6],"id":1}`, + unmarshalled: &btcjson.SendFromCmd{ + FromAccount: "from", + ToAddress: "1Address", + Amount: 0.5, + MinConf: btcjson.Int(6), + Comment: nil, + CommentTo: nil, + }, + }, + { + name: "sendfrom optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "comment") + }, + staticCmd: func() interface{} { + return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), + btcjson.String("comment"), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"comment"],"id":1}`, + unmarshalled: &btcjson.SendFromCmd{ + FromAccount: "from", + ToAddress: "1Address", + Amount: 0.5, + MinConf: btcjson.Int(6), + Comment: btcjson.String("comment"), + CommentTo: nil, + }, + }, + { + name: "sendfrom optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendfrom", "from", "1Address", 0.5, 6, "comment", "commentto") + }, + staticCmd: func() interface{} { + return btcjson.NewSendFromCmd("from", "1Address", 0.5, btcjson.Int(6), + btcjson.String("comment"), btcjson.String("commentto")) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendfrom","params":["from","1Address",0.5,6,"comment","commentto"],"id":1}`, + unmarshalled: &btcjson.SendFromCmd{ + FromAccount: "from", + ToAddress: "1Address", + Amount: 0.5, + MinConf: btcjson.Int(6), + Comment: btcjson.String("comment"), + CommentTo: btcjson.String("commentto"), + }, + }, + { + name: "sendmany", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendmany", "from", `{"1Address":0.5}`) + }, + staticCmd: func() interface{} { + amounts := map[string]float64{"1Address": 0.5} + return btcjson.NewSendManyCmd("from", amounts, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5}],"id":1}`, + unmarshalled: &btcjson.SendManyCmd{ + FromAccount: "from", + Amounts: map[string]float64{"1Address": 0.5}, + MinConf: btcjson.Int(1), + Comment: nil, + }, + }, + { + name: "sendmany optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendmany", "from", `{"1Address":0.5}`, 6) + }, + staticCmd: func() interface{} { + amounts := map[string]float64{"1Address": 0.5} + return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6],"id":1}`, + unmarshalled: &btcjson.SendManyCmd{ + FromAccount: "from", + Amounts: map[string]float64{"1Address": 0.5}, + MinConf: btcjson.Int(6), + Comment: nil, + }, + }, + { + name: "sendmany optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendmany", "from", `{"1Address":0.5}`, 6, "comment") + }, + staticCmd: func() interface{} { + amounts := map[string]float64{"1Address": 0.5} + return btcjson.NewSendManyCmd("from", amounts, btcjson.Int(6), btcjson.String("comment")) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendmany","params":["from",{"1Address":0.5},6,"comment"],"id":1}`, + unmarshalled: &btcjson.SendManyCmd{ + FromAccount: "from", + Amounts: map[string]float64{"1Address": 0.5}, + MinConf: btcjson.Int(6), + Comment: btcjson.String("comment"), + }, + }, + { + name: "sendtoaddress", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendtoaddress", "1Address", 0.5) + }, + staticCmd: func() interface{} { + return btcjson.NewSendToAddressCmd("1Address", 0.5, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5],"id":1}`, + unmarshalled: &btcjson.SendToAddressCmd{ + Address: "1Address", + Amount: 0.5, + Comment: nil, + CommentTo: nil, + }, + }, + { + name: "sendtoaddress optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("sendtoaddress", "1Address", 0.5, "comment", "commentto") + }, + staticCmd: func() interface{} { + return btcjson.NewSendToAddressCmd("1Address", 0.5, btcjson.String("comment"), + btcjson.String("commentto")) + }, + marshalled: `{"jsonrpc":"1.0","method":"sendtoaddress","params":["1Address",0.5,"comment","commentto"],"id":1}`, + unmarshalled: &btcjson.SendToAddressCmd{ + Address: "1Address", + Amount: 0.5, + Comment: btcjson.String("comment"), + CommentTo: btcjson.String("commentto"), + }, + }, + { + name: "setaccount", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("setaccount", "1Address", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewSetAccountCmd("1Address", "acct") + }, + marshalled: `{"jsonrpc":"1.0","method":"setaccount","params":["1Address","acct"],"id":1}`, + unmarshalled: &btcjson.SetAccountCmd{ + Address: "1Address", + Account: "acct", + }, + }, + { + name: "settxfee", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("settxfee", 0.0001) + }, + staticCmd: func() interface{} { + return btcjson.NewSetTxFeeCmd(0.0001) + }, + marshalled: `{"jsonrpc":"1.0","method":"settxfee","params":[0.0001],"id":1}`, + unmarshalled: &btcjson.SetTxFeeCmd{ + Amount: 0.0001, + }, + }, + { + name: "signmessage", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("signmessage", "1Address", "message") + }, + staticCmd: func() interface{} { + return btcjson.NewSignMessageCmd("1Address", "message") + }, + marshalled: `{"jsonrpc":"1.0","method":"signmessage","params":["1Address","message"],"id":1}`, + unmarshalled: &btcjson.SignMessageCmd{ + Address: "1Address", + Message: "message", + }, + }, + { + name: "signrawtransaction", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("signrawtransaction", "001122") + }, + staticCmd: func() interface{} { + return btcjson.NewSignRawTransactionCmd("001122", nil, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"signrawtransaction","params":["001122"],"id":1}`, + unmarshalled: &btcjson.SignRawTransactionCmd{ + RawTx: "001122", + Inputs: nil, + PrivKeys: nil, + Flags: btcjson.String("ALL"), + }, + }, + { + name: "signrawtransaction optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("signrawtransaction", "001122", `[{"txid":"123","vout":1,"scriptPubKey":"00","redeemScript":"01"}]`) + }, + staticCmd: func() interface{} { + txInputs := []btcjson.RawTxInput{ + { + Txid: "123", + Vout: 1, + ScriptPubKey: "00", + RedeemScript: "01", + }, + } + + return btcjson.NewSignRawTransactionCmd("001122", &txInputs, nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"signrawtransaction","params":["001122",[{"txid":"123","vout":1,"scriptPubKey":"00","redeemScript":"01"}]],"id":1}`, + unmarshalled: &btcjson.SignRawTransactionCmd{ + RawTx: "001122", + Inputs: &[]btcjson.RawTxInput{ + { + Txid: "123", + Vout: 1, + ScriptPubKey: "00", + RedeemScript: "01", + }, + }, + PrivKeys: nil, + Flags: btcjson.String("ALL"), + }, + }, + { + name: "signrawtransaction optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("signrawtransaction", "001122", `[]`, `["abc"]`) + }, + staticCmd: func() interface{} { + txInputs := []btcjson.RawTxInput{} + privKeys := []string{"abc"} + return btcjson.NewSignRawTransactionCmd("001122", &txInputs, &privKeys, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"signrawtransaction","params":["001122",[],["abc"]],"id":1}`, + unmarshalled: &btcjson.SignRawTransactionCmd{ + RawTx: "001122", + Inputs: &[]btcjson.RawTxInput{}, + PrivKeys: &[]string{"abc"}, + Flags: btcjson.String("ALL"), + }, + }, + { + name: "signrawtransaction optional3", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("signrawtransaction", "001122", `[]`, `[]`, "ALL") + }, + staticCmd: func() interface{} { + txInputs := []btcjson.RawTxInput{} + privKeys := []string{} + return btcjson.NewSignRawTransactionCmd("001122", &txInputs, &privKeys, + btcjson.String("ALL")) + }, + marshalled: `{"jsonrpc":"1.0","method":"signrawtransaction","params":["001122",[],[],"ALL"],"id":1}`, + unmarshalled: &btcjson.SignRawTransactionCmd{ + RawTx: "001122", + Inputs: &[]btcjson.RawTxInput{}, + PrivKeys: &[]string{}, + Flags: btcjson.String("ALL"), + }, + }, + { + name: "walletlock", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("walletlock") + }, + staticCmd: func() interface{} { + return btcjson.NewWalletLockCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"walletlock","params":[],"id":1}`, + unmarshalled: &btcjson.WalletLockCmd{}, + }, + { + name: "walletpassphrase", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("walletpassphrase", "pass", 60) + }, + staticCmd: func() interface{} { + return btcjson.NewWalletPassphraseCmd("pass", 60) + }, + marshalled: `{"jsonrpc":"1.0","method":"walletpassphrase","params":["pass",60],"id":1}`, + unmarshalled: &btcjson.WalletPassphraseCmd{ + Passphrase: "pass", + Timeout: 60, + }, + }, + { + name: "walletpassphrasechange", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("walletpassphrasechange", "old", "new") + }, + staticCmd: func() interface{} { + return btcjson.NewWalletPassphraseChangeCmd("old", "new") + }, + marshalled: `{"jsonrpc":"1.0","method":"walletpassphrasechange","params":["old","new"],"id":1}`, + unmarshalled: &btcjson.WalletPassphraseChangeCmd{ + OldPassphrase: "old", + NewPassphrase: "new", + }, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the command as created by the new static command + // creation function. + marshalled, err := btcjson.MarshalCmd(testID, test.staticCmd()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the command is created without error via the generic + // new command creation function. + cmd, err := test.newCmd() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the command as created by the generic new command + // creation function. + marshalled, err = btcjson.MarshalCmd(testID, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} diff --git a/v2/btcjson/walletsvrresults.go b/v2/btcjson/walletsvrresults.go new file mode 100644 index 00000000..0025ccae --- /dev/null +++ b/v2/btcjson/walletsvrresults.go @@ -0,0 +1,138 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +// GetTransactionDetailsResult models the details data from the gettransaction command. +type GetTransactionDetailsResult struct { + Account string `json:"account"` + Address string `json:"address,omitempty"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee,omitempty"` +} + +// GetTransactionResult models the data from the gettransaction command. +type GetTransactionResult struct { + Amount float64 `json:"amount"` + Fee float64 `json:"fee,omitempty"` + Confirmations int64 `json:"confirmations"` + BlockHash string `json:"blockhash"` + BlockIndex int64 `json:"blockindex"` + BlockTime int64 `json:"blocktime"` + TxID string `json:"txid"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Details []GetTransactionDetailsResult `json:"details"` + Hex string `json:"hex"` +} + +// InfoWalletResult models the data returned by the wallet server getinfo +// command. +type InfoWalletResult struct { + Version int32 `json:"version"` + ProtocolVersion int32 `json:"protocolversion"` + WalletVersion int32 `json:"walletversion"` + Balance float64 `json:"balance"` + Blocks int32 `json:"blocks"` + TimeOffset int64 `json:"timeoffset"` + Connections int32 `json:"connections"` + Proxy string `json:"proxy"` + Difficulty float64 `json:"difficulty"` + TestNet bool `json:"testnet"` + KeypoolOldest int64 `json:"keypoololdest"` + KeypoolSize int32 `json:"keypoolsize"` + UnlockedUntil int64 `json:"unlocked_until"` + PaytxFee float64 `json:"paytxfee"` + RelayFee float64 `json:"relayfee"` + Errors string `json:"errors"` +} + +// ListTransactionsResult models the data from the listtransactions command. +type ListTransactionsResult struct { + Account string `json:"account"` + Address string `json:"address,omitempty"` + Category string `json:"category"` + Amount float64 `json:"amount"` + Fee float64 `json:"fee"` + Confirmations int64 `json:"confirmations"` + Generated bool `json:"generated,omitempty"` + BlockHash string `json:"blockhash,omitempty"` + BlockIndex int64 `json:"blockindex,omitempty"` + BlockTime int64 `json:"blocktime,omitempty"` + TxID string `json:"txid"` + WalletConflicts []string `json:"walletconflicts"` + Time int64 `json:"time"` + TimeReceived int64 `json:"timereceived"` + Comment string `json:"comment,omitempty"` + OtherAccount string `json:"otheraccount"` +} + +// ListReceivedByAccountResult models the data from the listreceivedbyaccount +// command. +type ListReceivedByAccountResult struct { + Account string `json:"account"` + Amount float64 `json:"amount"` + Confirmations uint64 `json:"confirmations"` +} + +// ListReceivedByAddressResult models the data from the listreceivedbyaddress +// command. +type ListReceivedByAddressResult struct { + Account string `json:"account"` + Address string `json:"address"` + Amount float64 `json:"amount"` + Confirmations uint64 `json:"confirmations"` + TxIDs []string `json:"txids,omitempty"` + InvolvesWatchonly bool `json:"involvesWatchonly,omitempty"` +} + +// ListSinceBlockResult models the data from the listsinceblock command. +type ListSinceBlockResult struct { + Transactions []ListTransactionsResult `json:"transactions"` + LastBlock string `json:"lastblock"` +} + +// ListUnspentResult models a successful response from the listunspent request. +type ListUnspentResult struct { + TxID string `json:"txid"` + Vout uint32 `json:"vout"` + Address string `json:"address"` + Account string `json:"account"` + ScriptPubKey string `json:"scriptPubKey"` + RedeemScript string `json:"redeemScript,omitempty"` + Amount float64 `json:"amount"` + Confirmations int64 `json:"confirmations"` +} + +// SignRawTransactionResult models the data from the signrawtransaction +// command. +type SignRawTransactionResult struct { + Hex string `json:"hex"` + Complete bool `json:"complete"` +} + +// ValidateAddressWalletResult models the data returned by the wallet server +// validateaddress command. +type ValidateAddressWalletResult struct { + IsValid bool `json:"isvalid"` + Address string `json:"address,omitempty"` + IsMine bool `json:"ismine,omitempty"` + IsWatchOnly bool `json:"iswatchonly,omitempty"` + IsScript bool `json:"isscript,omitempty"` + PubKey string `json:"pubkey,omitempty"` + IsCompressed bool `json:"iscompressed,omitempty"` + Account string `json:"account,omitempty"` + Addresses []string `json:"addresses,omitempty"` + Hex string `json:"hex,omitempty"` + Script string `json:"script,omitempty"` + SigsRequired int32 `json:"sigsrequired,omitempty"` +} + +// GetBestBlockResult models the data from the getbestblock command. +type GetBestBlockResult struct { + Hash string `json:"hash"` + Height int32 `json:"height"` +} diff --git a/v2/btcjson/walletsvrwscmds.go b/v2/btcjson/walletsvrwscmds.go new file mode 100644 index 00000000..ea7dd850 --- /dev/null +++ b/v2/btcjson/walletsvrwscmds.go @@ -0,0 +1,128 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson + +// NOTE: This file is intended to house the RPC commands that are supported by +// a wallet server, but are only available via websockets. + +// CreateEncryptedWalletCmd defines the createencryptedwallet JSON-RPC command. +type CreateEncryptedWalletCmd struct { + Passphrase string +} + +// NewCreateEncryptedWalletCmd returns a new instance which can be used to issue +// a createencryptedwallet JSON-RPC command. +func NewCreateEncryptedWalletCmd(passphrase string) *CreateEncryptedWalletCmd { + return &CreateEncryptedWalletCmd{ + Passphrase: passphrase, + } +} + +// ExportWatchingWalletCmd defines the exportwatchingwallet JSON-RPC command. +type ExportWatchingWalletCmd struct { + Account *string `jsonrpcdefault:"\"\""` + Download *bool `jsonrpcdefault:"false"` +} + +// NewExportWatchingWalletCmd returns a new instance which can be used to issue +// a exportwatchingwallet JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewExportWatchingWalletCmd(account *string, download *bool) *ExportWatchingWalletCmd { + return &ExportWatchingWalletCmd{ + Account: account, + Download: download, + } +} + +// GetUnconfirmedBalanceCmd defines the getunconfirmedbalance JSON-RPC command. +type GetUnconfirmedBalanceCmd struct { + Account *string `jsonrpcdefault:"\"\""` +} + +// NewGetUnconfirmedBalanceCmd returns a new instance which can be used to issue +// a getunconfirmedbalance JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewGetUnconfirmedBalanceCmd(account *string) *GetUnconfirmedBalanceCmd { + return &GetUnconfirmedBalanceCmd{ + Account: account, + } +} + +// ListAddressTransactionsCmd defines the listaddresstransactions JSON-RPC +// command. +type ListAddressTransactionsCmd struct { + Addresses []string + Account *string `jsonrpcdefault:"\"\""` +} + +// NewListAddressTransactionsCmd returns a new instance which can be used to +// issue a listaddresstransactions JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListAddressTransactionsCmd(addresses []string, account *string) *ListAddressTransactionsCmd { + return &ListAddressTransactionsCmd{ + Addresses: addresses, + Account: account, + } +} + +// ListAllTransactionsCmd defines the listalltransactions JSON-RPC command. +type ListAllTransactionsCmd struct { + Account *string `jsonrpcdefault:"\"\""` +} + +// NewListAllTransactionsCmd returns a new instance which can be used to issue a +// listalltransactions JSON-RPC command. +// +// The parameters which are pointers indicate they are optional. Passing nil +// for optional parameters will use the default value. +func NewListAllTransactionsCmd(account *string) *ListAllTransactionsCmd { + return &ListAllTransactionsCmd{ + Account: account, + } +} + +// RecoverAddressesCmd defines the recoveraddresses JSON-RPC command. +type RecoverAddressesCmd struct { + Account string + N int +} + +// NewRecoverAddressesCmd returns a new instance which can be used to issue a +// recoveraddresses JSON-RPC command. +func NewRecoverAddressesCmd(account string, n int) *RecoverAddressesCmd { + return &RecoverAddressesCmd{ + Account: account, + N: n, + } +} + +// WalletIsLockedCmd defines the walletislocked JSON-RPC command. +type WalletIsLockedCmd struct{} + +// NewWalletIsLockedCmd returns a new instance which can be used to issue a +// walletislocked JSON-RPC command. +func NewWalletIsLockedCmd() *WalletIsLockedCmd { + return &WalletIsLockedCmd{} +} + +func init() { + // The commands in this file are only usable with a wallet server via + // websockets. + flags := UFWalletOnly | UFWebsocketOnly + + MustRegisterCmd("createencryptedwallet", (*CreateEncryptedWalletCmd)(nil), flags) + MustRegisterCmd("exportwatchingwallet", (*ExportWatchingWalletCmd)(nil), flags) + MustRegisterCmd("getunconfirmedbalance", (*GetUnconfirmedBalanceCmd)(nil), flags) + MustRegisterCmd("listaddresstransactions", (*ListAddressTransactionsCmd)(nil), flags) + MustRegisterCmd("listalltransactions", (*ListAllTransactionsCmd)(nil), flags) + MustRegisterCmd("recoveraddresses", (*RecoverAddressesCmd)(nil), flags) + MustRegisterCmd("walletislocked", (*WalletIsLockedCmd)(nil), flags) +} diff --git a/v2/btcjson/walletsvrwscmds_test.go b/v2/btcjson/walletsvrwscmds_test.go new file mode 100644 index 00000000..ff06b945 --- /dev/null +++ b/v2/btcjson/walletsvrwscmds_test.go @@ -0,0 +1,259 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestWalletSvrWsCmds tests all of the wallet server websocket-specific +// commands marshal and unmarshal into valid results include handling of +// optional fields being omitted in the marshalled command, while optional +// fields with defaults have the default assigned on unmarshalled commands. +func TestWalletSvrWsCmds(t *testing.T) { + t.Parallel() + + testID := int(1) + tests := []struct { + name string + newCmd func() (interface{}, error) + staticCmd func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "createencryptedwallet", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("createencryptedwallet", "pass") + }, + staticCmd: func() interface{} { + return btcjson.NewCreateEncryptedWalletCmd("pass") + }, + marshalled: `{"jsonrpc":"1.0","method":"createencryptedwallet","params":["pass"],"id":1}`, + unmarshalled: &btcjson.CreateEncryptedWalletCmd{Passphrase: "pass"}, + }, + { + name: "exportwatchingwallet", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("exportwatchingwallet") + }, + staticCmd: func() interface{} { + return btcjson.NewExportWatchingWalletCmd(nil, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"exportwatchingwallet","params":[],"id":1}`, + unmarshalled: &btcjson.ExportWatchingWalletCmd{ + Account: btcjson.String(""), + Download: btcjson.Bool(false), + }, + }, + { + name: "exportwatchingwallet optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("exportwatchingwallet", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewExportWatchingWalletCmd(btcjson.String("acct"), nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"exportwatchingwallet","params":["acct"],"id":1}`, + unmarshalled: &btcjson.ExportWatchingWalletCmd{ + Account: btcjson.String("acct"), + Download: btcjson.Bool(false), + }, + }, + { + name: "exportwatchingwallet optional2", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("exportwatchingwallet", "acct", true) + }, + staticCmd: func() interface{} { + return btcjson.NewExportWatchingWalletCmd(btcjson.String("acct"), + btcjson.Bool(true)) + }, + marshalled: `{"jsonrpc":"1.0","method":"exportwatchingwallet","params":["acct",true],"id":1}`, + unmarshalled: &btcjson.ExportWatchingWalletCmd{ + Account: btcjson.String("acct"), + Download: btcjson.Bool(true), + }, + }, + { + name: "getunconfirmedbalance", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getunconfirmedbalance") + }, + staticCmd: func() interface{} { + return btcjson.NewGetUnconfirmedBalanceCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"getunconfirmedbalance","params":[],"id":1}`, + unmarshalled: &btcjson.GetUnconfirmedBalanceCmd{ + Account: btcjson.String(""), + }, + }, + { + name: "getunconfirmedbalance optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("getunconfirmedbalance", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewGetUnconfirmedBalanceCmd(btcjson.String("acct")) + }, + marshalled: `{"jsonrpc":"1.0","method":"getunconfirmedbalance","params":["acct"],"id":1}`, + unmarshalled: &btcjson.GetUnconfirmedBalanceCmd{ + Account: btcjson.String("acct"), + }, + }, + { + name: "listaddresstransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listaddresstransactions", `["1Address"]`) + }, + staticCmd: func() interface{} { + return btcjson.NewListAddressTransactionsCmd([]string{"1Address"}, nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listaddresstransactions","params":[["1Address"]],"id":1}`, + unmarshalled: &btcjson.ListAddressTransactionsCmd{ + Addresses: []string{"1Address"}, + Account: btcjson.String(""), + }, + }, + { + name: "listaddresstransactions optional1", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listaddresstransactions", `["1Address"]`, "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewListAddressTransactionsCmd([]string{"1Address"}, + btcjson.String("acct")) + }, + marshalled: `{"jsonrpc":"1.0","method":"listaddresstransactions","params":[["1Address"],"acct"],"id":1}`, + unmarshalled: &btcjson.ListAddressTransactionsCmd{ + Addresses: []string{"1Address"}, + Account: btcjson.String("acct"), + }, + }, + { + name: "listalltransactions", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listalltransactions") + }, + staticCmd: func() interface{} { + return btcjson.NewListAllTransactionsCmd(nil) + }, + marshalled: `{"jsonrpc":"1.0","method":"listalltransactions","params":[],"id":1}`, + unmarshalled: &btcjson.ListAllTransactionsCmd{ + Account: btcjson.String(""), + }, + }, + { + name: "listalltransactions optional", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("listalltransactions", "acct") + }, + staticCmd: func() interface{} { + return btcjson.NewListAllTransactionsCmd(btcjson.String("acct")) + }, + marshalled: `{"jsonrpc":"1.0","method":"listalltransactions","params":["acct"],"id":1}`, + unmarshalled: &btcjson.ListAllTransactionsCmd{ + Account: btcjson.String("acct"), + }, + }, + { + name: "recoveraddresses", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("recoveraddresses", "acct", 10) + }, + staticCmd: func() interface{} { + return btcjson.NewRecoverAddressesCmd("acct", 10) + }, + marshalled: `{"jsonrpc":"1.0","method":"recoveraddresses","params":["acct",10],"id":1}`, + unmarshalled: &btcjson.RecoverAddressesCmd{ + Account: "acct", + N: 10, + }, + }, + { + name: "walletislocked", + newCmd: func() (interface{}, error) { + return btcjson.NewCmd("walletislocked") + }, + staticCmd: func() interface{} { + return btcjson.NewWalletIsLockedCmd() + }, + marshalled: `{"jsonrpc":"1.0","method":"walletislocked","params":[],"id":1}`, + unmarshalled: &btcjson.WalletIsLockedCmd{}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the command as created by the new static command + // creation function. + marshalled, err := btcjson.MarshalCmd(testID, test.staticCmd()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the command is created without error via the generic + // new command creation function. + cmd, err := test.newCmd() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the command as created by the generic new command + // creation function. + marshalled, err = btcjson.MarshalCmd(testID, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} diff --git a/v2/btcjson/walletsvrwsntfns.go b/v2/btcjson/walletsvrwsntfns.go new file mode 100644 index 00000000..fc58070b --- /dev/null +++ b/v2/btcjson/walletsvrwsntfns.go @@ -0,0 +1,95 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +// NOTE: This file is intended to house the RPC websocket notifications that are +// supported by a wallet server. + +package btcjson + +const ( + // AccountBalanceNtfnMethod is the method used for account balance + // notifications. + AccountBalanceNtfnMethod = "accountbalance" + + // BtcdConnectedNtfnMethod is the method used for notifications when + // a wallet server is connected to a chain server. + BtcdConnectedNtfnMethod = "btcdconnected" + + // WalletLockStateNtfnMethod is the method used to notify the lock state + // of a wallet has changed. + WalletLockStateNtfnMethod = "walletlockstate" + + // NewTxNtfnMethod is the method used to notify that a wallet server has + // added a new transaction to the transaciton store. + NewTxNtfnMethod = "newtx" +) + +// AccountBalanceNtfn defines the accountbalance JSON-RPC notification. +type AccountBalanceNtfn struct { + Account string + Balance float64 // In BTC + Confirmed bool // Whether Balance is confirmed or unconfirmed. +} + +// NewAccountBalanceNtfn returns a new instance which can be used to issue an +// accountbalance JSON-RPC notification. +func NewAccountBalanceNtfn(account string, balance float64, confirmed bool) *AccountBalanceNtfn { + return &AccountBalanceNtfn{ + Account: account, + Balance: balance, + Confirmed: confirmed, + } +} + +// BtcdConnectedNtfn defines the btcdconnected JSON-RPC notification. +type BtcdConnectedNtfn struct { + Connected bool +} + +// NewBtcdConnectedNtfn returns a new instance which can be used to issue a +// btcdconnected JSON-RPC notification. +func NewBtcdConnectedNtfn(connected bool) *BtcdConnectedNtfn { + return &BtcdConnectedNtfn{ + Connected: connected, + } +} + +// WalletLockStateNtfn defines the walletlockstate JSON-RPC notification. +type WalletLockStateNtfn struct { + Locked bool +} + +// NewWalletLockStateNtfn returns a new instance which can be used to issue a +// walletlockstate JSON-RPC notification. +func NewWalletLockStateNtfn(locked bool) *WalletLockStateNtfn { + return &WalletLockStateNtfn{ + Locked: locked, + } +} + +// NewTxNtfn defines the newtx JSON-RPC notification. +type NewTxNtfn struct { + Account string + Details ListTransactionsResult +} + +// NewNewTxNtfn returns a new instance which can be used to issue a newtx +// JSON-RPC notification. +func NewNewTxNtfn(account string, details ListTransactionsResult) *NewTxNtfn { + return &NewTxNtfn{ + Account: account, + Details: details, + } +} + +func init() { + // The commands in this file are only usable with a wallet server via + // websockets and are notifications. + flags := UFWalletOnly | UFWebsocketOnly | UFNotification + + MustRegisterCmd(AccountBalanceNtfnMethod, (*AccountBalanceNtfn)(nil), flags) + MustRegisterCmd(BtcdConnectedNtfnMethod, (*BtcdConnectedNtfn)(nil), flags) + MustRegisterCmd(WalletLockStateNtfnMethod, (*WalletLockStateNtfn)(nil), flags) + MustRegisterCmd(NewTxNtfnMethod, (*NewTxNtfn)(nil), flags) +} diff --git a/v2/btcjson/walletsvrwsntfns_test.go b/v2/btcjson/walletsvrwsntfns_test.go new file mode 100644 index 00000000..57b717d1 --- /dev/null +++ b/v2/btcjson/walletsvrwsntfns_test.go @@ -0,0 +1,179 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestWalletSvrWsNtfns tests all of the chain server websocket-specific +// notifications marshal and unmarshal into valid results include handling of +// optional fields being omitted in the marshalled command, while optional +// fields with defaults have the default assigned on unmarshalled commands. +func TestWalletSvrWsNtfns(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + newNtfn func() (interface{}, error) + staticNtfn func() interface{} + marshalled string + unmarshalled interface{} + }{ + { + name: "accountbalance", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("accountbalance", "acct", 1.25, true) + }, + staticNtfn: func() interface{} { + return btcjson.NewAccountBalanceNtfn("acct", 1.25, true) + }, + marshalled: `{"jsonrpc":"1.0","method":"accountbalance","params":["acct",1.25,true],"id":null}`, + unmarshalled: &btcjson.AccountBalanceNtfn{ + Account: "acct", + Balance: 1.25, + Confirmed: true, + }, + }, + { + name: "btcdconnected", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("btcdconnected", true) + }, + staticNtfn: func() interface{} { + return btcjson.NewBtcdConnectedNtfn(true) + }, + marshalled: `{"jsonrpc":"1.0","method":"btcdconnected","params":[true],"id":null}`, + unmarshalled: &btcjson.BtcdConnectedNtfn{ + Connected: true, + }, + }, + { + name: "walletlockstate", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("walletlockstate", true) + }, + staticNtfn: func() interface{} { + return btcjson.NewWalletLockStateNtfn(true) + }, + marshalled: `{"jsonrpc":"1.0","method":"walletlockstate","params":[true],"id":null}`, + unmarshalled: &btcjson.WalletLockStateNtfn{ + Locked: true, + }, + }, + { + name: "newtx", + newNtfn: func() (interface{}, error) { + return btcjson.NewCmd("newtx", "acct", `{"account":"acct","address":"1Address","category":"send","amount":1.5,"fee":0.0001,"confirmations":1,"txid":"456","walletconflicts":[],"time":12345678,"timereceived":12345876,"otheraccount":"otheracct"}`) + }, + staticNtfn: func() interface{} { + result := btcjson.ListTransactionsResult{ + Account: "acct", + Address: "1Address", + Category: "send", + Amount: 1.5, + Fee: 0.0001, + Confirmations: 1, + TxID: "456", + WalletConflicts: []string{}, + Time: 12345678, + TimeReceived: 12345876, + OtherAccount: "otheracct", + } + return btcjson.NewNewTxNtfn("acct", result) + }, + marshalled: `{"jsonrpc":"1.0","method":"newtx","params":["acct",{"account":"acct","address":"1Address","category":"send","amount":1.5,"fee":0.0001,"confirmations":1,"txid":"456","walletconflicts":[],"time":12345678,"timereceived":12345876,"otheraccount":"otheracct"}],"id":null}`, + unmarshalled: &btcjson.NewTxNtfn{ + Account: "acct", + Details: btcjson.ListTransactionsResult{ + Account: "acct", + Address: "1Address", + Category: "send", + Amount: 1.5, + Fee: 0.0001, + Confirmations: 1, + TxID: "456", + WalletConflicts: []string{}, + Time: 12345678, + TimeReceived: 12345876, + OtherAccount: "otheracct", + }, + }, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Marshal the notification as created by the new static + // creation function. The ID is nil for notifications. + marshalled, err := btcjson.MarshalCmd(nil, test.staticNtfn()) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + // Ensure the notification is created without error via the + // generic new notification creation function. + cmd, err := test.newNtfn() + if err != nil { + t.Errorf("Test #%d (%s) unexpected NewCmd error: %v ", + i, test.name, err) + } + + // Marshal the notification as created by the generic new + // notification creation function. The ID is nil for + // notifications. + marshalled, err = btcjson.MarshalCmd(nil, cmd) + if err != nil { + t.Errorf("MarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !bytes.Equal(marshalled, []byte(test.marshalled)) { + t.Errorf("Test #%d (%s) unexpected marshalled data - "+ + "got %s, want %s", i, test.name, marshalled, + test.marshalled) + continue + } + + var request btcjson.Request + if err := json.Unmarshal(marshalled, &request); err != nil { + t.Errorf("Test #%d (%s) unexpected error while "+ + "unmarshalling JSON-RPC request: %v", i, + test.name, err) + continue + } + + cmd, err = btcjson.UnmarshalCmd(&request) + if err != nil { + t.Errorf("UnmarshalCmd #%d (%s) unexpected error: %v", i, + test.name, err) + continue + } + + if !reflect.DeepEqual(cmd, test.unmarshalled) { + t.Errorf("Test #%d (%s) unexpected unmarshalled command "+ + "- got %s, want %s", i, test.name, + fmt.Sprintf("(%T) %+[1]v", cmd), + fmt.Sprintf("(%T) %+[1]v\n", test.unmarshalled)) + continue + } + } +} From f4fc117b666fb6f4493351daf589d770858c8265 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 1 Jan 2015 11:26:41 -0600 Subject: [PATCH 226/229] Update TravisCI to goclean script. - Also update to use the new container-based builds - Add coveralls.io support - Update build badge to use SVG - Add badges for coverage, license, and godoc - For now, set it to change to he v2 directory - This will need to be changed once the v1 code is replaced --- .travis.yml | 14 ++++++++------ README.md | 8 +++++++- goclean.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) create mode 100755 goclean.sh diff --git a/.travis.yml b/.travis.yml index c0233368..f57343e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,14 +5,16 @@ go: sudo: false before_install: - gotools=golang.org/x/tools - - if [ "$TRAVIS_GO_VERSION" = "release" ] || [ "$TRAVIS_GO_VERSION" = "go1.3.3" ]; then gotools=code.google.com/p/go.tools; fi + - if [ "$TRAVIS_GO_VERSION" = "release" ]; then gotools=code.google.com/p/go.tools; fi install: - go get -d -t -v ./... - - go get $gotools/cmd/vet - - go get -v github.com/GeertJohan/fgt + - go get -v $gotools/cmd/cover + - go get -v $gotools/cmd/vet + - go get -v github.com/bradfitz/goimports - go get -v github.com/golang/lint/golint + - go get -v github.com/mattn/goveralls script: - export PATH=$PATH:$HOME/gopath/bin - - go vet - - fgt golint -min_confidence=0.9 . - - go test -v + - ./goclean.sh +after_success: + - goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/README.md b/README.md index 18bd230c..0b0b8085 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,10 @@ btcjson ======= [![Build Status](https://travis-ci.org/btcsuite/btcjson.png?branch=master)] -(https://travis-ci.org/btcsuite/btcjson) +(https://travis-ci.org/btcsuite/btcjson) [![Coverage Status] +(https://img.shields.io/coveralls/btcsuite/btcjson.svg)] +(https://coveralls.io/r/btcsuite/btcjson?branch=master) [![ISC License] +(http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) Package btcjson implements concrete types for marshalling to and from the bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure @@ -62,6 +65,9 @@ server, and to handle the replies (putting them in useful Go data structures). ## Documentation +[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)] +(http://godoc.org/github.com/btcsuite/btcjson) + Full `go doc` style documentation for the project can be viewed online without installing this package by using the GoDoc site [here](http://godoc.org/github.com/btcsuite/btcjson). diff --git a/goclean.sh b/goclean.sh new file mode 100755 index 00000000..f0512e77 --- /dev/null +++ b/goclean.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# The script does automatic checking on a Go package and its sub-packages, including: +# 1. gofmt (http://golang.org/cmd/gofmt/) +# 2. goimports (https://github.com/bradfitz/goimports) +# 3. golint (https://github.com/golang/lint) +# 4. go vet (http://golang.org/cmd/vet) +# 5. race detector (http://blog.golang.org/race-detector) +# 6. test coverage (http://blog.golang.org/cover) + +set -e + +# Automatic checks +cd v2/btcjson +test -z "$(gofmt -l -w . | tee /dev/stderr)" +test -z "$(goimports -l -w . | tee /dev/stderr)" +test -z "$(golint . | tee /dev/stderr)" +go vet ./... +go test -race ./... + +# Run test coverage on each subdirectories and merge the coverage profile. + +echo "mode: count" > profile.cov + +# Standard go tooling behavior is to ignore dirs with leading underscors +for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); +do +if ls $dir/*.go &> /dev/null; then + go test -covermode=count -coverprofile=$dir/profile.tmp $dir + if [ -f $dir/profile.tmp ]; then + cat $dir/profile.tmp | tail -n +2 >> profile.cov + rm $dir/profile.tmp + fi +fi +done + +go tool cover -func profile.cov + +# To submit the test coverage result to coveralls.io, +# use goveralls (https://github.com/mattn/goveralls) +# goveralls -coverprofile=profile.cov -service=travis-ci From f61b8c808d233c7aa9bfbdbbadbb1bef4cb4a25b Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 19 Feb 2015 10:45:09 -0600 Subject: [PATCH 227/229] Add missing file for help generate tests. --- v2/btcjson/help_test.go | 737 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 737 insertions(+) create mode 100644 v2/btcjson/help_test.go diff --git a/v2/btcjson/help_test.go b/v2/btcjson/help_test.go new file mode 100644 index 00000000..505fb050 --- /dev/null +++ b/v2/btcjson/help_test.go @@ -0,0 +1,737 @@ +// Copyright (c) 2014 Conformal Systems LLC. +// Use of this source code is governed by an ISC +// license that can be found in the LICENSE file. + +package btcjson_test + +import ( + "reflect" + "testing" + + "github.com/btcsuite/btcjson/v2/btcjson" +) + +// TestHelpReflectInternals ensures the various help functions which deal with +// reflect types work as expected for various Go types. +func TestHelpReflectInternals(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + reflectType reflect.Type + indentLevel int + key string + examples []string + isComplex bool + help string + isInvalid bool + }{ + { + name: "int", + reflectType: reflect.TypeOf(int(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "*int", + reflectType: reflect.TypeOf((*int)(nil)), + key: "json-type-value", + examples: []string{"n"}, + help: "n (json-type-value) fdk", + isInvalid: true, + }, + { + name: "int8", + reflectType: reflect.TypeOf(int8(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "int16", + reflectType: reflect.TypeOf(int16(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "int32", + reflectType: reflect.TypeOf(int32(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "int64", + reflectType: reflect.TypeOf(int64(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "uint", + reflectType: reflect.TypeOf(uint(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "uint8", + reflectType: reflect.TypeOf(uint8(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "uint16", + reflectType: reflect.TypeOf(uint16(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "uint32", + reflectType: reflect.TypeOf(uint32(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "uint64", + reflectType: reflect.TypeOf(uint64(0)), + key: "json-type-numeric", + examples: []string{"n"}, + help: "n (json-type-numeric) fdk", + }, + { + name: "float32", + reflectType: reflect.TypeOf(float32(0)), + key: "json-type-numeric", + examples: []string{"n.nnn"}, + help: "n.nnn (json-type-numeric) fdk", + }, + { + name: "float64", + reflectType: reflect.TypeOf(float64(0)), + key: "json-type-numeric", + examples: []string{"n.nnn"}, + help: "n.nnn (json-type-numeric) fdk", + }, + { + name: "string", + reflectType: reflect.TypeOf(""), + key: "json-type-string", + examples: []string{`"json-example-string"`}, + help: "\"json-example-string\" (json-type-string) fdk", + }, + { + name: "bool", + reflectType: reflect.TypeOf(true), + key: "json-type-bool", + examples: []string{"json-example-bool"}, + help: "json-example-bool (json-type-bool) fdk", + }, + { + name: "array of int", + reflectType: reflect.TypeOf([1]int{0}), + key: "json-type-arrayjson-type-numeric", + examples: []string{"[n,...]"}, + help: "[n,...] (json-type-arrayjson-type-numeric) fdk", + }, + { + name: "slice of int", + reflectType: reflect.TypeOf([]int{0}), + key: "json-type-arrayjson-type-numeric", + examples: []string{"[n,...]"}, + help: "[n,...] (json-type-arrayjson-type-numeric) fdk", + }, + { + name: "struct", + reflectType: reflect.TypeOf(struct{}{}), + key: "json-type-object", + examples: []string{"{", "}\t\t"}, + isComplex: true, + help: "{\n} ", + }, + { + name: "struct indent level 1", + reflectType: reflect.TypeOf(struct{ field int }{}), + indentLevel: 1, + key: "json-type-object", + examples: []string{ + " \"field\": n,\t(json-type-numeric)\t-field", + " },\t\t", + }, + help: "{\n" + + " \"field\": n, (json-type-numeric) -field\n" + + "} ", + isComplex: true, + }, + { + name: "array of struct indent level 0", + reflectType: func() reflect.Type { + type s struct { + field int + } + return reflect.TypeOf([]s{}) + }(), + key: "json-type-arrayjson-type-object", + examples: []string{ + "[{", + " \"field\": n,\t(json-type-numeric)\ts-field", + "},...]", + }, + help: "[{\n" + + " \"field\": n, (json-type-numeric) s-field\n" + + "},...]", + isComplex: true, + }, + { + name: "array of struct indent level 1", + reflectType: func() reflect.Type { + type s struct { + field int + } + return reflect.TypeOf([]s{}) + }(), + indentLevel: 1, + key: "json-type-arrayjson-type-object", + examples: []string{ + " \"field\": n,\t(json-type-numeric)\ts-field", + " },...],\t\t", + }, + help: "[{\n" + + " \"field\": n, (json-type-numeric) s-field\n" + + "},...]", + isComplex: true, + }, + { + name: "map", + reflectType: reflect.TypeOf(map[string]string{}), + key: "json-type-object", + examples: []string{"{", + " \"fdk--key\": fdk--value, (json-type-object) fdk--desc", + " ...", "}", + }, + help: "{\n" + + " \"fdk--key\": fdk--value, (json-type-object) fdk--desc\n" + + " ...\n" + + "}", + isComplex: true, + }, + { + name: "complex", + reflectType: reflect.TypeOf(complex64(0)), + key: "json-type-value", + examples: []string{"json-example-unknown"}, + help: "json-example-unknown (json-type-value) fdk", + isInvalid: true, + }, + } + + xT := func(key string) string { + return key + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + // Ensure the description key is the expected value. + key := btcjson.TstReflectTypeToJSONType(xT, test.reflectType) + if key != test.key { + t.Errorf("Test #%d (%s) unexpected key - got: %v, "+ + "want: %v", i, test.name, key, test.key) + continue + } + + // Ensure the generated example is as expected. + examples, isComplex := btcjson.TstReflectTypeToJSONExample(xT, + test.reflectType, test.indentLevel, "fdk") + if isComplex != test.isComplex { + t.Errorf("Test #%d (%s) unexpected isComplex - got: %v, "+ + "want: %v", i, test.name, isComplex, + test.isComplex) + continue + } + if len(examples) != len(test.examples) { + t.Errorf("Test #%d (%s) unexpected result length - "+ + "got: %v, want: %v", i, test.name, len(examples), + len(test.examples)) + continue + } + for j, example := range examples { + if example != test.examples[j] { + t.Errorf("Test #%d (%s) example #%d unexpected "+ + "example - got: %v, want: %v", i, + test.name, j, example, test.examples[j]) + continue + } + } + + // Ensure the generated result type help is as expected. + helpText := btcjson.TstResultTypeHelp(xT, test.reflectType, "fdk") + if helpText != test.help { + t.Errorf("Test #%d (%s) unexpected result help - "+ + "got: %v, want: %v", i, test.name, helpText, + test.help) + continue + } + + isValid := btcjson.TstIsValidResultType(test.reflectType.Kind()) + if isValid != !test.isInvalid { + t.Errorf("Test #%d (%s) unexpected result type validity "+ + "- got: %v", i, test.name, isValid) + continue + } + } +} + +// TestResultStructHelp ensures the expected help text format is returned for +// various Go struct types. +func TestResultStructHelp(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + reflectType reflect.Type + expected []string + }{ + { + name: "empty struct", + reflectType: func() reflect.Type { + type s struct{} + return reflect.TypeOf(s{}) + }(), + expected: nil, + }, + { + name: "struct with primitive field", + reflectType: func() reflect.Type { + type s struct { + field int + } + return reflect.TypeOf(s{}) + }(), + expected: []string{ + "\"field\": n,\t(json-type-numeric)\ts-field", + }, + }, + { + name: "struct with primitive field and json tag", + reflectType: func() reflect.Type { + type s struct { + field int `json:"f"` + } + return reflect.TypeOf(s{}) + }(), + expected: []string{ + "\"f\": n,\t(json-type-numeric)\ts-f", + }, + }, + { + name: "struct with array of primitive field", + reflectType: func() reflect.Type { + type s struct { + field []int + } + return reflect.TypeOf(s{}) + }(), + expected: []string{ + "\"field\": [n,...],\t(json-type-arrayjson-type-numeric)\ts-field", + }, + }, + { + name: "struct with sub-struct field", + reflectType: func() reflect.Type { + type s2 struct { + subField int + } + type s struct { + field s2 + } + return reflect.TypeOf(s{}) + }(), + expected: []string{ + "\"field\": {\t(json-type-object)\ts-field", + "{", + " \"subfield\": n,\t(json-type-numeric)\ts2-subfield", + "}\t\t", + }, + }, + { + name: "struct with sub-struct field pointer", + reflectType: func() reflect.Type { + type s2 struct { + subField int + } + type s struct { + field *s2 + } + return reflect.TypeOf(s{}) + }(), + expected: []string{ + "\"field\": {\t(json-type-object)\ts-field", + "{", + " \"subfield\": n,\t(json-type-numeric)\ts2-subfield", + "}\t\t", + }, + }, + { + name: "struct with array of structs field", + reflectType: func() reflect.Type { + type s2 struct { + subField int + } + type s struct { + field []s2 + } + return reflect.TypeOf(s{}) + }(), + expected: []string{ + "\"field\": [{\t(json-type-arrayjson-type-object)\ts-field", + "[{", + " \"subfield\": n,\t(json-type-numeric)\ts2-subfield", + "},...]", + }, + }, + } + + xT := func(key string) string { + return key + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + results := btcjson.TstResultStructHelp(xT, test.reflectType, 0) + if len(results) != len(test.expected) { + t.Errorf("Test #%d (%s) unexpected result length - "+ + "got: %v, want: %v", i, test.name, len(results), + len(test.expected)) + continue + } + for j, result := range results { + if result != test.expected[j] { + t.Errorf("Test #%d (%s) result #%d unexpected "+ + "result - got: %v, want: %v", i, + test.name, j, result, test.expected[j]) + continue + } + } + } +} + +// TestHelpArgInternals ensures the various help functions which deal with +// arguments work as expected for various argument types. +func TestHelpArgInternals(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + reflectType reflect.Type + defaults map[int]reflect.Value + help string + }{ + { + name: "command with no args", + method: "test", + reflectType: func() reflect.Type { + type s struct{} + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "", + }, + { + name: "command with one required arg", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Field int + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "1. field (json-type-numeric, help-required) test-field\n", + }, + { + name: "command with one optional arg, no default", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Optional *int + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "1. optional (json-type-numeric, help-optional) test-optional\n", + }, + { + name: "command with one optional arg with default", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Optional *string + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: func() map[int]reflect.Value { + defVal := "test" + return map[int]reflect.Value{ + 0: reflect.ValueOf(&defVal), + } + }(), + help: "1. optional (json-type-string, help-optional, help-default=\"test\") test-optional\n", + }, + { + name: "command with struct field", + method: "test", + reflectType: func() reflect.Type { + type s2 struct { + F int8 + } + type s struct { + Field s2 + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "1. field (json-type-object, help-required) test-field\n" + + "{\n" + + " \"f\": n, (json-type-numeric) s2-f\n" + + "} \n", + }, + { + name: "command with map field", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Field map[string]float64 + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "1. field (json-type-object, help-required) test-field\n" + + "{\n" + + " \"test-field--key\": test-field--value, (json-type-object) test-field--desc\n" + + " ...\n" + + "}\n", + }, + { + name: "command with slice of primitives field", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Field []int64 + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "1. field (json-type-arrayjson-type-numeric, help-required) test-field\n", + }, + { + name: "command with slice of structs field", + method: "test", + reflectType: func() reflect.Type { + type s2 struct { + F int64 + } + type s struct { + Field []s2 + } + return reflect.TypeOf((*s)(nil)) + }(), + defaults: nil, + help: "1. field (json-type-arrayjson-type-object, help-required) test-field\n" + + "[{\n" + + " \"f\": n, (json-type-numeric) s2-f\n" + + "},...]\n", + }, + } + + xT := func(key string) string { + return key + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + help := btcjson.TstArgHelp(xT, test.reflectType, test.defaults, + test.method) + if help != test.help { + t.Errorf("Test #%d (%s) unexpected help - got:\n%v\n"+ + "want:\n%v", i, test.name, help, test.help) + continue + } + } +} + +// TestMethodHelp ensures the method help function works as expected for various +// command structs. +func TestMethodHelp(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + reflectType reflect.Type + defaults map[int]reflect.Value + resultTypes []interface{} + help string + }{ + { + name: "command with no args or results", + method: "test", + reflectType: func() reflect.Type { + type s struct{} + return reflect.TypeOf((*s)(nil)) + }(), + help: "test\n\ntest--synopsis\n\n" + + "help-arguments:\nhelp-arguments-none\n\n" + + "help-result:\nhelp-result-nothing\n", + }, + { + name: "command with no args and one primitive result", + method: "test", + reflectType: func() reflect.Type { + type s struct{} + return reflect.TypeOf((*s)(nil)) + }(), + resultTypes: []interface{}{(*int64)(nil)}, + help: "test\n\ntest--synopsis\n\n" + + "help-arguments:\nhelp-arguments-none\n\n" + + "help-result:\nn (json-type-numeric) test--result0\n", + }, + { + name: "command with no args and two results", + method: "test", + reflectType: func() reflect.Type { + type s struct{} + return reflect.TypeOf((*s)(nil)) + }(), + resultTypes: []interface{}{(*int64)(nil), nil}, + help: "test\n\ntest--synopsis\n\n" + + "help-arguments:\nhelp-arguments-none\n\n" + + "help-result (test--condition0):\nn (json-type-numeric) test--result0\n\n" + + "help-result (test--condition1):\nhelp-result-nothing\n", + }, + { + name: "command with primitive arg and no results", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Field bool + } + return reflect.TypeOf((*s)(nil)) + }(), + help: "test field\n\ntest--synopsis\n\n" + + "help-arguments:\n1. field (json-type-bool, help-required) test-field\n\n" + + "help-result:\nhelp-result-nothing\n", + }, + { + name: "command with primitive optional and no results", + method: "test", + reflectType: func() reflect.Type { + type s struct { + Field *bool + } + return reflect.TypeOf((*s)(nil)) + }(), + help: "test (field)\n\ntest--synopsis\n\n" + + "help-arguments:\n1. field (json-type-bool, help-optional) test-field\n\n" + + "help-result:\nhelp-result-nothing\n", + }, + } + + xT := func(key string) string { + return key + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + help := btcjson.TestMethodHelp(xT, test.reflectType, + test.defaults, test.method, test.resultTypes) + if help != test.help { + t.Errorf("Test #%d (%s) unexpected help - got:\n%v\n"+ + "want:\n%v", i, test.name, help, test.help) + continue + } + } +} + +// TestGenerateHelpErrors ensures the GenerateHelp function returns the expected +// errors. +func TestGenerateHelpErrors(t *testing.T) { + t.Parallel() + + tests := []struct { + name string + method string + resultTypes []interface{} + err btcjson.Error + }{ + { + name: "unregistered command", + method: "boguscommand", + err: btcjson.Error{ErrorCode: btcjson.ErrUnregisteredMethod}, + }, + { + name: "non-pointer result type", + method: "help", + resultTypes: []interface{}{0}, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "invalid result type", + method: "help", + resultTypes: []interface{}{(*complex64)(nil)}, + err: btcjson.Error{ErrorCode: btcjson.ErrInvalidType}, + }, + { + name: "missing description", + method: "help", + resultTypes: []interface{}{(*string)(nil), nil}, + err: btcjson.Error{ErrorCode: btcjson.ErrMissingDescription}, + }, + } + + t.Logf("Running %d tests", len(tests)) + for i, test := range tests { + _, err := btcjson.GenerateHelp(test.method, nil, + test.resultTypes...) + if reflect.TypeOf(err) != reflect.TypeOf(test.err) { + t.Errorf("Test #%d (%s) wrong error - got %T (%[2]v), "+ + "want %T", i, test.name, err, test.err) + continue + } + gotErrorCode := err.(btcjson.Error).ErrorCode + if gotErrorCode != test.err.ErrorCode { + t.Errorf("Test #%d (%s) mismatched error code - got "+ + "%v (%v), want %v", i, test.name, gotErrorCode, + err, test.err.ErrorCode) + continue + } + } +} + +// TestGenerateHelp performs a very basic test to ensure GenerateHelp is working +// as expected. The internal are testd much more thoroughly in other tests, so +// there is no need to add more tests here. +func TestGenerateHelp(t *testing.T) { + t.Parallel() + + descs := map[string]string{ + "help--synopsis": "test", + "help-command": "test", + } + help, err := btcjson.GenerateHelp("help", descs) + if err != nil { + t.Fatalf("GenerateHelp: unexpected error: %v", err) + } + wantHelp := "help (\"command\")\n\n" + + "test\n\nArguments:\n1. command (string, optional) test\n\n" + + "Result:\nNothing\n" + if help != wantHelp { + t.Fatalf("GenerateHelp: unexpected help - got\n%v\nwant\n%v", + help, wantHelp) + } +} From 586ea151a94707564154a71f24ce260cc2bd7dc8 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 19 Feb 2015 10:56:09 -0600 Subject: [PATCH 228/229] Use exported field with struct tag in tests. Found by golint. --- v2/btcjson/help_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/btcjson/help_test.go b/v2/btcjson/help_test.go index 505fb050..a58f06e9 100644 --- a/v2/btcjson/help_test.go +++ b/v2/btcjson/help_test.go @@ -320,7 +320,7 @@ func TestResultStructHelp(t *testing.T) { name: "struct with primitive field and json tag", reflectType: func() reflect.Type { type s struct { - field int `json:"f"` + Field int `json:"f"` } return reflect.TypeOf(s{}) }(), From 6b3c3c7498cb901b1c5c2a9e4b23855fe64d52be Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 19 Feb 2015 01:53:49 -0600 Subject: [PATCH 229/229] Import btcjson repo into btcjson directory. This commit contains the entire btcjson repository along with several changes needed to move all of the files into the btcjson directory in order to prepare it for merging. This does NOT update btcd or any of the other packages to use the new location as that will be done separately. - All import paths in the old btcjson test files have been changed to the new location - The coveralls badge has been removed since it unfortunately doesn't support coverage of sub-packages This is ongoing work toward #214. --- .gitignore | 33 -- .travis.yml | 20 - LICENSE | 13 - CONTRIBUTORS => btcjson/CONTRIBUTORS | 0 README.md => btcjson/README.md | 24 +- cmdhelp.go => btcjson/cmdhelp.go | 0 doc.go => btcjson/doc.go | 0 internal_test.go => btcjson/internal_test.go | 0 jsonapi.go => btcjson/jsonapi.go | 0 jsonapi_test.go => btcjson/jsonapi_test.go | 2 +- jsoncmd.go => btcjson/jsoncmd.go | 0 jsoncmd_test.go => btcjson/jsoncmd_test.go | 0 jsonerr.go => btcjson/jsonerr.go | 0 jsonfxns.go => btcjson/jsonfxns.go | 0 jsonfxns_test.go => btcjson/jsonfxns_test.go | 2 +- jsonresults.go => btcjson/jsonresults.go | 0 .../jsonresults_test.go | 2 +- {v2 => btcjson/v2}/btcjson/btcdextcmds.go | 0 .../v2}/btcjson/btcdextcmds_test.go | 2 +- .../v2}/btcjson/btcwalletextcmds.go | 0 .../v2}/btcjson/btcwalletextcmds_test.go | 2 +- {v2 => btcjson/v2}/btcjson/chainsvrcmds.go | 0 .../v2}/btcjson/chainsvrcmds_test.go | 2 +- {v2 => btcjson/v2}/btcjson/chainsvrresults.go | 0 .../v2}/btcjson/chainsvrresults_test.go | 2 +- {v2 => btcjson/v2}/btcjson/chainsvrwscmds.go | 0 .../v2}/btcjson/chainsvrwscmds_test.go | 2 +- {v2 => btcjson/v2}/btcjson/chainsvrwsntfns.go | 0 .../v2}/btcjson/chainsvrwsntfns_test.go | 2 +- {v2 => btcjson/v2}/btcjson/cmdinfo.go | 0 {v2 => btcjson/v2}/btcjson/cmdinfo_test.go | 2 +- {v2 => btcjson/v2}/btcjson/cmdparse.go | 0 {v2 => btcjson/v2}/btcjson/cmdparse_test.go | 2 +- {v2 => btcjson/v2}/btcjson/error.go | 0 {v2 => btcjson/v2}/btcjson/error_test.go | 2 +- {v2 => btcjson/v2}/btcjson/export_test.go | 0 {v2 => btcjson/v2}/btcjson/help.go | 0 {v2 => btcjson/v2}/btcjson/help_test.go | 2 +- {v2 => btcjson/v2}/btcjson/helpers.go | 0 {v2 => btcjson/v2}/btcjson/helpers_test.go | 2 +- {v2 => btcjson/v2}/btcjson/jsonrpc.go | 0 {v2 => btcjson/v2}/btcjson/jsonrpc_test.go | 2 +- {v2 => btcjson/v2}/btcjson/jsonrpcerr.go | 0 {v2 => btcjson/v2}/btcjson/register.go | 0 {v2 => btcjson/v2}/btcjson/register_test.go | 2 +- {v2 => btcjson/v2}/btcjson/walletsvrcmds.go | 0 .../v2}/btcjson/walletsvrcmds_test.go | 2 +- .../v2}/btcjson/walletsvrresults.go | 0 {v2 => btcjson/v2}/btcjson/walletsvrwscmds.go | 0 .../v2}/btcjson/walletsvrwscmds_test.go | 2 +- .../v2}/btcjson/walletsvrwsntfns.go | 0 .../v2}/btcjson/walletsvrwsntfns_test.go | 2 +- cov_report.sh | 17 - goclean.sh | 40 -- test_coverage.txt | 430 ------------------ 55 files changed, 29 insertions(+), 586 deletions(-) delete mode 100644 .gitignore delete mode 100644 .travis.yml delete mode 100644 LICENSE rename CONTRIBUTORS => btcjson/CONTRIBUTORS (100%) rename README.md => btcjson/README.md (77%) rename cmdhelp.go => btcjson/cmdhelp.go (100%) rename doc.go => btcjson/doc.go (100%) rename internal_test.go => btcjson/internal_test.go (100%) rename jsonapi.go => btcjson/jsonapi.go (100%) rename jsonapi_test.go => btcjson/jsonapi_test.go (99%) rename jsoncmd.go => btcjson/jsoncmd.go (100%) rename jsoncmd_test.go => btcjson/jsoncmd_test.go (100%) rename jsonerr.go => btcjson/jsonerr.go (100%) rename jsonfxns.go => btcjson/jsonfxns.go (100%) rename jsonfxns_test.go => btcjson/jsonfxns_test.go (97%) rename jsonresults.go => btcjson/jsonresults.go (100%) rename jsonresults_test.go => btcjson/jsonresults_test.go (99%) rename {v2 => btcjson/v2}/btcjson/btcdextcmds.go (100%) rename {v2 => btcjson/v2}/btcjson/btcdextcmds_test.go (98%) rename {v2 => btcjson/v2}/btcjson/btcwalletextcmds.go (100%) rename {v2 => btcjson/v2}/btcjson/btcwalletextcmds_test.go (99%) rename {v2 => btcjson/v2}/btcjson/chainsvrcmds.go (100%) rename {v2 => btcjson/v2}/btcjson/chainsvrcmds_test.go (99%) rename {v2 => btcjson/v2}/btcjson/chainsvrresults.go (100%) rename {v2 => btcjson/v2}/btcjson/chainsvrresults_test.go (96%) rename {v2 => btcjson/v2}/btcjson/chainsvrwscmds.go (100%) rename {v2 => btcjson/v2}/btcjson/chainsvrwscmds_test.go (99%) rename {v2 => btcjson/v2}/btcjson/chainsvrwsntfns.go (100%) rename {v2 => btcjson/v2}/btcjson/chainsvrwsntfns_test.go (99%) rename {v2 => btcjson/v2}/btcjson/cmdinfo.go (100%) rename {v2 => btcjson/v2}/btcjson/cmdinfo_test.go (99%) rename {v2 => btcjson/v2}/btcjson/cmdparse.go (100%) rename {v2 => btcjson/v2}/btcjson/cmdparse_test.go (99%) rename {v2 => btcjson/v2}/btcjson/error.go (100%) rename {v2 => btcjson/v2}/btcjson/error_test.go (97%) rename {v2 => btcjson/v2}/btcjson/export_test.go (100%) rename {v2 => btcjson/v2}/btcjson/help.go (100%) rename {v2 => btcjson/v2}/btcjson/help_test.go (99%) rename {v2 => btcjson/v2}/btcjson/helpers.go (100%) rename {v2 => btcjson/v2}/btcjson/helpers_test.go (97%) rename {v2 => btcjson/v2}/btcjson/jsonrpc.go (100%) rename {v2 => btcjson/v2}/btcjson/jsonrpc_test.go (98%) rename {v2 => btcjson/v2}/btcjson/jsonrpcerr.go (100%) rename {v2 => btcjson/v2}/btcjson/register.go (100%) rename {v2 => btcjson/v2}/btcjson/register_test.go (99%) rename {v2 => btcjson/v2}/btcjson/walletsvrcmds.go (100%) rename {v2 => btcjson/v2}/btcjson/walletsvrcmds_test.go (99%) rename {v2 => btcjson/v2}/btcjson/walletsvrresults.go (100%) rename {v2 => btcjson/v2}/btcjson/walletsvrwscmds.go (100%) rename {v2 => btcjson/v2}/btcjson/walletsvrwscmds_test.go (99%) rename {v2 => btcjson/v2}/btcjson/walletsvrwsntfns.go (100%) rename {v2 => btcjson/v2}/btcjson/walletsvrwsntfns_test.go (99%) delete mode 100644 cov_report.sh delete mode 100755 goclean.sh delete mode 100644 test_coverage.txt diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 16e35934..00000000 --- a/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -# Temp files -*~ - -# Databases -btcd.db -*-shm -*-wal - -# Log files -*.log - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f57343e1..00000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go -go: - - 1.3.3 - - 1.4.1 -sudo: false -before_install: - - gotools=golang.org/x/tools - - if [ "$TRAVIS_GO_VERSION" = "release" ]; then gotools=code.google.com/p/go.tools; fi -install: - - go get -d -t -v ./... - - go get -v $gotools/cmd/cover - - go get -v $gotools/cmd/vet - - go get -v github.com/bradfitz/goimports - - go get -v github.com/golang/lint/golint - - go get -v github.com/mattn/goveralls -script: - - export PATH=$PATH:$HOME/gopath/bin - - ./goclean.sh -after_success: - - goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 992dd50d..00000000 --- a/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2013-2014 Conformal Systems LLC. - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/CONTRIBUTORS b/btcjson/CONTRIBUTORS similarity index 100% rename from CONTRIBUTORS rename to btcjson/CONTRIBUTORS diff --git a/README.md b/btcjson/README.md similarity index 77% rename from README.md rename to btcjson/README.md index 0b0b8085..e3662c6d 100644 --- a/README.md +++ b/btcjson/README.md @@ -1,10 +1,8 @@ btcjson ======= -[![Build Status](https://travis-ci.org/btcsuite/btcjson.png?branch=master)] -(https://travis-ci.org/btcsuite/btcjson) [![Coverage Status] -(https://img.shields.io/coveralls/btcsuite/btcjson.svg)] -(https://coveralls.io/r/btcsuite/btcjson?branch=master) [![ISC License] +[![Build Status](https://travis-ci.org/btcsuite/btcd.png?branch=master)] +(https://travis-ci.org/btcsuite/btcd) [![ISC License] (http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) Package btcjson implements concrete types for marshalling to and from the @@ -12,9 +10,7 @@ bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure proper functionality. Package btcjson is licensed under the copyfree ISC license. -This package is one of the core packages from btcd, an alternative full-node -implementation of bitcoin which is under active development by Conformal. -Although it was primarily written for btcd, this package has intentionally been +Although this package was primarily written for btcd, it has intentionally been designed so it can be used as a standalone package for any projects needing to marshal to and from bitcoin JSON-RPC requests and responses. @@ -29,9 +25,9 @@ ints, etc) to higher-level types with many nice and useful properties. ## JSON RPC -Bitcoin provides an extensive API call list to control bitcoind or bitcoin-qt -through JSON-RPC. These can be used to get information from the client or to -cause the client to perform some action. +Bitcoin provides an extensive API call list to control the chain and wallet +servers through JSON-RPC. These can be used to get information from the server +or to cause the server to perform some action. The general form of the commands are: @@ -66,20 +62,20 @@ server, and to handle the replies (putting them in useful Go data structures). ## Documentation [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)] -(http://godoc.org/github.com/btcsuite/btcjson) +(http://godoc.org/github.com/btcsuite/btcd/btcjson) Full `go doc` style documentation for the project can be viewed online without installing this package by using the GoDoc site -[here](http://godoc.org/github.com/btcsuite/btcjson). +[here](http://godoc.org/github.com/btcsuite/btcd/btcjson). You can also view the documentation locally once the package is installed with the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to -http://localhost:6060/pkg/github.com/btcsuite/btcjson +http://localhost:6060/pkg/github.com/btcsuite/btcd/btcjson ## Installation ```bash -$ go get github.com/btcsuite/btcjson +$ go get github.com/btcsuite/btcd/btcjson ``` ## GPG Verification Key diff --git a/cmdhelp.go b/btcjson/cmdhelp.go similarity index 100% rename from cmdhelp.go rename to btcjson/cmdhelp.go diff --git a/doc.go b/btcjson/doc.go similarity index 100% rename from doc.go rename to btcjson/doc.go diff --git a/internal_test.go b/btcjson/internal_test.go similarity index 100% rename from internal_test.go rename to btcjson/internal_test.go diff --git a/jsonapi.go b/btcjson/jsonapi.go similarity index 100% rename from jsonapi.go rename to btcjson/jsonapi.go diff --git a/jsonapi_test.go b/btcjson/jsonapi_test.go similarity index 99% rename from jsonapi_test.go rename to btcjson/jsonapi_test.go index bf91880b..05800370 100644 --- a/jsonapi_test.go +++ b/btcjson/jsonapi_test.go @@ -11,7 +11,7 @@ import ( "io/ioutil" "testing" - "github.com/btcsuite/btcjson" + "github.com/btcsuite/btcd/btcjson" ) // cmdtests is a table of all the possible commands and a list of inputs, diff --git a/jsoncmd.go b/btcjson/jsoncmd.go similarity index 100% rename from jsoncmd.go rename to btcjson/jsoncmd.go diff --git a/jsoncmd_test.go b/btcjson/jsoncmd_test.go similarity index 100% rename from jsoncmd_test.go rename to btcjson/jsoncmd_test.go diff --git a/jsonerr.go b/btcjson/jsonerr.go similarity index 100% rename from jsonerr.go rename to btcjson/jsonerr.go diff --git a/jsonfxns.go b/btcjson/jsonfxns.go similarity index 100% rename from jsonfxns.go rename to btcjson/jsonfxns.go diff --git a/jsonfxns_test.go b/btcjson/jsonfxns_test.go similarity index 97% rename from jsonfxns_test.go rename to btcjson/jsonfxns_test.go index ffe845a9..0398b312 100644 --- a/jsonfxns_test.go +++ b/btcjson/jsonfxns_test.go @@ -9,7 +9,7 @@ import ( "fmt" "testing" - "github.com/btcsuite/btcjson" + "github.com/btcsuite/btcd/btcjson" ) // TestMarshallAndSend tests the MarshallAndSend function to make sure it can diff --git a/jsonresults.go b/btcjson/jsonresults.go similarity index 100% rename from jsonresults.go rename to btcjson/jsonresults.go diff --git a/jsonresults_test.go b/btcjson/jsonresults_test.go similarity index 99% rename from jsonresults_test.go rename to btcjson/jsonresults_test.go index 83d7f07e..f80b2d18 100644 --- a/jsonresults_test.go +++ b/btcjson/jsonresults_test.go @@ -9,7 +9,7 @@ import ( "encoding/json" "testing" - "github.com/btcsuite/btcjson" + "github.com/btcsuite/btcd/btcjson" ) var resulttests = []struct { diff --git a/v2/btcjson/btcdextcmds.go b/btcjson/v2/btcjson/btcdextcmds.go similarity index 100% rename from v2/btcjson/btcdextcmds.go rename to btcjson/v2/btcjson/btcdextcmds.go diff --git a/v2/btcjson/btcdextcmds_test.go b/btcjson/v2/btcjson/btcdextcmds_test.go similarity index 98% rename from v2/btcjson/btcdextcmds_test.go rename to btcjson/v2/btcjson/btcdextcmds_test.go index 9e58bc31..58ea83cc 100644 --- a/v2/btcjson/btcdextcmds_test.go +++ b/btcjson/v2/btcjson/btcdextcmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestBtcdExtCmds tests all of the btcd extended commands marshal and unmarshal diff --git a/v2/btcjson/btcwalletextcmds.go b/btcjson/v2/btcjson/btcwalletextcmds.go similarity index 100% rename from v2/btcjson/btcwalletextcmds.go rename to btcjson/v2/btcjson/btcwalletextcmds.go diff --git a/v2/btcjson/btcwalletextcmds_test.go b/btcjson/v2/btcjson/btcwalletextcmds_test.go similarity index 99% rename from v2/btcjson/btcwalletextcmds_test.go rename to btcjson/v2/btcjson/btcwalletextcmds_test.go index ecdace9a..78ad9952 100644 --- a/v2/btcjson/btcwalletextcmds_test.go +++ b/btcjson/v2/btcjson/btcwalletextcmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestBtcWalletExtCmds tests all of the btcwallet extended commands marshal and diff --git a/v2/btcjson/chainsvrcmds.go b/btcjson/v2/btcjson/chainsvrcmds.go similarity index 100% rename from v2/btcjson/chainsvrcmds.go rename to btcjson/v2/btcjson/chainsvrcmds.go diff --git a/v2/btcjson/chainsvrcmds_test.go b/btcjson/v2/btcjson/chainsvrcmds_test.go similarity index 99% rename from v2/btcjson/chainsvrcmds_test.go rename to btcjson/v2/btcjson/chainsvrcmds_test.go index edbc6c7a..4765297b 100644 --- a/v2/btcjson/chainsvrcmds_test.go +++ b/btcjson/v2/btcjson/chainsvrcmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestChainSvrCmds tests all of the chain server commands marshal and unmarshal diff --git a/v2/btcjson/chainsvrresults.go b/btcjson/v2/btcjson/chainsvrresults.go similarity index 100% rename from v2/btcjson/chainsvrresults.go rename to btcjson/v2/btcjson/chainsvrresults.go diff --git a/v2/btcjson/chainsvrresults_test.go b/btcjson/v2/btcjson/chainsvrresults_test.go similarity index 96% rename from v2/btcjson/chainsvrresults_test.go rename to btcjson/v2/btcjson/chainsvrresults_test.go index e1ce0b91..98d6b1c7 100644 --- a/v2/btcjson/chainsvrresults_test.go +++ b/btcjson/v2/btcjson/chainsvrresults_test.go @@ -8,7 +8,7 @@ import ( "encoding/json" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestChainSvrCustomResults ensures any results that have custom marshalling diff --git a/v2/btcjson/chainsvrwscmds.go b/btcjson/v2/btcjson/chainsvrwscmds.go similarity index 100% rename from v2/btcjson/chainsvrwscmds.go rename to btcjson/v2/btcjson/chainsvrwscmds.go diff --git a/v2/btcjson/chainsvrwscmds_test.go b/btcjson/v2/btcjson/chainsvrwscmds_test.go similarity index 99% rename from v2/btcjson/chainsvrwscmds_test.go rename to btcjson/v2/btcjson/chainsvrwscmds_test.go index 11fe68bb..6f9c18e3 100644 --- a/v2/btcjson/chainsvrwscmds_test.go +++ b/btcjson/v2/btcjson/chainsvrwscmds_test.go @@ -11,8 +11,8 @@ import ( "reflect" "testing" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcjson/v2/btcjson" ) // TestChainSvrWsCmds tests all of the chain server websocket-specific commands diff --git a/v2/btcjson/chainsvrwsntfns.go b/btcjson/v2/btcjson/chainsvrwsntfns.go similarity index 100% rename from v2/btcjson/chainsvrwsntfns.go rename to btcjson/v2/btcjson/chainsvrwsntfns.go diff --git a/v2/btcjson/chainsvrwsntfns_test.go b/btcjson/v2/btcjson/chainsvrwsntfns_test.go similarity index 99% rename from v2/btcjson/chainsvrwsntfns_test.go rename to btcjson/v2/btcjson/chainsvrwsntfns_test.go index 1b8c88d3..37b03871 100644 --- a/v2/btcjson/chainsvrwsntfns_test.go +++ b/btcjson/v2/btcjson/chainsvrwsntfns_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestChainSvrWsNtfns tests all of the chain server websocket-specific diff --git a/v2/btcjson/cmdinfo.go b/btcjson/v2/btcjson/cmdinfo.go similarity index 100% rename from v2/btcjson/cmdinfo.go rename to btcjson/v2/btcjson/cmdinfo.go diff --git a/v2/btcjson/cmdinfo_test.go b/btcjson/v2/btcjson/cmdinfo_test.go similarity index 99% rename from v2/btcjson/cmdinfo_test.go rename to btcjson/v2/btcjson/cmdinfo_test.go index 8be185e5..3e082d88 100644 --- a/v2/btcjson/cmdinfo_test.go +++ b/btcjson/v2/btcjson/cmdinfo_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestCmdMethod tests the CmdMethod function to ensure it retuns the expected diff --git a/v2/btcjson/cmdparse.go b/btcjson/v2/btcjson/cmdparse.go similarity index 100% rename from v2/btcjson/cmdparse.go rename to btcjson/v2/btcjson/cmdparse.go diff --git a/v2/btcjson/cmdparse_test.go b/btcjson/v2/btcjson/cmdparse_test.go similarity index 99% rename from v2/btcjson/cmdparse_test.go rename to btcjson/v2/btcjson/cmdparse_test.go index 5c9cbc2c..84123995 100644 --- a/v2/btcjson/cmdparse_test.go +++ b/btcjson/v2/btcjson/cmdparse_test.go @@ -10,7 +10,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestAssignField tests the assignField function handles supported combinations diff --git a/v2/btcjson/error.go b/btcjson/v2/btcjson/error.go similarity index 100% rename from v2/btcjson/error.go rename to btcjson/v2/btcjson/error.go diff --git a/v2/btcjson/error_test.go b/btcjson/v2/btcjson/error_test.go similarity index 97% rename from v2/btcjson/error_test.go rename to btcjson/v2/btcjson/error_test.go index d7e7e3fc..12d9bdf2 100644 --- a/v2/btcjson/error_test.go +++ b/btcjson/v2/btcjson/error_test.go @@ -7,7 +7,7 @@ package btcjson_test import ( "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestErrorCodeStringer tests the stringized output for the ErrorCode type. diff --git a/v2/btcjson/export_test.go b/btcjson/v2/btcjson/export_test.go similarity index 100% rename from v2/btcjson/export_test.go rename to btcjson/v2/btcjson/export_test.go diff --git a/v2/btcjson/help.go b/btcjson/v2/btcjson/help.go similarity index 100% rename from v2/btcjson/help.go rename to btcjson/v2/btcjson/help.go diff --git a/v2/btcjson/help_test.go b/btcjson/v2/btcjson/help_test.go similarity index 99% rename from v2/btcjson/help_test.go rename to btcjson/v2/btcjson/help_test.go index a58f06e9..1756c5bb 100644 --- a/v2/btcjson/help_test.go +++ b/btcjson/v2/btcjson/help_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestHelpReflectInternals ensures the various help functions which deal with diff --git a/v2/btcjson/helpers.go b/btcjson/v2/btcjson/helpers.go similarity index 100% rename from v2/btcjson/helpers.go rename to btcjson/v2/btcjson/helpers.go diff --git a/v2/btcjson/helpers_test.go b/btcjson/v2/btcjson/helpers_test.go similarity index 97% rename from v2/btcjson/helpers_test.go rename to btcjson/v2/btcjson/helpers_test.go index 25b9ac77..cb55a9b2 100644 --- a/v2/btcjson/helpers_test.go +++ b/btcjson/v2/btcjson/helpers_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestHelpers tests the various helper functions which create pointers to diff --git a/v2/btcjson/jsonrpc.go b/btcjson/v2/btcjson/jsonrpc.go similarity index 100% rename from v2/btcjson/jsonrpc.go rename to btcjson/v2/btcjson/jsonrpc.go diff --git a/v2/btcjson/jsonrpc_test.go b/btcjson/v2/btcjson/jsonrpc_test.go similarity index 98% rename from v2/btcjson/jsonrpc_test.go rename to btcjson/v2/btcjson/jsonrpc_test.go index 1f1f9fc5..8a48462e 100644 --- a/v2/btcjson/jsonrpc_test.go +++ b/btcjson/v2/btcjson/jsonrpc_test.go @@ -9,7 +9,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestIsValidIDType ensures the IsValidIDType function behaves as expected. diff --git a/v2/btcjson/jsonrpcerr.go b/btcjson/v2/btcjson/jsonrpcerr.go similarity index 100% rename from v2/btcjson/jsonrpcerr.go rename to btcjson/v2/btcjson/jsonrpcerr.go diff --git a/v2/btcjson/register.go b/btcjson/v2/btcjson/register.go similarity index 100% rename from v2/btcjson/register.go rename to btcjson/v2/btcjson/register.go diff --git a/v2/btcjson/register_test.go b/btcjson/v2/btcjson/register_test.go similarity index 99% rename from v2/btcjson/register_test.go rename to btcjson/v2/btcjson/register_test.go index 9fac1172..f0131075 100644 --- a/v2/btcjson/register_test.go +++ b/btcjson/v2/btcjson/register_test.go @@ -9,7 +9,7 @@ import ( "sort" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestUsageFlagStringer tests the stringized output for the UsageFlag type. diff --git a/v2/btcjson/walletsvrcmds.go b/btcjson/v2/btcjson/walletsvrcmds.go similarity index 100% rename from v2/btcjson/walletsvrcmds.go rename to btcjson/v2/btcjson/walletsvrcmds.go diff --git a/v2/btcjson/walletsvrcmds_test.go b/btcjson/v2/btcjson/walletsvrcmds_test.go similarity index 99% rename from v2/btcjson/walletsvrcmds_test.go rename to btcjson/v2/btcjson/walletsvrcmds_test.go index 99ec4a5d..d68820a6 100644 --- a/v2/btcjson/walletsvrcmds_test.go +++ b/btcjson/v2/btcjson/walletsvrcmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestWalletSvrCmds tests all of the wallet server commands marshal and diff --git a/v2/btcjson/walletsvrresults.go b/btcjson/v2/btcjson/walletsvrresults.go similarity index 100% rename from v2/btcjson/walletsvrresults.go rename to btcjson/v2/btcjson/walletsvrresults.go diff --git a/v2/btcjson/walletsvrwscmds.go b/btcjson/v2/btcjson/walletsvrwscmds.go similarity index 100% rename from v2/btcjson/walletsvrwscmds.go rename to btcjson/v2/btcjson/walletsvrwscmds.go diff --git a/v2/btcjson/walletsvrwscmds_test.go b/btcjson/v2/btcjson/walletsvrwscmds_test.go similarity index 99% rename from v2/btcjson/walletsvrwscmds_test.go rename to btcjson/v2/btcjson/walletsvrwscmds_test.go index ff06b945..a4556c0a 100644 --- a/v2/btcjson/walletsvrwscmds_test.go +++ b/btcjson/v2/btcjson/walletsvrwscmds_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestWalletSvrWsCmds tests all of the wallet server websocket-specific diff --git a/v2/btcjson/walletsvrwsntfns.go b/btcjson/v2/btcjson/walletsvrwsntfns.go similarity index 100% rename from v2/btcjson/walletsvrwsntfns.go rename to btcjson/v2/btcjson/walletsvrwsntfns.go diff --git a/v2/btcjson/walletsvrwsntfns_test.go b/btcjson/v2/btcjson/walletsvrwsntfns_test.go similarity index 99% rename from v2/btcjson/walletsvrwsntfns_test.go rename to btcjson/v2/btcjson/walletsvrwsntfns_test.go index 57b717d1..ef8b28ec 100644 --- a/v2/btcjson/walletsvrwsntfns_test.go +++ b/btcjson/v2/btcjson/walletsvrwsntfns_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/btcsuite/btcjson/v2/btcjson" + "github.com/btcsuite/btcd/btcjson/v2/btcjson" ) // TestWalletSvrWsNtfns tests all of the chain server websocket-specific diff --git a/cov_report.sh b/cov_report.sh deleted file mode 100644 index 307f05b7..00000000 --- a/cov_report.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This script uses gocov to generate a test coverage report. -# The gocov tool my be obtained with the following command: -# go get github.com/axw/gocov/gocov -# -# It will be installed to $GOPATH/bin, so ensure that location is in your $PATH. - -# Check for gocov. -type gocov >/dev/null 2>&1 -if [ $? -ne 0 ]; then - echo >&2 "This script requires the gocov tool." - echo >&2 "You may obtain it with the following command:" - echo >&2 "go get github.com/axw/gocov/gocov" - exit 1 -fi -gocov test | gocov report diff --git a/goclean.sh b/goclean.sh deleted file mode 100755 index f0512e77..00000000 --- a/goclean.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# The script does automatic checking on a Go package and its sub-packages, including: -# 1. gofmt (http://golang.org/cmd/gofmt/) -# 2. goimports (https://github.com/bradfitz/goimports) -# 3. golint (https://github.com/golang/lint) -# 4. go vet (http://golang.org/cmd/vet) -# 5. race detector (http://blog.golang.org/race-detector) -# 6. test coverage (http://blog.golang.org/cover) - -set -e - -# Automatic checks -cd v2/btcjson -test -z "$(gofmt -l -w . | tee /dev/stderr)" -test -z "$(goimports -l -w . | tee /dev/stderr)" -test -z "$(golint . | tee /dev/stderr)" -go vet ./... -go test -race ./... - -# Run test coverage on each subdirectories and merge the coverage profile. - -echo "mode: count" > profile.cov - -# Standard go tooling behavior is to ignore dirs with leading underscors -for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); -do -if ls $dir/*.go &> /dev/null; then - go test -covermode=count -coverprofile=$dir/profile.tmp $dir - if [ -f $dir/profile.tmp ]; then - cat $dir/profile.tmp | tail -n +2 >> profile.cov - rm $dir/profile.tmp - fi -fi -done - -go tool cover -func profile.cov - -# To submit the test coverage result to coveralls.io, -# use goveralls (https://github.com/mattn/goveralls) -# goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/test_coverage.txt b/test_coverage.txt deleted file mode 100644 index b489f821..00000000 --- a/test_coverage.txt +++ /dev/null @@ -1,430 +0,0 @@ - -github.com/conformal/btcjson/jsonapi.go JSONToAmount 100.00% (15/15) -github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7) -github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6) -github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5) -github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go JSONGetMethod 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (2/2) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletLockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewVerifyMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListAddressGroupingsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewListLockUnspentCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetNetTotalsCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetPeerInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewReconsiderBlockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go PingCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewPingCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutSetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewImportWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewInvalidateBlockCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewBackupWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go Error.Error 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateMultisigCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewCreateRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDebugLevelCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewValidateAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeRawTransactionCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDecodeScriptCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpPrivKeyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewDumpWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEncryptWalletCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go RpcCommand 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEstimateFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go StopCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewEstimatePriorityCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewStopCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseChangeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAccountAddressCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetAddressesByAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSignMessageCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBestBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetTxFeeCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockChainInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewSetAccountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockHashCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetMiningInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewWalletPassphraseCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetConnectionCountCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetDifficultyCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetGenerateCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetHashesPerSecCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go NewGetInfoCmd 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Id 100.00% (1/1) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.Method 100.00% (1/1) -github.com/conformal/btcjson/jsonapi.go CreateMessageWithId 96.29% (337/350) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.MarshalJSON 92.86% (13/14) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.MarshalJSON 92.86% (13/14) -github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.MarshalJSON 91.67% (11/12) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.MarshalJSON 90.91% (10/11) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.MarshalJSON 90.00% (9/10) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewVerifyChainCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go NewGetNetworkHashPSCmd 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.MarshalJSON 88.89% (8/9) -github.com/conformal/btcjson/jsoncmd.go ParseMarshaledCmd 88.66% (86/97) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go NewRawCmd 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.MarshalJSON 87.50% (7/8) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.MarshalJSON 85.71% (6/7) -github.com/conformal/btcjson/jsoncmd.go NewHelpCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawChangeAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetAddedNodeInfoCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewAddMultisigAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetNewAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSendRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetWorkCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAddressCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetTxOutCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSubmitBlockCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewListAccountsCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawTransactionCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSetGenerateCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetRawMempoolCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewKeyPoolRefillCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewGetReceivedByAccountCmd 83.33% (5/6) -github.com/conformal/btcjson/jsoncmd.go NewSearchRawTransactionCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListTransactionsCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewSendFromCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListUnspentCmd 80.95% (17/21) -github.com/conformal/btcjson/jsoncmd.go NewListSinceBlockCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewGetBalanceCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAccountCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendManyCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewSendToAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewMoveCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go NewListReceivedByAddressCmd 80.00% (12/15) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.MarshalJSON 80.00% (4/5) -github.com/conformal/btcjson/jsoncmd.go NewImportPrivKeyCmd 78.57% (11/14) -github.com/conformal/btcjson/jsoncmd.go ListUnspentCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListTransactionsCmd.UnmarshalJSON 76.92% (20/26) -github.com/conformal/btcjson/jsoncmd.go ListSinceBlockCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAddressCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetBalanceCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go GetNetworkHashPSCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go VerifyChainCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go ListReceivedByAccountCmd.UnmarshalJSON 76.19% (16/21) -github.com/conformal/btcjson/jsoncmd.go SearchRawTransactionCmd.UnmarshalJSON 75.86% (22/29) -github.com/conformal/btcjson/jsoncmd.go SendManyCmd.UnmarshalJSON 75.76% (25/33) -github.com/conformal/btcjson/jsoncmd.go ImportPrivKeyCmd.UnmarshalJSON 75.00% (18/24) -github.com/conformal/btcjson/jsoncmd.go ListAccountsCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawMempoolCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetRawChangeAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go HelpCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetBlockTemplateCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go KeyPoolRefillCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go GetNewAddressCmd.UnmarshalJSON 75.00% (12/16) -github.com/conformal/btcjson/jsoncmd.go LockUnspentCmd.MarshalJSON 75.00% (6/8) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go PingCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go StopCmd.MarshalJSON 75.00% (3/4) -github.com/conformal/btcjson/jsoncmd.go SendFromCmd.UnmarshalJSON 73.68% (28/38) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAccountCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetRawTransactionCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SubmitBlockCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go GetReceivedByAddressCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SetGenerateCmd.UnmarshalJSON 73.68% (14/19) -github.com/conformal/btcjson/jsoncmd.go SendToAddressCmd.UnmarshalJSON 73.33% (22/30) -github.com/conformal/btcjson/jsoncmd.go MoveCmd.UnmarshalJSON 72.73% (24/33) -github.com/conformal/btcjson/jsoncmd.go CreateRawTransactionCmd.UnmarshalJSON 72.73% (16/22) -github.com/conformal/btcjson/jsoncmd.go GetTxOutCmd.UnmarshalJSON 72.73% (16/22) -github.com/conformal/btcjson/jsoncmd.go GetWorkCmd.UnmarshalJSON 71.43% (10/14) -github.com/conformal/btcjson/jsoncmd.go GetAddedNodeInfoCmd.UnmarshalJSON 70.59% (12/17) -github.com/conformal/btcjson/jsoncmd.go AddMultisigAddressCmd.UnmarshalJSON 70.00% (14/20) -github.com/conformal/btcjson/jsoncmd.go GetBlockChainInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetworkInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetMiningInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListLockUnspentCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetHashesPerSecCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetGenerateCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetDifficultyCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go WalletLockCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetConnectionCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetTxOutSetInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go StopCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBlockCountCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go PingCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetPeerInfoCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetBestBlockHashCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go ListAddressGroupingsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go GetNetTotalsCmd.UnmarshalJSON 70.00% (7/10) -github.com/conformal/btcjson/jsoncmd.go BackupWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go InvalidateBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ImportWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ReconsiderBlockCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetBlockHashCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAddressesByAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go GetAccountCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EstimatePriorityCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EstimateFeeCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go EncryptWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpWalletCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DumpPrivKeyCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeScriptCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DecodeRawTransactionCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go DebugLevelCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go ValidateAddressCmd.UnmarshalJSON 69.23% (9/13) -github.com/conformal/btcjson/jsoncmd.go SetAccountCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SignMessageCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go SetTxFeeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go CreateMultisigCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go WalletPassphraseChangeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go AddNodeCmd.UnmarshalJSON 68.75% (11/16) -github.com/conformal/btcjson/jsoncmd.go VerifyMessageCmd.UnmarshalJSON 68.42% (13/19) -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/jsonresults.go ReadResultCmd 64.00% (112/175) -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 LockUnspentCmd.UnmarshalJSON 57.89% (11/19) -github.com/conformal/btcjson/jsoncmd.go GetBlockCmd.UnmarshalJSON 50.00% (12/24) -github.com/conformal/btcjson/cmdhelp.go GetHelpString 50.00% (3/6) -github.com/conformal/btcjson/jsonapi.go rpcRawCommand 47.06% (8/17) -github.com/conformal/btcjson/jsoncmd.go SignRawTransactionCmd.UnmarshalJSON 44.83% (13/29) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockTemplateCmd 43.75% (7/16) -github.com/conformal/btcjson/jsoncmd.go NewSignRawTransactionCmd 38.10% (8/21) -github.com/conformal/btcjson/jsoncmd.go NewGetBlockCmd 36.36% (4/11) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.UnmarshalJSON 0.00% (0/6) -github.com/conformal/btcjson/jsonresults.go Vin.MarshalJSON 0.00% (0/5) -github.com/conformal/btcjson/jsonapi.go TlsRpcSend 0.00% (0/4) -github.com/conformal/btcjson/jsonapi.go RpcSend 0.00% (0/4) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.MarshalJSON 0.00% (0/4) -github.com/conformal/btcjson/jsonapi.go BadStatusCode.Error 0.00% (0/2) -github.com/conformal/btcjson/jsonresults.go Vin.IsCoinBase 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Id 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go newUnparsableCmd 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go unparsableCmd.Method 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go RpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsonapi.go TlsRpcRawCommand 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go isFloatInt64 0.00% (0/1) -github.com/conformal/btcjson/jsoncmd.go RegisterCustomCmd 0.00% (0/1) -github.com/conformal/btcjson --------------------------------------- 77.86% (2458/3157) -