diff options
author | Gregory Sanders <gsanders87@gmail.com> | 2018-06-12 16:39:29 -0400 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2018-06-15 13:34:09 +0800 |
commit | cbd2f70b75016bbadeb212c823b5c1ece95d5241 (patch) | |
tree | 0f141520289eb030e6c9b761dbab62636b4f3b20 /src | |
parent | ce8aa5491f35c2cca03ba1877cd4c926b506a961 (diff) | |
download | bitcoin-cbd2f70b75016bbadeb212c823b5c1ece95d5241.tar.xz |
expose CBlockIndex::nTx in getblock(header)
GitHub-Pull: #13451
Rebased-From: 86edf4a
Diffstat (limited to 'src')
-rw-r--r-- | src/rpc/blockchain.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 3f69c56426..c092790d64 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -105,6 +105,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex) result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); + result.push_back(Pair("nTx", (uint64_t)blockindex->nTx)); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); @@ -150,6 +151,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx result.push_back(Pair("bits", strprintf("%08x", block.nBits))); result.push_back(Pair("difficulty", GetDifficulty(blockindex))); result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex())); + result.push_back(Pair("nTx", (uint64_t)blockindex->nTx)); if (blockindex->pprev) result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex())); @@ -679,6 +681,7 @@ 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" @@ -748,6 +751,7 @@ 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" |