A stale block (also often confusingly referred to as 'orphan block') occurs when two competing blocks were found and then another block builds on top of one of them.
See the following minimal example: the blocks B1
and B2
were discovered at the same time and then the discovery of block C
clarifies that B2
is part of the chain with the most difficulty ("longest chain"). At this point B1
becomes obsolete, as it is not part of the best chain.
B1
A ->
B2 -> C
So, a miner would have received block A
, then started to work on finding a successor to that. When B1
and B2
appeared, he would have received one of them first and started building on top of it, ignoring the other as not part of its best chain. When C
appeared, the miners that were trying to build on top of B1
reorganize to B2 -> C
and start building on C
.
At no point would you process a stale block because once it is clear that the block is stale, it must already be part of an alternative chaintip that is not the longest chain. — There is no reason for you to be interested in it anymore. Especially, there is no reason to start mining on top of a stale block, as you'd be wasting your mining power trying to extend a stale branch of the blockchain (unless you're trying some sort of majority or selfish mining attack).
Actual orphan blocks, i.e. blocks where you're missing the parent block, should not occur by accident on the network as the miner that discovered the last block would be interested in spreading the parent block in order to collect the reward. However, when the parent becomes known, it's not an orphan block anymore. ;)
On the other hand, if a block is not connected to the blockchain at all, it's simply going to be treated as an invalid block by all other network participants.