Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: 0x6763 on January 13, 2011, 05:21:52 PM



Title: Bug? - getaddr command contains checksum despite having no payload
Post by: 0x6763 on January 13, 2011, 05:21:52 PM
This is part of a packet from the current 0.3.19 linux client:

Code:
0000   F9 BE B4 D9 67 65 74 61  64 64 72 00 00 00 00 00   ....getaddr.....
0010   00 00 00 00 5D F6 E0 E2                            ....]...

It is my understanding that if there is no payload, there should be no checksum.  Is my understanding correct and this is a bug?


Title: Re: Bug? - getaddr command contains checksum despite having no payload
Post by: Cdecker on January 13, 2011, 06:38:56 PM
I had the same problem, but yes the checksum for an empty message (byte[0]) is 0x5DF6E0E2 so that's correct :D Useless but correct.


Title: Re: Bug? - getaddr command contains checksum despite having no payload
Post by: 0x6763 on January 13, 2011, 07:02:55 PM
I had the same problem, but yes the checksum for an empty message (byte[0]) is 0x5DF6E0E2 so that's correct :D Useless but correct.

Yeah, I was able to work around it without a problem.  I asked about this in IRC a day or two ago, but no one had anything useful to say about it, so I figured I'd bring it up in the forum, so if it is a bug (seems to be no reason for it to be there), that it could get fixed.  Otherwise it might cause some problems for other people working on their own Bitcoin implementations.  I made a note about it in the wiki:

https://en.bitcoin.it/wiki/Protocol_specification#getaddr


Title: Re: Bug? - getaddr command contains checksum despite having no payload
Post by: Cdecker on January 14, 2011, 01:02:21 AM
Well to be precise there are quite a few messages without payload that have checksums (see ping for example) I don't think this should be labeled as a bug, it's simpler not to have a special case for empty payload messages when stripping the message header :-)


Title: Re: Bug? - getaddr command contains checksum despite having no payload
Post by: 0x6763 on January 14, 2011, 02:21:33 AM
Well to be precise there are quite a few messages without payload that have checksums (see ping for example) I don't think this should be labeled as a bug, it's simpler not to have a special case for empty payload messages when stripping the message header :-)

So do all messages (except 'version' and 'verack') contain checksums regardless of whether or not they have a payload?


Title: Re: Bug? - getaddr command contains checksum despite having no payload
Post by: Cdecker on January 14, 2011, 01:43:11 PM
Yup


Title: Re: Bug? - getaddr command contains checksum despite having no payload
Post by: 0x6763 on January 14, 2011, 01:44:21 PM
Yup

Interesting, thanks.