Commit graph

16 commits

Author SHA1 Message Date
Dave Collins
6c7f45fdb7 Add 2014 to copyright dates. 2014-01-08 23:44:08 -06:00
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
b4b7204a97 Remove BtcDecodeTxLoc since it has been replaced.
BtcDecodeTxLoc is no longer needed since it has been replaced by
DeserializeTxLoc.
2013-08-05 19:18:45 -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
90bf9e7449 Update tests for corrected max block payload size. 2013-07-27 15:32:36 -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
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
953a236e2a Add negative tests for MsgBlock.
This commit adds tests for the error paths when encoded and decoding
MsgBlock.
2013-05-10 09:12:46 -05:00
Dave Collins
135552cd72 Improve MsgBlock tests.
This commit corrects the tests so that the main API functions are tested
against the latest protocol version, but the TxSha and BlockSha functions
are run against the specific protocol version used to encode the test
data.  This will help future proof the tests against protocol changes.
2013-05-09 23:47:12 -05:00
Dave Collins
69b27dd5d3 Initial implementation. 2013-05-08 18:58:29 -05:00