Unrelated to your algorithm, say that the attacker did have 51% of the network power, which I think is silly, but try it anyway. The current rules allow him to rewrite history, and blatantly tell everyone that he is doing it (by using correct timestamps). Why not force him to make fake timestamps back to his chosen fork point, and then accept the difficulty adjustment consequences of doing so? The amount of extra work for the attacker would in some cases be non-trivial.
And my philosophical objection still stands. Why should the network accept a block today, with a timestamp of today, as a candidate to start a fork days or weeks or months in the past? Inertia doesn't seem to be a good answer to that question.
You're imagining a honest shorter chain, and a dishonest longer fork that has a big timestamp gap. Lets reverse that:
Imagine the network is following your rules. There is an honest longest chain. Now I construct a dishonest fork timestamped such that the true longest chain looks like it jumped forward in time relative to to my fork. Either the whole network now rejects the honest chain on seeing my fork (bad), or they only apply your rule only one way on reorg decision (e.g. only demand it when switching from a 'better timestamped' shorter fork to a longer fork) which would mean that a newly bootstraped node's chain decision depends on which chain he heard first (because the dishonest fork may have been the longest from his perspective until he heard the longer one) and as a result network can't reliably converge (bad).
How would an attacker re-write the timestamps in the blocks that everyone already has? The original chain has a sequence of blocks with (more or less) evenly spaced timestamps, and there is no possible way for an attacker to make that look like it has a jump in it. The best the attacker could do would be to pile up the timestamps, one after another, in his attack chain. He can't go backwards to make a jump.
Essentially, if we are looking at a possible fork from, say, a month ago, the first block in the newly presented fork really should have a timestamp from a month ago too.
I'm skeptical about the extra work comment... The amount of work needed to overtake the longest chain from a given cut point is _constant_: its the amount of work in the longest chain after that cut. Difficulty doesn't come into play. Ignoring the timewarp issue, there isn't much advantage that can be gained by lying about the timestamps, and most you could get 4x per 8 weeks you cut. Go too far back and you need a really significant super majority to get ahead in a reasonable time... and the advantage is just the inflation you could create for as a factor of log4(your rate/network rate) from undercorrection with your correct timestamps during the point where your chain is 'catching up'.
Good point on the constant work amount. Whatever he gains by messing with the old timestamps, he'll lose when his fork is putting out blocks more often than usual and he'll end up in the same place.
When I initially read your message I misread it as asserting that sufficiently old stamped blocks should not be considered. I realize now I misread it, but since someone else might have:Because unless you will accept old timestamps any partition would result in a perpetually unresolvable hardfork— you start with a worldwide Bitcoin, a cable gets cut and a a little bit later you have north american bitcoin vs everyone else, and everyones bitcoin is now double spendable (once in each partition).
Worse, an attacker could intentionally produce these kinds splits by creating slightly longer fork and then announcing it to half the world right at the edge of whatever criteria you impose for 'too old a rewrite', so that half would accept it and the other half would hear about it too late.
Yup, that idea would have some issues. I occasionally suggest using an exponential difficulty difference for triggering deep reorgs (or rather for avoiding them), and people make similar objections to that proposal too.
Also, it doesn't help that we are wandering around two different issues, a 51% attack and a BS blockspam annoyance. Your algorithm would kill the blockspam problem, but only if every client uses your algorithm, which would be a
de facto protocol change.