Summary
- use the announced block header's timestamp to check unsolicited compact-block recency
- preserve the existing 20-target-spacing cutoff
- leave
CanDirectFetch()and its other callers unchanged - add regression coverage for compact-block relay when the active tip is stale
CanDirectFetch() checks the active tip's timestamp. After 20 target spacings without a block, this causes a recent unsolicited compact block from a high-bandwidth peer to be ignored.
This change uses the announced block header's timestamp for that local check instead. Although header timestamps are miner-selected, this only affects whether reconstruction is attempted; existing proof-of-work, chain-work, peer, resource, and block-validation checks still apply.
Fixes #33578
Test coverage
The functional test keeps the active tip stale and verifies that:
- an old unsolicited compact block is ignored
- a distinct compact block with a recent header triggers
GETBLOCKTXN - mock time is restored after the test
Validation
test/functional/p2p_compactblocks.py