Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move IsInitialBlockDownload from main to checkpoints #3999

Closed

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Apr 3, 2014

This is the first commit of "Don't use third-party "what is my IP" services (rebase)" #3461.

It is independent from the functionality in that pull and makes it easier to keep that it up to date. Also I think the code move makes sense, and it helps a little bit in reducing the size of main.cpp.

Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/4b0eb790681673e169c8a421150ddac4b0a949a9 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.

}


Copy link

Choose a reason for hiding this comment

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

Nit: n/t ;)...

@sipa
Copy link
Member

sipa commented Apr 3, 2014

I don't see why it is either useful or wanted to have that method there. It doesn't belong there.

@sipa
Copy link
Member

sipa commented Apr 3, 2014

Reducing the size of main is a good idea, but not by moving logic to arbitrary places.

All variables accessed by this method are internal state to main that shouldn't be exposed in the first place, and only is because of legacy reasons.

@sipa
Copy link
Member

sipa commented Apr 3, 2014

@gmaxwell Just told me he originally did this to be able to access IsInitialBlockDownload() from net.

I still think this is a bad idea. It accesses fImporting, fReindex, chainActive, local time, ... none of which have anything to do with checkpoints. Also, it requires locking cs_main before calling because of that, making it illegal to just call from network code anyway.

The right way is adding a wrapper method in main that acquires cs_main and then calls the current implementation, and add that method to CNodeSignals. That way, net can safely call it.

The long term solution is merging net and main, and then separating the "validation logic" and the "peer state logic" to different modules. IsInitialBlockDownload would become part of the second.

Also, and independent from this: I think checkpoints should move into chainparams, and become data-only (or just disappear).

@laanwj
Copy link
Member Author

laanwj commented Apr 4, 2014

Okay, never mind, didn't know this was so controversial. No one commented this on #3461.

@laanwj laanwj closed this Apr 4, 2014
@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.

None yet

5 participants