Title: varint in client version 3210 not according to spec? Post by: Martin P. Hellwig on June 14, 2011, 11:24:52 PM Hi all,
As I am rebuilding the protocol in python and testing it out with some tcpdumps gathered with the official client, I noticed that my client (version 3210) on a getdata message sends out the wrong count. The offending hex is: FD9A01 After investigating I found that for this particular example my count is 663 while the actual entries are 410 According to the spec, varint should do: <= 0xffff 3 0xfd + uint16_t So what it seems to do is only setting the total value in the next two bytes without subtracting 253 of it. Is this a known error in this older build and is it solved in a newer version (I am on FreeBSD btw)? On a side note, is this forum the appropriate media to report such unconfirmed things or should I shout somewhere else, perhaps a more stable medium? Cheers and Thanks, Martin Title: Re: varint in client version 3210 not according to spec? Post by: ByteCoin on June 15, 2011, 12:02:32 AM According to the spec, varint should do: <= 0xffff 3 0xfd + uint16_t So what it seems to do is only setting the total value in the next two bytes without subtracting 253 of it. The mainstream client is the only spec that matters at the moment. From serialize.h Code: void WriteCompactSize(Stream& os, uint64 nSize) So yes, small numbers have multiple representations. ByteCoin Title: Re: varint in client version 3210 not according to spec? Post by: joan on June 15, 2011, 09:18:33 AM According to the spec, varint should do: <= 0xffff 3 0xfd + uint16_t So what it seems to do is only setting the total value in the next two bytes without subtracting 253 of it. Not a bug. The "+" here is meant as concatenation of bytes. One byte with 0xFD, then 2 bytes with the value. Title: Re: varint in client version 3210 not according to spec? Post by: Martin P. Hellwig on June 15, 2011, 11:45:47 AM Ah yes makes perfect sense. Thank you (both)
|