Commit graph

3273 commits

Author SHA1 Message Date
Owain G. Ainsworth
7b08a4e127 Number of operations is per-script not per-transaction.
Reset the counter at the end of each script.
2013-06-18 17:44:18 +01:00
Owain G. Ainsworth
bc41004b03 Use errors.New() not fmt.Errorf() when no fmt string. 2013-06-18 17:44:15 +01:00
Owain G. Ainsworth
031437decf test 0 length numbers (disallowed) and coordinates of 0 (also) 2013-06-18 00:17:32 +01:00
Owain G. Ainsworth
13cf6091e6 Test the sanity checks for numbers too big for the curve fire correctly. 2013-06-17 23:58:47 +01:00
Owain G. Ainsworth
86d150bbb3 Remove accidentally commited printf. 2013-06-17 23:56:25 +01:00
Owain G. Ainsworth
316faf034c update test coverage stats. 2013-06-17 17:41:37 +01:00
Owain G. Ainsworth
afc2e8100a Make length check a little more paranoid
Remove trailing crap  from the tests (the hashtype) now that this is
correctly caught.
2013-06-17 17:38:16 +01:00
Owain G. Ainsworth
cd61efe8a8 test a bunch of invalid cases in ParseSignature. 2013-06-17 16:18:58 +01:00
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