Commit graph

228 commits

Author SHA1 Message Date
Dave Collins
f65ea832de Export a couple of peer-to-peer client errors.
ok @jcvernaleo
2014-03-12 10:11:18 -05:00
John C. Vernaleo
21b974e271 Fix missing ) in comment. 2014-02-20 10:52:06 -05:00
Dave Collins
81843d269f Add support for GetRawMempoolResult. 2014-02-16 14:02:24 -06:00
Dave Collins
6a2b93e622 Add support for GetPeerInfoResult. 2014-02-16 13:45:04 -06:00
Dave Collins
5135fd3203 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.
2014-02-11 17:44:48 -06:00
Dave Collins
a733633685 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
2014-02-11 16:45:48 -06:00
Dave Collins
cace9187d7 Correct typo in CmdGenerator comment. 2014-02-09 22:30:22 -06:00
Francis Lam
bfe374e735 Added comments for CmdGenerator and RegisterCustomCmdGenerator 2014-02-08 17:55:11 -05:00
Francis Lam
773efd633d Added RegisterCustomCmdGenerator to btcjson package
Allows for addition of custom Cmd classes that implement UnmarshalJSON
directly as opposed to via RawCmd object and RawCmdParser
2014-02-08 16:41:36 -05:00
Dave Collins
7623d13c37 Make getnetworkhashps result an int64. 2014-02-07 12:10:10 -06:00
Dave Collins
397c4caefe Correct getnettotals help message. 2014-02-05 10:51:59 -06:00
Dave Collins
4661be8758 Add support for GetNetTotalsResult.
ok @jcvernaleo
2014-02-05 09:43:25 -06:00
John C. Vernaleo
0d1539118b Add some missing comments on exported items. 2014-02-04 17:10:37 -05:00
David Hill
ae21689a57 gofmt 2014-02-04 16:13:24 -05:00
David Hill
25bb31ebd5 use bytes.Equal instead. 2014-02-04 15:40:16 -05:00
David Hill
ced679c4e5 Fix getreceivedby[account|address] api. The first parameter is not
optional.
2014-01-30 11:48:27 -05:00
David Hill
cbe4b140b9 Change the optional parameter for getrawtransaction from bool to int.
This matches bitcoind.

ok oga@
2014-01-29 21:19:07 -05:00
Dave Collins
6e2fa5aad7 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.
2014-01-24 22:41:52 -06:00
Dave Collins
421f4c54a0 Add support for GetAddedNodeInfoResult.
ok @jcvernaleo.
2014-01-24 14:50:34 -06:00
David Hill
4a93564b04 Add getwork result infrastructure. Make the work request optional. 2014-01-23 17:30:44 -05:00
David Hill
908945ed53 fix getwork API
closes #12
2014-01-23 15:55:52 -05:00
Owain G. Ainsworth
3c1bcb86ee add newsize parameter to keypoolrefill 2014-01-22 16:20:08 +00:00
Owain G. Ainsworth
99fdcf5d09 Add allowhighfees to SendRawTransactionCmd 2014-01-22 16:20:08 +00:00
Owain G. Ainsworth
5619604c21 Add addresses member to ListUnspentCmd 2014-01-22 16:20:08 +00:00
Owain G. Ainsworth
b677a421d0 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.
2014-01-22 16:20:08 +00:00
Dave Collins
bf90ed2142 Add 2014 to copyright dates. 2014-01-08 23:49:06 -06:00
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