And an experimental feature, adjusts the block interval to keep the blockchain height consistent (in the long run, and approximately...) with the wall clock.
About this; I think it might open a vulnerability, but not sure, please confirm or bust. Scenario:
Attacker can generate a block chain in isolated environment which is constantly 'in the future', so targettime will be shorter than official. When that is the situation, attacker can generate more blocks/timespan with the same hahsing power than the official blockchain.
On the one hand, that's a good point and I haven't yet given it the amount of thought it deserves. Good thinking!
On the other, that's a special case of the fact that generating a chain in an isolated environment using long block times is going to give you very low difficulty anyway. You can generate more blocks than the regular blockchain, while going *much* further into the future per block.
But in order for that to become an attack on the main chain, you have to bring your attack chain's last timestamp into line with the main chain's last timestamp, and I don't think that you can.
If you do nothing, then by the time the main chain catches up to the last timestamp of the attack chain, the main chain has more blocks (AND higher difficulty through those blocks).
If you try to add blocks while not adding time to your attack chain, you need some form of the Time Warp exploit (which allows you to add short-time blocks without triggering difficulty adjustments, or allows you to trigger opposite-direction difficulty adjustments to compensate for them), or the difficulty will rapidly go so high that you cannot continue.
And I had thought that I had designed this against the time warp exploit, but now I'm thinking of the implications of burst mining and the fact that you can get five rapid blocks without triggering emergency adjustments... and repeat at intervals of 25 blocks ... and
I believe the regular difficulty adjustments compensate, but I haven't proven it rigorously. If the regular difficulty adjustments don't compensate, you could build a chain about 17% (1/6) longer in the same timestamped time, while keeping the same difficulty setting. Meaning you'd need about 42% of hash power to build a chain equally long.
So the question is now whether there's enough wiggle room to play the emergency adjustments against the regular adjustments. Aww, crap, now I'm going to have to do real math.