Change getheaders
messages so that we wait up to 2 minutes for a response to a prior getheaders
message before issuing a new one.
Also change the handling of the getheaders
message sent in response to a block INV, so that we no longer use the hashstop variable (including the hash stop will just mean that if our peer’s headers chain is longer, then we won’t learn
it, so there’s no benefit to using hashstop).
Also, now respond to a getheaders
during IBD with an empty headers message (rather than nothing) – this better conforms to the intent of the new logic that it’s better to not ignore a peer’s getheaders
message, even if you have nothing to give. This also avoids a lot of functional tests breaking.
This PR also reworks the headers processing logic to make it more readable.