If you mine a block and publish it, let's say 2 hour 10 minute to the future; other nodes just considers it as non-valid block and they can continue mining with the earlier block. They won't even relay it to other nodes. If they find a block before your block becomes valid, your block will never survive. If others does not find a block, the moment your block is in the 2-hour window it can be accepted (but you must 'publish it again') and others restart mining it as a new head.
No, I think you missed the point - I mean, I mine blocks and publish them with timestamps just _less_ than 2 hours in the future.
A block outside of the 2 hour window will not make any DoS, it won't even be relayed throught your neighbor nodes.
And the moment it is accepted and relayed, everyone can start mining subsequent blocks equallly.
Yes, but 2 blocks _within_ the 2 hour window (but towards the end of of it) will deny mining to everyone else until those blocks pass.
Your question did make me realise I got something wrong though - he needs pairs of blocks to continue the attack.
An example might help illustrate what I mean, we start at 00:00 UTC.
The honest nodes mine blocks at 00:01 00:02 00:03 etc. with the network achieving it's nominal 1 minute blocktime.
At 00:10 our attacker with 10% of nethash manages to mine his first block. He publishes it with a timestamp of 02:09. At this point, the last 3 blocks timestamps are 00:08 00:09 and 02:09 so the median is 00:09 - it's 00:10 so everyone can mine.
Now he has a 10% chance to mine the next block. He's successful at 00:10:50 and publishes that block with a timestamp of 02:10. The timestamps of the most recent 3 blocks are now 00:09 02:09 and 02:10 - the median timestamp is 02:09 and it is 00:11 - no-one can mine, they try to publish blocks with timestamps like 00:12, 00:13 etc. and they are rejected.
Our attacker prepares 2 blocks with timestamps of 04:08 and 04:09 and at 02:09 exactly, releases them - everyone else has only just started having a chance to mine a block with a valid timestamp again, on average it will take them a minute to get one, but at 02:09:01 our attacker has already published his blocks. The most recent 3 timestamps are now 02:10 04:08 04:09 - mining is again impossible for nodes trying to publish blocks with current timestamps (it's 02:09:xx) while the attacker can continue mining.
Not only has he mined his 2 blocks though with the timestamps 04:08 and 04:09, he's also mined some for 06:08/06:09, 08:08/08:09 and so forth. As many as he wants, while everyone else has been mining fruitlessly. What he can't do, is release his whole chain in one go (because lots of it will be more than 2 hours in the future), but he can release it piece by piece like this.
Note that his chain here has the most work in it - even though he's getting 2 hours to mine 2 blocks (so doesn't need a lot of hashrate - with a 1 minute blockrate for the network, he needs 1/60th of nethash to average a block per hour on his own) he is managing to do some work, but the rest of the network is doing none at all.
He can publish more too - the above is highly simplified - what about this:
As before:
The honest nodes mine blocks at 00:01 00:02 00:03 etc. with the network achieving it's nominal 1 minute blocktime.
At 00:10 our attacker with 10% of nethash manages to mine his first block. He publishes it with a timestamp of 02:09. At this point, the last 3 blocks timestamps are 00:08 00:09 and 02:09 so the median is 00:09 - it's 00:10 so everyone can mine.
Now he has a 10% chance to mine the next block. He's successful at 00:10:50 and publishes that block with a timestamp of 02:10. The timestamps of the most recent 3 blocks are now 00:09 02:09 and 02:10 - the median timestamp is 02:09 and it is 00:11 - no-one can mine, they try to publish blocks with timestamps like 00:12, 00:13 etc. and they are rejected.
Now out attacker publishes blocks with timestamps just under 2 hours in the future continually. He takes about 10 minutes to get a block remember (he has 10% of nethash).
At 00:21 he publishes a block with a timestamp of 02:20 (last 3 02:09, 02:10, 02:20 median 02:10)
At 00:31 he publishes a block with a timestamp of 02:30 (last 3 02:10, 02:20, 02:30 median 02:20)
At 00:41 he publishes a block with a timestamp of 02:40 (last 3 02:20, 02:30, 02:40 median 02:30)
etc.
etc.
All the while everyone else keeps trying to mine blocks with accurate timestamps, only the attacker can extend the chain.
The 11 block median means our attacker needs 6 blocks out of 11 to start the attack - so with 10% of nethash, he gets block 1 (we consider this a done deal), he now has 10% chance to get the next one, then if he gets that, 10% chance for the next etc. so his problem compounds - he needs to "get lucky" 5 times, rather than just once more, to start the attack.
Also, with 10 minute blocktimes, and a 2 hour window for future timestamps, his blocktime is now 100 minutes (with 10% of nethash) but he needs to mine 6 more blocks (within 2 hours) to continue the attack.
The 2 hour window is way too big for chains with short blocktimes. That problem is compounded if you reduce the number of blocks you consider the median of, since it then takes less blocks to continue the attack.