-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Use syncheight instead of startheight for broadcasting block invs #4846
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I contentiously removed the "- 2000", which I suspect will get objections/NAKs. In fact, there's probably a better way to determine whether to broadcast an inv than using the height number - i.e. broadcast if their height is lower OR if their latest block is not in our best chain. (Although actually, this is probably good to go, as we could broadcast our latest block inv the moment we realise their latest block is not in our best chain - if I add that code also, then this pull is probably then ready to merge).
(This pull is dependent on aa81564)
|
Automatic sanity-testing: FAILED BUILD/TEST, see http://jenkins.bluematt.me/pull-tester/p4846_582d7e8294926136389bf2cb65fade180f85ba0e/ for binaries and test log. This could happen for one of several reasons:
If you believe this to be in error, please ping BlueMatt on freenode or TheBlueMatt here. 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/ |
|
We don't always have a pindexBestKnownBlock— pretty much never immediately after startup, only when we've seen an inv for a block in common. IIRC the substantial grace span is require to prevent gratuitous convergence delays/failures when there is a better chain with fewer blocks and was an intentional element of the design. The recognition heuristic sounds fine but doesn't cover the case where we haven't seen a block inv from them at all. |
|
@gmaxwell in the case where we haven't seen a block inv from them, it resorts to using nStartingHeight (provided in the version message). |
|
@sipa can you please take a look at this change? |
|
I'm very wary about touching this code before headersfirst is rolled out; not because the change itself is bad, but because it may interact in unexpected ways with the current broken fetching logic on the other side. Specifically, if we made this code perfect and only announced new blocks to peers that were already caught up, we risk having peers that are stuck (for the various existing reasons) not getting unstuck anymore, because they don't learn about new invs at all anymore. Post-headersfirst this makes sense given some safety margins. |
|
I agree with @sipa 's comment above. headersfirst8 is a prerequisite for this pull. Should I close it until headersfirst8 is merged? |
|
Yes, let's close this until headers-first is merged. That has priority now. |
|
Not just until it is merged. Until it is released and deployed. The reason for keeping the code as-is is because it may affect old peers. |
No need to use the outdated height when we have a more up to date height we can use.