Commit graph

3525 commits

Author SHA1 Message Date
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
Dave Collins
5b78dee7e1 Add negative tests for MsgTx.
This commit adds tests for the error paths when encoding and decoding
MsgTx.  This commit also achieves 100% test coverage.
2013-05-13 02:09:55 -05:00
Dave Collins
6f511eb75d Make MsgTx test data available to all funcs.
Rather than having to repeat the same data for positive and negative
tests, make the same test data available to both.
2013-05-13 02:08:14 -05:00
Dave Collins
f9b6375d5b Add negative tests for MsgVersion.
This commit adds tests for the error paths when encoding and decoding
MsgVersion.
2013-05-12 21:47:36 -05:00
Dave Collins
3aef93f442 Make MsgVersion test data available to all funcs.
Rather than having to repeat the same data for positive and negative
tests, make the same test data available to both.
2013-05-12 21:01:40 -05:00
Dave Collins
1bab947596 Remove a few dead error checks.
The functions for generating transaction and block hashes contained a few
error checks for conditions which could never fail without run-time
panics.  This commit removes those superfluous checks and adds explanatory
comments.
2013-05-12 14:01:50 -05:00
Dave Collins
1ca8015ea0 Add negative tests for MsgBlock tx location decode.
This commit adds tests for the error paths when decoding MsgBlock via the
transaction location decode variant.
2013-05-12 12:48:52 -05:00
Dave Collins
0e033023bf Improve MsgBlock negative tests.
Rather than decoding from a zero-filled buffer, use valid block encoded
test data.
2013-05-12 12:43:01 -05:00
Dave Collins
4e16030fe8 Add tests for MsgBlock transaction location decode. 2013-05-12 11:52:35 -05:00
Dave Collins
c9d2dfea3d Add negative tests for WriteMessage.
This commit adds tests for the error paths when writing a message
to the wire.
2013-05-11 23:34:10 -05:00
Dave Collins
0400d0cec3 Remove dead error check in WriteMessage.
The io.Writer.Write function always returns an error if the bytes written
is less than provided, so there is no reason to further check if the
payload length matches after a successful write.
2013-05-11 23:22:09 -05:00
Dave Collins
7385f6ff24 Correct several test error messages. 2013-05-11 12:55:50 -05:00
Dave Collins
93070ef960 Add negative tests for MsgAlert.
This commit adds tests for the error paths when encoding and decoding
MsgAlert.
2013-05-11 12:49:22 -05:00
Dave Collins
3d303feefb Add negative test for NewShaHash.
This commit adds a test to ensure NewShaHash fails as expected when the
passed buffer has too many bytes to be a valid sha hash.
2013-05-11 11:19:46 -05:00
Dave Collins
61b86b1bb5 Add negative tests for MsgGetBlocks.
This commit adds tests for the error paths when encoded and decoding
MsgGetBlocks.
2013-05-11 11:06:52 -05:00
Dave Collins
2a2745d0d3 Add negative tests for MsgGetHeaders.
This commit adds tests for the error paths when encoded and decoding
MsgHeaders.   Also, while here modify the casing of the local vars to be
consistent.
2013-05-11 10:52:22 -05:00
Dave Collins
20bebc13a5 Convert WriteMessage errors to MessgeError type. 2013-05-11 02:29:29 -05:00
Dave Collins
cbcbe5eb43 Convert MsgVersion errors to MessageError type. 2013-05-11 02:23:45 -05:00
Dave Collins
f6cdbd430e Convert MsgMemPool errors to MessageError type. 2013-05-11 02:18:03 -05:00
Dave Collins
bd1dcf8a0c Convert MsgGetBlocks errors to MessageError type. 2013-05-11 02:15:50 -05:00
Dave Collins
9bd97a5972 Convert MsgGetHeaders errors to MessageError type. 2013-05-10 23:58:10 -05:00
Dave Collins
95aa4a7da8 Add negative tests for MsgHeaders.
This commit adds tests for the error paths when encoded and decoding
MsgHeaders.
2013-05-10 23:12:55 -05:00
Dave Collins
40a9a90e4b Convert MsgHeaders errors to MessageError type. 2013-05-10 23:10:59 -05:00
Dave Collins
88e1d7634f Add negative tests for MsgPong.
This commit adds tests for the error paths when encoded and decoding
MsgPong.
2013-05-10 21:46:41 -05:00
Dave Collins
cbb28edb30 Convert MsgPong errors to MessageError type. 2013-05-10 21:31:56 -05:00
Dave Collins
1220e72f35 Add negative tests for MsgAddr.
This commit adds tests for the error paths when encoded and decoding
MsgAddr.
2013-05-10 18:09:10 -05:00
Dave Collins
cfb17f7da4 Update gocov path in comments to correct path. 2013-05-10 15:58:05 -05:00
Dave Collins
e699ca0bef Cleanup a few comments. 2013-05-10 15:40:09 -05:00
Dave Collins
d5f4e5e989 Initial commit. 2013-05-10 15:06:18 -05:00
Dave Collins
1f72b40823 Convert MsgAddr errors to MessageError type. 2013-05-10 14:54:36 -05:00
Dave Collins
72348986c9 Correct func prefix in GetData error message. 2013-05-10 13:37:55 -05:00
Dave Collins
2665b4358e Add negative tests for MsgGetData.
This commit adds tests for the error paths when encoded and decoding
MsgGetData.
2013-05-10 13:14:19 -05:00
Dave Collins
7c3129bf89 Convert MsgGetData errors to MessageError type. 2013-05-10 13:04:20 -05:00
Dave Collins
0c65e7da89 Add negative tests for MsgNotFound.
This commit adds tests for the error paths when encoded and decoding
MsgNotFound.
2013-05-10 12:51:45 -05:00
Dave Collins
9b798b6306 Convert MsgNotFound errors to MessageError type. 2013-05-10 11:32:20 -05:00
Dave Collins
e41a3bcaf3 Correct a couple of func prefixes in err messages. 2013-05-10 11:31:06 -05:00
Dave Collins
d33fdb2c3c Add additional doco on how btcwire relates to btcd. 2013-05-10 11:04:30 -05:00
Dave Collins
29cd3a7246 Fix comment typo in test coverage report script. 2013-05-10 10:31:39 -05:00
Dave Collins
72fa9f4b7b Update test coverage report. 2013-05-10 10:18:34 -05:00
Dave Collins
59d64ee076 Add negative tests for MsgInv.
This commit adds tests for the error paths when encoded and decoding
MsgInv.
2013-05-10 10:14:13 -05:00
Dave Collins
036f14ff49 Convert MsgInv errors to new MessageError type. 2013-05-10 10:12:45 -05:00