原始文献 / 论坛帖 / Re: Difficulty

Re: Difficulty

Bitcointalk · 2010-07-29 01:16:23 UTC

AuthorSatoshi Nakamoto
TitleRe: Difficulty
Date2010-07-29 01:16:23 UTC
ForumBitcointalk · 原文

你看错代码了。起作用的是这段代码:

Code:
bool CBlock::CheckBlock() const
{
...
// Check timestamp
if (nTime > GetAdjustedTime() + 2 * 60 * 60)
return error("CheckBlock() : block timestamp too far in the future");
...

bool CBlock::AcceptBlock()
{
...
// Check timestamp against prev
if (nTime <= pindexPrev->GetMedianTimePast())
return error("AcceptBlock() : block's timestamp is too early");

时间戳最多允许超前未来 2 小时。它可以比前一个区块更早,但必须大于最近 11 个区块时间的中位数。之所以这样设计,是为了在前一个区块的时间太超前(比如这次发生的情况)时,下一个区块能把时间纠正回来。

英文原文

You were looking at the wrong code. Here's the code that applies:

Code:
bool CBlock::CheckBlock() const
{
...
// Check timestamp
if (nTime > GetAdjustedTime() + 2 * 60 * 60)
return error("CheckBlock() : block timestamp too far in the future");
...

bool CBlock::AcceptBlock()
{
...
// Check timestamp against prev
if (nTime <= pindexPrev->GetMedianTimePast())
return error("AcceptBlock() : block's timestamp is too early");

The timestamp is limited to up to 2 hours in the future. It can be earlier than the previous block, but it must be greater than the median of the last 11 blocks. The reason for doing it that way is so the time can get corrected in the next block if the previous block had the time too far in the future, like what happened.