mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
expose CBlockIndex::nTx in getblock(header)
This commit is contained in:
@@ -95,6 +95,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
|
||||
result.pushKV("bits", strprintf("%08x", blockindex->nBits));
|
||||
result.pushKV("difficulty", GetDifficulty(blockindex));
|
||||
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
|
||||
result.pushKV("nTx", (uint64_t)blockindex->nTx);
|
||||
|
||||
if (blockindex->pprev)
|
||||
result.pushKV("previousblockhash", blockindex->pprev->GetBlockHash().GetHex());
|
||||
@@ -140,6 +141,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
|
||||
result.pushKV("bits", strprintf("%08x", block.nBits));
|
||||
result.pushKV("difficulty", GetDifficulty(blockindex));
|
||||
result.pushKV("chainwork", blockindex->nChainWork.GetHex());
|
||||
result.pushKV("nTx", (uint64_t)blockindex->nTx);
|
||||
|
||||
if (blockindex->pprev)
|
||||
result.pushKV("previousblockhash", blockindex->pprev->GetBlockHash().GetHex());
|
||||
@@ -694,6 +696,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
||||
" \"bits\" : \"1d00ffff\", (string) The bits\n"
|
||||
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
|
||||
" \"chainwork\" : \"0000...1f3\" (string) Expected number of hashes required to produce the current chain (in hex)\n"
|
||||
" \"nTx\" : n, (numeric) The number of transactions in the block.\n"
|
||||
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
|
||||
" \"nextblockhash\" : \"hash\", (string) The hash of the next block\n"
|
||||
"}\n"
|
||||
@@ -782,6 +785,7 @@ static UniValue getblock(const JSONRPCRequest& request)
|
||||
" \"bits\" : \"1d00ffff\", (string) The bits\n"
|
||||
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
|
||||
" \"chainwork\" : \"xxxx\", (string) Expected number of hashes required to produce the chain up to this block (in hex)\n"
|
||||
" \"nTx\" : n, (numeric) The number of transactions in the block.\n"
|
||||
" \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
|
||||
" \"nextblockhash\" : \"hash\" (string) The hash of the next block\n"
|
||||
"}\n"
|
||||
|
||||
Reference in New Issue
Block a user