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
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.
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).
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.
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.
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
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.
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.
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.
Add return types for serveral additional commands.
Fix required vs. optional arguments for createrawtransaction.
Update tests and test coverage for all changes.
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).