Currently when a peer received blocks from another peer before a full compact block is received, we get this error when the compact block blocktxns finally arrive. This is because when the block is received MarkBlockAsReceived() is called which removes the mapping of the block being in flight, thereby triggering this error when the blocktxns do arrive, which we requested.
No peer should be providing an unsolicited block, so the error isnt in compact blocks, its on the peer that gave you the full blocks' side.
@TheBlueMatt No peer should ever do DoS - does this mean we shouldn't have DoS protection code?
Anyway, I think you are incorrect, as, as far as I know, the relay networks provide unsolicited blocks, as do miners.
No node should be sending an unsolicited block, it is a _horrific_ waste of bandwidth. We should be banning on that, unless whitelisted. (for the relay network client, that is a local connection -- not remote peers.)