Details
- Reviewers
deadalnix schancel - Group Reviewers
Restricted Project - Commits
- rSTAGING144714e17f1c: Add nTimeReceived to CBlockIndex for tracking recevied time of blocks
rABC144714e17f1c: Add nTimeReceived to CBlockIndex for tracking recevied time of blocks
make check
Diff Detail
- Repository
- rABC Bitcoin ABC
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
src/chain.h | ||
---|---|---|
323 ↗ | (On Diff #3505) | Maybe it's better to put the 'right' value for the field when deserializing ? |
Also, we should probably serialize/deserialize this from disk as well, but this can wait.
src/chain.h | ||
---|---|---|
237 ↗ | (On Diff #3505) | Move this below nSequenceId for better alignment. Putting it here adds 4 bytes of padding above it in the struct. You can see by inspecting (char*)(&block_index.nTimeReceived) - (char*)(&block_index) with nTimeReceived in this location or below. On my machine, the offset is the same. Optimizing alignment on this struct is important because there are many of them stored in memory all the time. |
T196 appears to be the beginning of this discussion. Please comment if you have any additional thoughts.
src/chain.h | ||
---|---|---|
237 ↗ | (On Diff #3505) | Good callout. Fixed. |
323 ↗ | (On Diff #3505) | By deserializing, I assume you mean in the constructor that takes CBlockHeader as input, since I couldn't find any other deserialization functions for CBlockIndex. Done. This also means that nTimeReceived being 0 would be easier to debug since it's expect to be set when a new CBlockIndex is initialized from a non-CBlockHeader source. I think this is a good thing. |
For de-serialization, I see that it comes from the block header (only the block header is serialized/deserialized), so there is no way to do what I wanted, at least not easily. So let's not block that diff for it.
src/chain.h | ||
---|---|---|
323 ↗ | (On Diff #3505) | Ok. |