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
5f971e10e6
Pre-allocate space for slices.
...
Several of the messages store the parts that have a variable number of
elements as slices. This commit modifies the code to choose sane defaults
for the backing arrays for the slices so when the entries are actually
appended, a lot of the overhead of growing the backing arrays and copying
the data multiple times is avoided.
Along the same lines, when decoding messages, the actual size is known and
now is pre-allocated instead of dynamically growing the backing array
thereby avoiding some overhead.
2013-09-25 14:38:28 -05:00
Dave Collins
335736e59f
Add new func NetAddressIPPort.
...
This function is a convenience method to create a new NetAddress
from a net.IP and uint16 port as opposed to a net.Addr which must be of
type *net.TCPAddr. This allows callers to support connection types that
don't provide access to a concrete *net.TCPAddr implementation.
2013-08-07 13:05:25 -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
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
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
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
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
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
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
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
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
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
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
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
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
72fa9f4b7b
Update test coverage report.
2013-05-10 10:18:34 -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
4aea957b19
Add negative tests for NetAddress.
...
This commit adds tests for the error paths when encoding and
decoding NetAddress with and without the timestamp field.
2013-05-09 23:01:09 -05:00
Dave Collins
2aee754448
Add test for discarding invalid large messages.
2013-05-09 22:25:21 -05:00
Dave Collins
aa4086a1b1
Update test coverage report.
2013-05-09 21:13:37 -05:00
Dave Collins
6286a39378
Combine readMessage with ReadMessage.
...
These functions used to be split into multiple files, but since the code
was reorganized there is no longer any reason to split them.
2013-05-09 20:16:46 -05:00
Dave Collins
5e416389b1
Add negative tests for MsgPing.
...
This commit add tests the error paths when encoding and decoding MsgPing.
2013-05-09 10:42:52 -05:00
Dave Collins
69b27dd5d3
Initial implementation.
2013-05-08 18:58:29 -05:00