Reject all other Blocks and allow only my own mined blocks
I suspect that this is an instance of the XY problem, but I'll answer anyway.

If you modify ProcessMessage so that it drops any inbound block messages, that would do it.

Change

    else if (strCommand == NetMsgType::BLOCK &amp;&amp; !fImporting &amp;&amp; !fReindex) // Ignore blocks received while importing
    {


to

    else if (false) // Ignore all blocks
    {