meritlabs / merit

Merit aims to be the world's most adopted digital currency.
https://www.merit.me
MIT License
192 stars 20 forks source link

Fix for windows checksum failure. #336

Closed mempko closed 6 years ago

mempko commented 6 years ago

Serializing cpp_dec_float_50 using a byte dump was not a good idea because random padding in the data structure was stored on disk.

Of course, the padding was different in memory when the CBlockUndo was serialized using the CHashWriter causing the hash to be different than what was computed from the data serialized to disk.

This commit explicitly zeros out the padding so that the serialization is backward compatible but also consistent.

We will want to change this serialization in the future. In the meantime I added static asserts to make sure any change in the data structure will cause compilation failures.