Commit graph

3565 commits

Author SHA1 Message Date
Owain G. Ainsworth
5c8c454a18 fix up some indexing in ParseSignature.
a test i was working on was crashing this otherwise. Make length checks more
paranoid.
2013-06-17 16:18:27 +01: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
John C. Vernaleo
21d1240502 Update test_coverage.txt 2013-06-14 11:36:44 -04:00
John C. Vernaleo
e4a80edc95 Clean the error message on connect failure so username and password is not shown. 2013-06-14 11:32:05 -04:00
Owain G. Ainsworth
9cb1f47fb9 add signature test harness and try a valid signature for size.
error paths to come.
2013-06-14 01:11:06 +01:00
Owain G. Ainsworth
7cfebed976 Test the ``parameter is >= P'' pubkey error paths. 2013-06-14 00:28:54 +01:00
Owain G. Ainsworth
9638528b8e test hybrid keys too.
Nothing that I know of uses them, but if we have the code path we should
be pretty sure it works.
2013-06-14 00:06:25 +01:00
Owain G. Ainsworth
217fa5311a go fmt. *sigh* 2013-06-14 00:03:15 +01:00
Owain G. Ainsworth
ffdbcd5cce test a few easy to hit pubkey error paths. 2013-06-13 23:55:52 +01:00
Dave Collins
2a8cf9f44f Use correct import path for btcec. 2013-06-13 15:18:58 -05:00
Dave Collins
1197770159 Initial implementation. 2013-06-13 14:59:46 -05:00
Dave Collins
6e9cc57131 Initial implementation. 2013-06-13 14:38:54 -05:00
Dave Collins
a2c10e34d9 Initial commit. 2013-06-13 12:45:48 -05:00
AndreasM
27b69ccca3 unhide error message from jsonRpcSend 2013-06-13 19:16:41 +03:00
Dave Collins
63af0dbca9 Initial commit. 2013-06-12 16:22:01 -05:00
Steven Roose
2c0dc2d862 Small errors in documentation.
I could not resist while reading.
2013-06-01 00:09:26 +02:00
Dave Collins
10d981974c Add documentation for functions and types. 2013-05-31 15:19:34 -05:00
Dave Collins
8d8fdf4fc1 Add documentation for Db interface. 2013-05-31 15:12:42 -05:00
Dave Collins
5882b3c79a Change Tx to transaction in user facing error. 2013-05-31 14:07:48 -05:00
Dave Collins
64568826f1 Correct spelling of nonexistent. 2013-05-31 14:04:14 -05:00
Dave Collins
b686bbacf5 Update and fix usage example.
This commit updates the usage example as follows:

- Add a defer db.Close since the database should be closed after the
  caller is done with it
- Correct the import path for the btcdb/sqlite3 package
- Add a db extension to the example database name
- Make the error handling and comments match the standard style
2013-05-31 13:57:18 -05:00
Dave Collins
fac055c24e Add comments to clarify interface function caching.
This commit attempts to clarify which functions in the Db interface may be
returning cached data that the InvalidateCache, InvalidateBlockCache, and
InvalidateTxCache functions are used to clear.
2013-05-31 13:40:38 -05: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
Dave Collins
7416e9a71d Rename funcs and variables for Idx to Height.
The Db interface is intended to work with block heights as opposed to
specific database ids which may or may not be the same as the block
height.  This commits changes the function names to make that distinction
a little more clear.
2013-05-30 17:35:59 -05: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
bea4ccbeef Finish incomplete comment. 2013-05-30 17:21:15 -05:00
Dave Collins
684582cde6 Cleanup the Db interface comments a bit. 2013-05-30 17:18:43 -05:00
Dave Collins
e76c83b27f Fix typo in README.md. 2013-05-29 18:11:27 -05:00
Dave Collins
b4e38662ba Update README.md. 2013-05-29 16:43:05 -05:00
Dave Collins
6ac2a9b934 Add note to README.md that Db interface may change. 2013-05-29 16:41:51 -05:00
Dave Collins
f6c3d6d57a Fix typo in README.md. 2013-05-29 16:36:45 -05:00
Dave Collins
c97c8f17a4 Add test coverage report and generate script.
Both of these items were referenced in the README.md, but were not
in the repository.
2013-05-29 16:20:06 -05:00
Dave Collins
e30ceb5947 Cleanup and fix operational tests.
This commit makes several changes to the operation tests as follows:

- Ensure the database is closed between each operational mode test as
  otherwise  the database is locked when trying to reopening it which
  makes it unusable
- Make the insert tests error after a single failure since every test
  afterwards is guaranteed to fail as well
- Remove some of the logging statements which cluttered up the failed test
  prints making it harder to see why a given test failed
- Make a couple of the log messages more descriptive
2013-05-29 16:11:13 -05:00
Dave Collins
9bf708595d Add InsertBlockData needed by tests to interface.
The function is being added back in since the tests rely on it, but it is
marked as DEPRECATED since it really should not be a part of the public
generic db interface.
2013-05-29 15:30:26 -05:00
Dave Collins
21b8011155 Remove log setup from tests as they don't need it. 2013-05-29 14:49:21 -05:00
Dave Collins
1846307821 Use correct import path in btcdb tests. 2013-05-29 14:48:18 -05:00
mischief
7630a95724 fix Stringer interface for ShaHash.
http://golang.org/ref/spec#Method_sets for why this is necessary
2013-05-29 11:51:13 -07:00
Owain G. Ainsworth
a2e3fd92b0 Only try to drop the uniquetx index if it exists.
Solves a corner case after a crash.
2013-05-29 17:54:46 +01:00
Dave Collins
752ca5dfbb Initial implementation. 2013-05-29 10:09:26 -05:00
Dave Collins
a02af039b5 Initial commit. 2013-05-28 19:03:53 -05:00
Dave Collins
14a1da417f Enforce max block payload size of 1MB.
This commit changes MsgBlock to enforce a 1MB max payload per the spec.
Previously it was only limited to the max overall message size.  While
here, also enforce max payloads per message type (instead of only the max
overall message payload) when writing messages.
2013-05-16 09:07:04 -05:00
Dave Collins
c896d61625 Improve examples in package overview documentation.
This commit makes the examples a little more clear by providing complete
examples of the two different types of replies.  These changes were
prompted by PaulCapes on IRC who pointed out the previous example was not
very clear.

ok jcv@
2013-05-15 19:35:36 -05:00
Dave Collins
d8007e9387 Update README to reflect 100% test coverage. 2013-05-15 14:00:06 -05:00
Dave Collins
c164de1692 Fix version typos in README. 2013-05-15 13:57:29 -05:00
John C. Vernaleo
2fc8982be5 Add tests for MarshallAndSend function. 2013-05-15 10:08:05 -04:00
Dave Collins
f8553b4a57 Remove test coverage TODO since it's now 100%. 2013-05-13 13:55:07 -05: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
Dave Collins
a3226897f0 Update package overview Errors section.
Now that all errors are either underlying IO errors or of type
MessageError, update the package overview documentation accordingly.
2013-05-13 02:19:57 -05:00