Commit graph

47 commits

Author SHA1 Message Date
Dave Collins
bf90ed2142 Add 2014 to copyright dates. 2014-01-08 23:49:06 -06:00
Dave Collins
e1053b4a95 Add P2sh field to DecodeScriptResult. 2014-01-04 11:54:39 -06:00
Dave Collins
f78d054700 Add struct for DecodeScriptResult. 2014-01-03 18:20:06 -06:00
Francis Lam
5d91e16e7c 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
2013-12-30 20:36:46 -06:00
Dave Collins
c0236b5a2f Change LockTime in TxRawDecodeResult to uint32. 2013-12-30 18:42:46 -06:00
Dave Collins
11d39125de The sequence num of a tx input is a uint32. 2013-12-27 12:38:11 -06:00
Dave Collins
d3b76da919 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.
2013-12-27 12:22:37 -06:00
Dave Collins
509bf830b1 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).
2013-12-27 11:27:52 -06:00
Dave Collins
1855c19562 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.
2013-12-26 21:28:57 -06:00
Dave Collins
e0e4c8bdb6 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.
2013-12-26 10:39:10 -06:00
Owain G. Ainsworth
4cb318ac02 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.
2013-12-16 18:01:45 +00:00
John C. Vernaleo
4d0cbb776b Make id omitemtpy to match spec better. 2013-12-11 13:42:29 -05:00
Francis Lam
91a19dda85 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
2013-12-08 14:51:18 -05:00
John C. Vernaleo
7397dd6896 Rename reqSig to reqSigs
Match bitcoin json name better.

Closes #9
2013-11-22 08:48:02 -05:00
Owain G. Ainsworth
e43c79c74d 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.
2013-11-19 14:46:17 +00:00
John C. Vernaleo
606262514b 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.
2013-11-18 13:23:05 -05:00
John C. Vernaleo
cbd3d730a9 Add initial support for submitblock command.
Closes #7
2013-10-22 15:11:01 -04:00
John C. Vernaleo
850870f14b Fix some doc typos (from oga@) 2013-10-22 09:18:55 -04:00
John C. Vernaleo
440f336d34 Correct addnode's required argument type. 2013-10-21 13:22:52 -04:00
Josh Rickmar
31489c15b3 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.
2013-10-14 13:16:37 -04:00
John C. Vernaleo
7ad6d73416 Add support for recent commands:
getrawchangeaddress and getbestblockhash.
2013-10-11 15:12:27 -04:00
John C. Vernaleo
5444d262b8 Fix for signrawtransaction.
Add sendrawtransaction to list of commands we know the return type
for.
2013-10-04 13:18:49 -04:00
John C. Vernaleo
dc9618c9ab Add a Error() to the Error struct.
Resolves #6
2013-10-01 12:50:50 -04:00
John C. Vernaleo
5d40d51672 Correct bug in walletpassphrase arguements.
Thanks to pureveg and hngchiming for pointing it out.
2013-08-14 10:15:16 -04:00
John C. Vernaleo
7a7fa56407 Make id an interface in CreateMessageWithId to match the struct better. 2013-08-13 17:01:38 -04:00
John C. Vernaleo
2e77f0bb0e Add CreateMessageWithId to allow custom id to be sent with message. 2013-08-13 14:39:56 -04:00
John C. Vernaleo
a456d195d6 Add JSONGetMethod to get method name from raw json reply. 2013-08-13 13:32:19 -04:00
John C. Vernaleo
96a68227bd 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.
2013-08-13 09:03:22 -04:00
John C. Vernaleo
c8bb6b304e Correct optional parameters for listsinceblock.
Fixes #3
2013-08-12 13:46:03 -04:00
John C. Vernaleo
dc2fe40a3d Fix comment typo noticed by jrick@ 2013-08-12 11:24:49 -04:00
John C. Vernaleo
da7e872354 Add proper result type for listunspent. 2013-08-09 15:49:31 -04:00
John C. Vernaleo
b28cded23e 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.
2013-08-09 14:06:45 -04:00
John C. Vernaleo
285faf8c75 Add additional commands to ones we know return data type.
getaccount and getnewaddress
2013-08-05 17:26:59 -04:00
John C. Vernaleo
f8fdabe53b Fix some error formatting from go vet. 2013-07-16 16:10:35 -04:00
John C. Vernaleo
3b6c9b6d78 Simplify some code and increase test coverage. 2013-07-16 16:05:38 -04:00
John C. Vernaleo
ed7214afda Add types for a few more commands.
Add types for getmininginfo, getrawmempool, stop, and settxfee along
with tests.
2013-07-16 15:49:31 -04:00
John C. Vernaleo
7a1a05d695 Clarify comment and add command to concrete type list. 2013-07-15 10:51:58 -04:00
John C. Vernaleo
a0dd367cd9 Add a few more commands with known types. 2013-07-12 12:39:12 -04:00
John C. Vernaleo
796df5b105 Tests and typos.
Increase test coverage.

Fix spelling and typos in a comment.

Minor update to todo in README.md
2013-07-12 11:04:00 -04:00
John C. Vernaleo
e3c9ebd26f Add more concrete types.
Add concrete return type for getaddressesbyaccount and make some of
the other command type handeling more explicit in the code.
2013-07-11 10:40:02 -04:00
John C. Vernaleo
86f848ddd4 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).
2013-07-08 17:20:41 -04:00
John C. Vernaleo
39cef5e76a Fix typo in command name getaddressesbyaccount.
Caught by jrick@
2013-07-08 17:12:16 -04:00
AndreasM
27b69ccca3 unhide error message from jsonRpcSend 2013-06-13 19:16:41 +03:00
John C. Vernaleo
4ab8ca5eef Add code to test for allowable types in json rpc id field along with test code for the new function. 2013-05-31 10:59:46 -04:00
AndreasM
7b4aeb2353 the JSON-RPC 1.0 spec allows the id to be of any type 2013-05-31 01:23:23 +03:00
Dave Collins
648e6317bb Fix comment typo -- implimented -> implemented. 2013-05-13 13:21:01 -05:00
John C. Vernaleo
d0d58c54db Initial implementation. 2013-05-13 12:25:41 -04:00