Commit graph

10 commits

Author SHA1 Message Date
Dave Collins
d1edbf1f0b Add tests to exercise intential malicious overflow.
This commit adds several tests which intentionally attempt to feed
malicious data to the various deserialize functions.
2013-10-25 08:57:39 -05:00
Dave Collins
e7f808378e Make max payload for a transaction max block size.
The maximum payload for a transaction is limited to the size of a block
rather than the maximum payload for a given message.
2013-09-19 16:46:14 -05:00
Dave Collins
d90740728e Remove protocol version param from BlockSha/Txsha.
Both of these depend on the serialized bytes which are dependent on the
version field in the block/transaction.  They must be independent of the
protocol version so there is no need to require it.
2013-08-05 18:08:57 -05:00
Dave Collins
dea1bac359 Add negative tests for Serialize/Deserialize funcs.
This commit adds tests for the error paths when serializing and
deserializing MsgBlock and MsgTx.
2013-08-05 18:08:40 -05:00
Dave Collins
29eb4d4250 Add tests for new Serialize/Deserialize functions. 2013-08-05 18:08:26 -05:00
Dave Collins
bfbc08beed Allow var defs to infer type from right-hand side.
Found by golint.
2013-07-27 16:10:38 -05:00
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
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
69b27dd5d3 Initial implementation. 2013-05-08 18:58:29 -05:00