-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Advertize all new block hashes in a reorganization #5307
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
f505115
to
3ed7f8e
Compare
CBlockIndex *pindexMostWork = NULL; | ||
do { | ||
boost::this_thread::interruption_point(); | ||
|
||
CBlockIndex *pindexNewTip; |
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.
In the moved line, this variable was initialized to NULL, but no more. Maybe better to do so just in case so that potential bugs result in more predictable outcomes (same for pindexFork
on the line below).
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'm not sure I agree with this as best practice (initializing variables may hide bugs too that uninitialized memory and eg valgrind could show), but: done.
Updated. |
Did some basic testing, and looks good to me. |
I guess one side effect of this is that when announcing a reorg to an 0.10 peer, this increases the overhead. Say there are N blocks announced in the inv generated here. Then an 0.10 peer will generate N getheaders messages (with the same locator in each, but with a different hashstop), and the 0.10 peer will therefore receive N headers responses, with {0,1,...,(N-1)} headers in each message. The total overhead is still not that large in absolute terms I think, but with N^2 behavior here, maybe this argues for the cap being more like 4 or 6, rather than 16? Also I think in the case that we are truncating the inv's, perhaps it would be better to revert to only inv'ing the tip, rather than announcing up to our cap (whatever we pick for that value), since 0.10 nodes would otherwise be requesting the same long chain of headers multiple times. |
concept and light review ACK. Main comment: If many nodes on the network are re-org'ing at once, doesn't this cause traffic to spike? I'll see if I can queue up some worst case local testing in a week or so, if nobody beats me to it. |
Superseded by #6494. |
Currently we only
inv
the hash of the new tip, which means that several round-trips are needed to first discover the hashes of all blocks in between. We can just announce all new hashes.Just a minor improvement, not intended for 0.10.