Previously, we would check to see if we were in IBD and ignore getheaders requests accordingly. However, the IBD criteria – an optimization mostly targeted at behavior when we have peers serving us many blocks we need to download – is difficult to reason about in edge-case scenarios, such as if the network were to go a long time without any blocks found and nodes are getting restarted during that time.
To make things simpler to reason about, just use nMinimumChainWork
as our anti-DoS threshold for responding to a getheaders request; as long as our chain has that much work, it should be fine to respond to a peer asking for our headers (and this should allow such a peer to request blocks from us if needed).