CanDirectFetch
returns true when a node’s local time is within 200 minutes of that node’s tip time. When receiving a CMPCTBLOCK
message from a peer, the node will first check if there is an in-flight block request for the block hash. If the block is not already requested, then the node calls CanDirectFetch
to see if we’re close to tip. If CanDirectFetch
is false, then the node won’t process the compact block. In the extreme case of no blocks being found on the network for 200 minutes (infinitesimally small), high-bandwidth compact block relay will be degraded. Also possible is if miners set nTime to the minimum that MTP would allow, but honest miners would be able to march MTP forward more.
@instagibbs pointed out offline that instead of checking if the tip time is recent, the node could check whether the time in the header is recent. This change would allow a miner to send compact blocks to a node that is not synced and hasn’t requested the block by setting the nTime artificially high, but they would need to produce a valid header with enough PoW while this node is likely also advancing their height at the same time (making this unlikely). This has the nice benefit of not degrading high-bandwidth compact block relay though.
Motivated by #31962 (comment) and #31962 (comment).