-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Description
Core will send a getheaders
message to every peer it connects to. Should a peer respond with the first 2000 headers, Core will begin to download the headers chain from scratch, despite already having these. This is particularly strange while in parallel, the fresh peer may also be actively downloading blocks from the fully synced node.
This check is what causes it to redownload the chain: https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L4434 I worry about this, since incoming peers can also trigger this - and only have to have the first 2000 headers for it to work.
So I'm wondering if there's a reason or if it's a bug. I thought headers
messages started at the next best header in the main chain? Can we simply disregard a headers
message that doesn't start with an unknown header?