Commit graph

6 commits

Author SHA1 Message Date
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