I am confused reading this code block if (!pindexPrev->IsValid(BLOCK_VALID_SCRIPTS)) {...
Then I find bad-prevblk is returned twice. One here and one above if (pindexPrev->nStatus & BLOCK_FAILED_MASK)...
To disambiguate, I change bad-prevblk to bad-prevblk-desc and verify that this is the right error being tested in p2p_unrequested_blocks. This the only place this behavior is tested I think.