Commit graph

102 commits

Author SHA1 Message Date
John C. Vernaleo
6747e36f51 Slight increase in test coverage. 2014-01-08 10:31:54 -05:00
John C. Vernaleo
d1efe0c109 Add SetId() to Cmd along with tests. 2014-01-08 09:36:43 -05:00
John C. Vernaleo
ee378dc0c0 Add additional tests for listreceivedbyaccount.
Fix bug caught by tests.
2014-01-07 13:49:45 -05:00
John C. Vernaleo
cea1120a0a Add tests for listreceivebyaddress.
Fix bug with minconf type caught by test (thanks oga).
2014-01-07 13:44:12 -05:00
John C. Vernaleo
5ced990c22 Add test for listsinceblock.
Fix bug in listsinceblock found by test.
2014-01-06 11:02:32 -05:00
John C. Vernaleo
0ef1452247 Improve test coverage a bit.
Fix bug in a json command caught by new test.
2014-01-06 10:40:23 -05: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
John C. Vernaleo
258e9ef4c6 Add test for the Cmd.Id() functions. 2014-01-03 17:50:17 -05:00
John C. Vernaleo
2944ccb86b Update coverage report. 2014-01-03 12:02:41 -05:00
Dave Collins
84cb4c7130 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.
2014-01-03 10:25:06 -06:00
Dave Collins
8d7354f45b Gofmt. 2014-01-03 10:22:07 -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
1f52db626d Update test coverage. 2013-12-11 13:43:18 -05:00
John C. Vernaleo
4d0cbb776b Make id omitemtpy to match spec better. 2013-12-11 13:42:29 -05:00
Dave Collins
621f9006bf Correct tests for recent getblock updates. 2013-12-10 17:13:42 -06:00
Dave Collins
8a132ffde8 Add support for TravisCI.
Also add TravisCI build status badge to README.md.
2013-12-10 16:30:47 -06: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
Josh Rickmar
6325bd9df2 Update test coverage file. 2013-11-27 19:30:13 -05:00
Josh Rickmar
708dce8d99 Fix sendmany optarg parsing and add tests. 2013-11-27 19:27:46 -05:00
Josh Rickmar
97a4ab6a47 Update test coverage file. 2013-11-26 16:12:54 -05:00
Josh Rickmar
368d6c0779 Fix optarg handling for listtransactions and add tests. 2013-11-26 16:08:31 -05:00
Josh Rickmar
79fe2e594b Fix a typo. 2013-11-22 12:22:07 -05:00
Dave Collins
a645c36f45 Add new extension command named debuglevel.
ok @jcvernaleo.
2013-11-22 10:16:45 -06:00
John C. Vernaleo
7397dd6896 Rename reqSig to reqSigs
Match bitcoin json name better.

Closes #9
2013-11-22 08:48:02 -05:00
Josh Rickmar
fa2bf4423e Add additional tests for importprivkey. 2013-11-20 11:08:20 -05:00
Josh Rickmar
8d9b8fcf82 Make importprivkey rescan optarg default to true. 2013-11-19 15:26:47 -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
Josh Rickmar
9dbf75029f ReScan -> Rescan 2013-11-18 09:13:02 -05:00
Owain G. Ainsworth
d20f958c92 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.
2013-11-12 20:54:08 -06:00
John C. Vernaleo
94e74e7cc7 Increase test coverage for Cmd. 2013-11-12 16:33:58 -05:00
John C. Vernaleo
d341468b87 Add a test that was missed. 2013-11-12 12:49:22 -05:00
Josh Rickmar
f689789be8 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.
2013-11-12 12:36:57 -05:00
Josh Rickmar
d3dea375c6 Fix SendManyCmd unmarshaling.
This change fixes an incorrect parameter length check, as well as
correcting the type assertions for the address to amount pairs.
2013-11-12 11:24:33 -05:00
Owain G. Ainsworth
56a62309ae Add some error messages to be used by btcd.
ok jcv
2013-11-05 22:35:06 +00:00
John C. Vernaleo
815a0b0a84 Improve test coverage. 2013-11-01 15:27:17 -04:00
John C. Vernaleo
3f33e419a9 Improve test coverage and fix bug found by tests.
Spell receive the same way all the time so things work.
2013-10-31 14:51:35 -04:00
John C. Vernaleo
e1dd773e7c 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.
2013-10-30 17:22:56 -04:00
John C. Vernaleo
07de6ea013 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.
2013-10-30 08:29:59 -04:00
Josh Rickmar
334a1c1f20 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.
2013-10-29 23:22:16 -04:00
Owain G. Ainsworth
c4be414921 Make ParseMarshaledCmd return a known error if the type isn't known. 2013-10-29 22:33:44 +00:00
Owain G. Ainsworth
e396121192 More info commands. 2013-10-25 20:02:13 +01:00