Commit graph

62 commits

Author SHA1 Message Date
Dave Collins
ed76ff2172 Add BIP0023 block proposal fields.
This commit adds the optional block proposal fields defined by BIP0023 to
the GetBlockTemplateResult and TemplateRequest types.

ok @jcvernaleo
2014-06-27 13:03:00 -05:00
Dave Collins
b5db9fb485 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
2014-06-27 13:02:46 -05:00
Dave Collins
5290cb1186 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
2014-06-27 13:02:11 -05:00
Dave Collins
dc84f95fe9 Name field WorkID to make golint happy. 2014-06-27 00:30:37 -05:00
Josh Rickmar
00874b6ec2 Unmarshal correct lockunspent outpoints parameter. 2014-06-23 16:51:21 -05:00
Dave Collins
370899e1fc Change RawTxInput.Vout to uint32 as well.
This was missed by the previous commit.
2014-06-16 15:49:40 -05:00
Dave Collins
b585d4e3a0 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
2014-06-16 14:44:04 -05:00
Dave Collins
ac5cc1d64e Use default genproclimit of -1 on setgenerate RPC.
The correct default for the genproclimit on the setgenerate RPC is -1.

ok @jcvernaleo.
2014-06-12 14:23:38 -05:00
Josh Rickmar
65c0570234 Remove SetId from Cmd interface. 2014-06-11 12:01:05 -05:00
David Hill
39b09f7be1 Add support for estimatefee and estimatepriority. 2014-06-11 11:05:13 -04:00
David Hill
529036ec2b Implement getnetworkinfo 2014-05-14 11:45:13 -04:00
David Hill
4f0eb662c8 Support getblockchaininfo 2014-05-12 12:53:34 -04:00
Josh Rickmar
3fd5904859 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.
2014-04-25 01:04:24 -05:00
Dave Collins
31a354e585 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
2014-04-11 14:27:59 -05:00
Dave Collins
1ff465ae88 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
2014-04-11 09:38:15 -05:00
Dave Collins
016e69cd51 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
2014-04-10 20:59:46 -05: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
John C. Vernaleo
0d1539118b Add some missing comments on exported items. 2014-02-04 17:10:37 -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
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
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
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
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
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
708dce8d99 Fix sendmany optarg parsing and add tests. 2013-11-27 19:27:46 -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
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
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
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