rpc: Clarify that block count means height excl genesis
This commit is contained in:
parent
2f717fb5cd
commit
fab0c820fa
2 changed files with 6 additions and 7 deletions
|
@ -14,7 +14,6 @@
|
||||||
#include <core_io.h>
|
#include <core_io.h>
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
#include <index/blockfilterindex.h>
|
#include <index/blockfilterindex.h>
|
||||||
#include <key_io.h>
|
|
||||||
#include <policy/feerate.h>
|
#include <policy/feerate.h>
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
#include <policy/rbf.h>
|
#include <policy/rbf.h>
|
||||||
|
@ -42,9 +41,9 @@
|
||||||
|
|
||||||
#include <boost/thread/thread.hpp> // boost::thread::interrupt
|
#include <boost/thread/thread.hpp> // boost::thread::interrupt
|
||||||
|
|
||||||
|
#include <condition_variable>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <condition_variable>
|
|
||||||
|
|
||||||
struct CUpdatedBlock
|
struct CUpdatedBlock
|
||||||
{
|
{
|
||||||
|
@ -169,7 +168,8 @@ static UniValue getblockcount(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getblockcount",
|
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{
|
RPCResult{
|
||||||
"n (numeric) The current block count\n"
|
"n (numeric) The current block count\n"
|
||||||
|
@ -189,7 +189,7 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
|
||||||
if (request.fHelp || request.params.size() != 0)
|
if (request.fHelp || request.params.size() != 0)
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
RPCHelpMan{"getbestblockhash",
|
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{
|
RPCResult{
|
||||||
"\"hex\" (string) the block hash, hex-encoded\n"
|
"\"hex\" (string) the block hash, hex-encoded\n"
|
||||||
|
@ -1305,7 +1305,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||||
RPCResult{
|
RPCResult{
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\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"
|
" \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n"
|
||||||
" \"bestblockhash\": \"...\", (string) the hash of the currently best block\n"
|
" \"bestblockhash\": \"...\", (string) the hash of the currently best block\n"
|
||||||
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
|
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
|
||||||
|
|
|
@ -57,8 +57,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
|
||||||
# after the last time we tried to broadcast. Use mocktime and give an extra minute to be sure.
|
# after the last time we tried to broadcast. Use mocktime and give an extra minute to be sure.
|
||||||
block_time = int(time.time()) + 6 * 60
|
block_time = int(time.time()) + 6 * 60
|
||||||
node.setmocktime(block_time)
|
node.setmocktime(block_time)
|
||||||
block = create_block(int(node.getbestblockhash(), 16), create_coinbase(node.getblockchaininfo()['blocks']), block_time)
|
block = create_block(int(node.getbestblockhash(), 16), create_coinbase(node.getblockcount() + 1), block_time)
|
||||||
block.nVersion = 3
|
|
||||||
block.rehash()
|
block.rehash()
|
||||||
block.solve()
|
block.solve()
|
||||||
node.submitblock(ToHex(block))
|
node.submitblock(ToHex(block))
|
||||||
|
|
Loading…
Reference in a new issue