Bitcointalk · Difficulty

中本聪,2010 年 7 月 29 日

SN-1684 已核对来源,附原文与上下文。

阅读语言
中文译文

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

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 个区块的中位数。这样做的原因是:倘若前一个区块的时间戳超前太多,就像刚才发生的那样,时间可以在下一个区块被纠正回来。

ORIGINAL · 英文原文
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.

上下文
← 上一条 SN-1684 · 当前 下一条 → 在档案中查看完整主题串 →
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-1684