mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 04:45:10 +02:00
Merge #16325: rpc: Clarify that block count means height excl genesis
fab0c820farpc: Clarify that block count means height excl genesis (MarcoFalke) Pull request description: There is a common misconception that the block count returned by the blockchain rpcs includes the genesis block. See for example the discussion in https://github.com/bitcoin/bitcoin/pull/16292#issuecomment-506303256. However, it really returns the height, which is `0` for the genesis block. So clarify that and also remove the misleading "longest blockchain" comment. Finally, fix the wallet test that incorrectly used this rpc. ACKs for top commit: instagibbs: utACKfab0c820fapromag: ACKfab0c82, sorry for the misconception. Tree-SHA512: 0d087cbb628d3866352bca6420402f392e6a997e579941701a408a7fca355d84645045661f39b022e4479cc07f85a6cddaa9095b6fd9911b245692482420a5e4
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include <core_io.h>
|
||||
#include <hash.h>
|
||||
#include <index/blockfilterindex.h>
|
||||
#include <key_io.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/rbf.h>
|
||||
@@ -42,9 +41,9 @@
|
||||
|
||||
#include <boost/thread/thread.hpp> // boost::thread::interrupt
|
||||
|
||||
#include <condition_variable>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
||||
struct CUpdatedBlock
|
||||
{
|
||||
@@ -169,7 +168,8 @@ static UniValue getblockcount(const JSONRPCRequest& request)
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getblockcount",
|
||||
"\nReturns the number of blocks in the longest blockchain.\n",
|
||||
"\nReturns the height of the most-work fully-validated chain.\n"
|
||||
"The genesis block has height 0.\n",
|
||||
{},
|
||||
RPCResult{
|
||||
"n (numeric) The current block count\n"
|
||||
@@ -189,7 +189,7 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
|
||||
if (request.fHelp || request.params.size() != 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getbestblockhash",
|
||||
"\nReturns the hash of the best (tip) block in the longest blockchain.\n",
|
||||
"\nReturns the hash of the best (tip) block in the most-work fully-validated chain.\n",
|
||||
{},
|
||||
RPCResult{
|
||||
"\"hex\" (string) the block hash, hex-encoded\n"
|
||||
@@ -1305,7 +1305,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||
RPCResult{
|
||||
"{\n"
|
||||
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
|
||||
" \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
|
||||
" \"blocks\": xxxxxx, (numeric) the height of the most-work fully-validated chain. The genesis block has height 0\n"
|
||||
" \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n"
|
||||
" \"bestblockhash\": \"...\", (string) the hash of the currently best block\n"
|
||||
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
|
||||
|
||||
Reference in New Issue
Block a user