Commit graph

8 commits

Author SHA1 Message Date
Dave Collins
937374c95a Cleanup and finish relay transaction work.
- Coalesce the new bytes into the max message size constant to stay
  consistent
- Correct optional relay tx field handling
- Rename the relay transactions field to DisableRelayTx so the zero value
  of false has the correct default behavior
- Add tests for new bool fast paths in read/writeElement
- Stay consistent with version order in tests
- Add a single entry to TestVersionWire to test the new functionality
  instead of adding a whole new TextVersionRelayTx function.
- Use BIP0037 in tests instead of hard coding 70001
- Nuke XXX that 70001 is different since this is handled now
- Fix and cleanup some comments
- Update test coverage report
2014-03-31 11:35:36 -05:00
David Hill
e9a18fb14c Support RelayTx param in ver message for 70001+.
This commit adds support for the version message RelayTx parameter for
protocol version 70001+ as added by BIP0037.
2014-03-30 23:43:18 -05:00
Dave Collins
c917899303 Allow optional fields in MsgVersion decode.
This commit modifies the MsgVersion.BtcDecode function to match the
behavior where fields after the first address field (AddrYou) are optional
and only read if the buffer contains remaining bytes.

Unfortunately this means the reader for MsgVersion.BtcDecode must be a
*bytes.Buffer or an error is returned.  This is not an issue for the vast
majority of cases since all of the message reading code which is the main
way messages are read is already using a *bytes.Buffer, however, this
change might affect external callers if they are doing something special
with custom readers.

Fixes #14.
2014-03-30 15:56:52 -05:00
Dave Collins
e5d15b0fa8 Export MaxVarIntPayload. 2014-03-11 20:09:55 -05:00
Dave Collins
13e0b0e7b9 Limit generated timestamps to one second precision.
This commit changes all cases which generate default timestamps to
time.Now to limit the timestamp to one second precision.  The code which
serializes and deserializes timestamps already does this, but it is useful
to make sure defaults don't exceed the precision of the protocol either.

With this change there is less chance that developers using defaults will
end up with structures that have a higher time precision than what will
ultimately be sent across the wire.
2014-02-24 09:55:02 -06:00
Dave Collins
6c7f45fdb7 Add 2014 to copyright dates. 2014-01-08 23:44:08 -06:00
Dave Collins
cbcbe5eb43 Convert MsgVersion errors to MessageError type. 2013-05-11 02:23:45 -05:00
Dave Collins
69b27dd5d3 Initial implementation. 2013-05-08 18:58:29 -05:00