Commit graph

60 commits

Author SHA1 Message Date
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
Owain G. Ainsworth
711f229487 add getmininginfo to switch and move to alphabetical order.
more tests.
2013-10-25 19:50:39 +01:00
Owain G. Ainsworth
0daf04f9bd More get commands. 2013-10-25 19:42:25 +01:00
John C. Vernaleo
00382bed8d Adding to tests.
Fix typo in a test name.

Update coverage report.
2013-10-25 14:16:29 -04:00
Owain G. Ainsworth
020444906b Getblockhash and getblock template
Fix some type wranging in unmarshal for getblocktemplate
2013-10-25 19:00:33 +01:00
Owain G. Ainsworth
ebc4c17162 Add basic test for getbestblockhash.
And move the getblock/getblockcount so they are in order.
2013-10-25 18:36:27 +01:00
Owain G. Ainsworth
d1ac7b9384 getaddressesbyaccoutn and getbalance test.
and one bug in the marshalling code for getbalance
2013-10-25 18:32:51 +01:00
Owain G. Ainsworth
fedafbdd49 go fmt 2013-10-25 18:23:53 +01:00
Owain G. Ainsworth
b3b8b37855 test and fix bugs in getaddednodeinfo 2013-10-25 18:23:28 +01:00
Owain G. Ainsworth
77316a003a fix method for getaccountaddress.
and test dumpprivkey, dumpwallet, encryptwallet, getaccount and
getaccountaddress
2013-10-25 17:47:11 +01:00
Owain G. Ainsworth
bac5600145 basic functionality test for decoderawtransactioncmd 2013-10-25 17:22:07 +01:00
Owain G. Ainsworth
6227c446d3 Add a framewowrk for parsing and creating json commands.
Initial prototype for one command mostly from jrick, with discussion
with me and jcv.  Other commands mocked up in a couple of long boring days by
yours truly.

Code isn't fully tested yet so may well still be buggy in the type conversions.
Test will be added over the next few days to get this up to snuff.
2013-10-25 17:10:39 +01:00
John C. Vernaleo
cbd3d730a9 Add initial support for submitblock command.
Closes #7
2013-10-22 15:11:01 -04:00
John C. Vernaleo
9ddb768c47 Define errors.
Define errors (previously done in btcwallet and btcd's rpcserver) in
one place so they can just be called by name rather than generated in
code using btcjson.

Closes #5
2013-10-22 12:25:54 -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
b0ca6d5903 Fix typo in comment. 2013-08-15 10:15:25 -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
39a1be8682 Increase test coverage. 2013-07-11 10:15:27 -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
Dave Collins
10542e0573 Optimize and improve credential stripping code.
Since we already have the specific username and password we want to strip
from errors, use a specific search string rather than a generic regular
expression.  This is quite a bit more efficient than using regular
expressions and also has the benefit of being more accurate.

Also, rather than using the added overhead of fmt to convert the error to
a string, just call Error() directly on it to get the string.

Finally, instead of just stripping it, replace it with the literal
string "<username>:<password>" to avoid any possible confusion in the
error messages where it might otherwise appear the url was being
constructed incorrectly.

ok jcv@
2013-06-14 11:32:50 -05:00
John C. Vernaleo
2a475d7299 Need to test for nil before regex. 2013-06-14 11:47:09 -04:00