diff --git a/configure.ac b/configure.ac index d10a850d35101..55dc7f52cb20b 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 17) define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_PARTICL, 1) -define(_CLIENT_VERSION_BUILD, 0) +define(_CLIENT_VERSION_BUILD, 1) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2018) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index a6dc232b07317..a10f84d6b031e 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -679,6 +679,8 @@ bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { if (queue.pindex) stats.vHeightInFlight.push_back(queue.pindex->nHeight); } + stats.nDuplicateCount = state->m_duplicate_count; + stats.nLooseHeadersCount = (int)state->m_map_loose_headers.size(); return true; } diff --git a/src/net_processing.h b/src/net_processing.h index 60d56a85ae68d..86a81f86749ae 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -79,6 +79,8 @@ struct CNodeStateStats { int nSyncHeight = -1; int nCommonHeight = -1; std::vector vHeightInFlight; + int nDuplicateCount = 0; + int nLooseHeadersCount = 0; }; bool IncomingBlockChecked(const CBlock &block, CValidationState &state); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 60a1a08f7620c..697523eb50628 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1210,6 +1210,8 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) " \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n" " \"bestblockhash\": \"...\", (string) the hash of the currently best block\n" " \"moneysupply\": xxxxxxx, (numeric) the total amount of coin in the network\n" + " \"blockindexsize\": xxxxxxx, (numeric) the total number of block headers indexed\n" + " \"delayedblocks\": xxxxxxx, (numeric) the number of delayed blocks\n" " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" " \"mediantime\": xxxxxx, (numeric) median time for the current best block\n" " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n" @@ -1261,6 +1263,8 @@ UniValue getblockchaininfo(const JSONRPCRequest& request) obj.pushKV("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()); if (fParticlMode) { obj.pushKV("moneysupply", ValueFromAmount(chainActive.Tip()->nMoneySupply)); + obj.pushKV("blockindexsize", (int)mapBlockIndex.size()); + obj.pushKV("delayedblocks", (int)CountDelayedBlocks()); } obj.pushKV("difficulty", (double)GetDifficulty(chainActive.Tip())); PushTime(obj, "mediantime", chainActive.Tip()->GetMedianTimePast()); diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index 9ef73445bb802..661e614c9b552 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -119,6 +119,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request) " \"banscore\": n, (numeric) The ban score\n" " \"synced_headers\": n, (numeric) The last header we have in common with this peer\n" " \"synced_blocks\": n, (numeric) The last block we have in common with this peer\n" + " \"duplicate_count\": n, (numeric) The number of already received blocks or headers sent by this peer\n" + " \"loose_headers\": n, (numeric) The number of block headers without blocks sent by this peer\n" " \"inflight\": [\n" " n, (numeric) The heights of blocks we're currently asking from this peer\n" " ...\n" @@ -186,6 +188,8 @@ static UniValue getpeerinfo(const JSONRPCRequest& request) obj.pushKV("banscore", statestats.nMisbehavior); obj.pushKV("synced_headers", statestats.nSyncHeight); obj.pushKV("synced_blocks", statestats.nCommonHeight); + obj.pushKV("duplicate_count", statestats.nDuplicateCount); + obj.pushKV("loose_headers", statestats.nLooseHeadersCount); UniValue heights(UniValue::VARR); for (int height : statestats.vHeightInFlight) { heights.push_back(height); diff --git a/src/validation.cpp b/src/validation.cpp index 698b14a44c364..ee68ed2a09739 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4651,6 +4651,11 @@ bool RemoveUnreceivedHeader(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_mai return false; } +size_t CountDelayedBlocks() EXCLUSIVE_LOCKS_REQUIRED(cs_main) +{ + return list_delayed_blocks.size(); +} + bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex) diff --git a/src/validation.h b/src/validation.h index d1a63f4133096..762ba11cc5721 100644 --- a/src/validation.h +++ b/src/validation.h @@ -609,5 +609,6 @@ inline bool IsBlockPruned(const CBlockIndex* pblockindex) } bool RemoveUnreceivedHeader(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main); +size_t CountDelayedBlocks() EXCLUSIVE_LOCKS_REQUIRED(cs_main); #endif // BITCOIN_VALIDATION_H