There are rules to prevent any peer from requesting any proof for download:
1/ The proof must have been known for a long time, or
2/ The proof should have been recently inv'ed to the peer
There is a missing piece of code for the rule 2. A peer is allowed to request a proof immediately if he received an avahello message but not an inv message containing the proof id. This is the case for example when a node send a proof manually via the sendavalancheproof RPC.
This diff closes the gap and adds a test for this behavior. This comes in conflict with the broadcast test which needs a small adaptation.