I work on bitcoin-s, and we've found a problem where if a node is stopped with it's chain tip being a one that is later reorged out it will not be able to continue syncing headers.
This happens because we request headers using a get headers message with hashes= <current chain tip>
and stopHash=<00000..0000>
. Since, our chain tip is reorged out we will receive the first 2000 block headers of the network.
My current solution is to walk back our chain tip, and each iteration check if don't get the first 2k blocks. However, I recognize this is a poor solution, is there a GetHeadersMessage
that I should be using here, or a better alternative?
Thanks