Dave Collins
562bde6902
Use byte literals in tests to make go vet happy.
...
The go vet command complains about untagged struct initializers when
defining a ShaHash directly. This seems to be a limitation where go vet
does not exclude the warning for types which are a constant size byte array
like it does for normal constant size byte array definition.
This commit simply modifies the tests to use a constant definition cast to a
ShaHash to overcome the limitation of go vet.
2013-07-27 15:55:06 -05:00
Dave Collins
90bf9e7449
Update tests for corrected max block payload size.
2013-07-27 15:32:36 -05:00
Dave Collins
9989865fa2
Use correct max block payload size.
...
The maximum block payload size is actually 1000000 bytes, not 1MB.
2013-07-27 15:25:05 -05:00
Dave Collins
ea3107d962
Add comments and doco to clairfy test networks.
...
There was not much documentation about the difference between testnet and
testnet3, so make it clear that testnet is used for regression tests and
testnet3 is the public test network (version 3).
2013-07-25 19:04:58 -05:00
Dave Collins
4e6b649be6
Add constant for regression test netowrk port.
2013-07-25 19:04:02 -05:00
Dave Collins
60dfddc9d0
Use common coinbase transaction for Genesis blocks.
...
Since the same coinbase transaction is used for the genesis blocks of
all three currently supposed networks, separate it into its own var and
use a reference to it in each of the genesis block defintions.
2013-07-24 09:09:18 -05:00
Dave Collins
ab064fd4d4
Add tests for genesis block of testnet (version 3).
2013-07-24 01:47:11 -05:00
Dave Collins
166123ae79
Add genesis block for the test network (version 3).
2013-07-24 01:45:30 -05:00
Dave Collins
b8f80da512
Add tests for genesis block of regression testnet.
2013-07-24 01:33:24 -05:00
Dave Collins
a90a8bf341
Add genesis block for the regression test network.
2013-07-24 01:32:43 -05:00
Dave Collins
65eae18285
Remove a couple of incorrect comments.
2013-07-24 00:35:16 -05:00
Dave Collins
d54fba85b4
Export the MaxBlockPayload constant.
...
Although you can technically get at this value via the MaxPayloadLength
function on a block, it is less overhead for any consumers that need to
know the value to simply export it directly.
2013-06-20 13:09:44 -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
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
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
Dave Collins
f8553b4a57
Remove test coverage TODO since it's now 100%.
2013-05-13 13:55:07 -05: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
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