Skip to content

Commit

Permalink
Raise build version, add rpc fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
tecnovert committed Sep 24, 2018
1 parent 2cae49c commit f3e6ca5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 2 additions & 0 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/net_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ struct CNodeStateStats {
int nSyncHeight = -1;
int nCommonHeight = -1;
std::vector<int> vHeightInFlight;
int nDuplicateCount = 0;
int nLooseHeadersCount = 0;
};

bool IncomingBlockChecked(const CBlock &block, CValidationState &state);
Expand Down
4 changes: 4 additions & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions src/rpc/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f3e6ca5

Please sign in to comment.