frankh/nano

MessageHeader uses incorrect extensions size?

paulmelis opened this issue · 1 comments

I was working on parsing the UDP packets being sent on the Nano network (not related to your implementation). I seem to get some malformed package headers, with respect to the extensions field, although it's hard to tell without a clear specification.

Reading the Nano code, specifically https://github.com/nanocurrency/raiblocks/blob/8caed829b461b015141d2dcd57d9b3457ba0f7f0/rai/node/common.cpp#L53, it seems the extensions field uses 2 bytes. But in your code,

Extensions byte
, I see you use 1 byte. Have you tested your code on the actual packets flying around, and did it parse them correctly?

Ah, I now see what's going: the block type is stuffed in 8 bits of the extensions value (https://github.com/nanocurrency/raiblocks/blob/8caed829b461b015141d2dcd57d9b3457ba0f7f0/rai/node/common.cpp#L33)