Reduce spurious messages during headers sync
Summary:
Delay sending SENDHEADERS (BIP 130) message until we know our peer's best
header's chain has more than nMinimumChainWork. This reduces inadvertent
headers messages received during initial headers sync due to block
announcements, which throw off our sync algorithm.
This is a partial backport of core#25717
https://github.com/bitcoin/bitcoin/pull/25717/commits/83c6a0c5249c4ecbd11f7828c84a50fb473faba3
Depends on D15130
Test Plan:
ninja all check-all
Run header sync on mainnet and testnet
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D15164