There are ways to create blocks that take a lot of time to verify. Here https://bitcointalk.org/?topic=140078 I created a block with a single prevout dependency that took 3 minutes to verify. I found another way to create a block with a single prevout dependency that take 1 minute to verify and verification time is not related to signature verification time. But since this problem has already been discussed, there is nothing new there. Here I propose a minimum change to protect miners from attacks with slow blocks.
The Core code holds the cs_main lock in ProcessNewBlock() when a block is being verified, so a miner receiving a slow block would keep mining on an outdated parent. It will not receive new templates based on that block because it’s still being verified, and if he solves the block, that block won’t be chosen to be the tip of best chain because just after the lock is released, ActivateBestChain() will be called and it will add the slow competing block to the chain, preventing the miner’s local block from entering the best chain. (But this may not be always the case because since the RPC runs in another thread, it’s possible that the OS scheduler switches to the RPC thread just after the lock is released, and the RPC thread finally calls ActivateBestChain() before the network thread).
Of course, it has been said that miners should run two instances of bitcoind, one serving the miners and the other serving the network. However I think that this is a fault in bicoind that should be corrected. Maybe we can change the Core such that if a block submitted by the submitblock RPC call has the same height as a competing block which is the tip, then the block locally submitted has precedence and becomes the new tip. Also we could add a program argument –higher-precedence:ip which would allow blocks submitted by a peer on this ip to have precedence over blocks of equal height submitted by unknown nodes.
As a side-note, all information we can gather about slow blocks is important since there is a plan to increase the block size. For instance, if we don’t rewrite the CHECKSIG logic, and we let MAX_BLOCK_SIGOPS increase 10x along with a 10 Mb block, then a block with a single prevout dependency could be crafted to take more than 5 hours to verify.