Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Jul 10, 2014

clang-format cannot deal with it, and, admittedly, it's way too big anyway.

In order not to duplicate the writing logic for computing the size, introduce a CSizeComputer in serialize.h: a minimal serializer stream implementation that only computes the number of bytes written. Due to inlining, this should be as efficient as the existing GetSerializeSize code.

I'm thinking about getting rid of IMPLEMENT_SERIALIZE entirely, and replace it with one generic method that depending on template instantiation can do either read/write/size.

@sipa
Copy link
Member Author

sipa commented Jul 10, 2014

Tested: waiting until a peers.dat write succeeds, restart bitcoin, see reading addresses succeeds.

@sipa
Copy link
Member Author

sipa commented Jul 16, 2014

Can I have some ACKs, so I can update #4498 with it? @laanwj @gavinandresen @jgarzik @gmaxwell ?

@jgarzik
Copy link
Contributor

jgarzik commented Jul 16, 2014

quick it-works test. ACK.

nit: a //comment or commit msg txt explaining lack of IMPLEMENT_SERIALIZE(). Your pull request description covered that, but PRs aren't really part of the git history.

src/serialize.h Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to initialize nSize to zero here...

@gavinandresen
Copy link
Contributor

Code review ACK except for init CSizeComputer::nSize comment.

@sipa
Copy link
Member Author

sipa commented Jul 16, 2014

Fixed.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4508_b069750d3f27c96a83700a08a2bb819902268857/ for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@sipa sipa merged commit b069750 into bitcoin:master Jul 17, 2014
sipa added a commit that referenced this pull request Jul 17, 2014
b069750 Break up CAddrMan's IMPLEMENT_SERIALIZE (Pieter Wuille)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants