Bitcointalk · blocks minus 1

中本聪,2010 年 8 月 16 日

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

阅读语言
中文译文

我想把状态栏显示的区块数减 1。如此这般程序第一次加载时,会显示 0 个区块而非 1: "0 connections 0 blocks 0 transactions"

它一直是 "nBestHeight + 1",因为把创世区块也数了进去。严格来说,是的,创世区块是一个区块。它是你出发时就带着的硬编码区块。你不可能没有创世区块。兴许可以把它想成一枚基准币,其他币都拿它来衡量。人们想看的区块数,其实是他们下载到的区块数量。

主要的好处是区块数会等于当前最佳区块的区块号。倘若区块数是 10,那么你拥有的最高区块号就是 10。意味着你有 10 号区块,没有 11 号区块。

它能减少我们在这里遇到的困惑:

我自己也在这上面犯过迷糊,后来在 #bitcoin-dev 问清楚了:

坏区块是 74638 号,最后一个好区块是 74637 号。编号从 0 开始,所以当你的客户端显示有 74638 个区块时,意味着你拥有到 74637 号为止的区块,也就是最后一个好区块。

ORIGINAL · 英文原文
I'd like to reduce the number of blocks displayed in the status bar by 1.   When you first load the program, it'll display 0 blocks instead of 1:
"0 connections    0 blocks     0 transactions"

It's always been "nBestHeight + 1" because it's counting the genesis block.  Technically, yes, the genesis block is a block.  It's a hardcoded block that you start out with.  You can't not have the genesis block.  Maybe think of it as a reference coin that you measure other coins against.  The block count people are looking for is the number of blocks they've downloaded.

The main benefit is that blocks will be equal to the block number of the current best block.  If blocks is 10, then the highest block number you have is 10.  It means you have block 10 and you don't have block 11.

It would reduce the confusion we had here:

... It already is on block 74638. I assume that means that block is now a good one?

I had some confusion on this myself and got clarification in #bitcoin-dev:

The bad block was number 74638, the last good one was 74637.  The numbers start at 0, so when your client shows there are 74638 blocks then that means you have up to block number 74637, the last good one.
上下文
← 上一条 SN-2482 · 当前 下一条 → 在档案中查看完整主题串 →
来源
Bitcointalk 原始链接 ↗ 记录编号 SN-2482