Track blocks requested by peers
This commit is contained in:
parent
01a554ea1f
commit
a42627b5ec
@ -3077,6 +3077,7 @@ void static ProcessGetData(CNode* pfrom)
|
||||
{
|
||||
// Send block from disk
|
||||
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(inv.hash);
|
||||
pfrom->nBlocksRequested++;
|
||||
if (mi != mapBlockIndex.end())
|
||||
{
|
||||
CBlock block;
|
||||
|
||||
@ -618,6 +618,7 @@ void CNode::copyStats(CNodeStats &stats)
|
||||
X(nMisbehavior);
|
||||
X(nSendBytes);
|
||||
X(nRecvBytes);
|
||||
X(nBlocksRequested);
|
||||
stats.fSyncNode = (this == pnodeSync);
|
||||
}
|
||||
#undef X
|
||||
|
||||
@ -104,6 +104,7 @@ public:
|
||||
int nMisbehavior;
|
||||
uint64 nSendBytes;
|
||||
uint64 nRecvBytes;
|
||||
uint64 nBlocksRequested;
|
||||
bool fSyncNode;
|
||||
};
|
||||
|
||||
@ -173,6 +174,7 @@ public:
|
||||
int64 nLastRecv;
|
||||
int64 nLastSendEmpty;
|
||||
int64 nTimeConnected;
|
||||
uint64 nBlocksRequested;
|
||||
CAddress addr;
|
||||
std::string addrName;
|
||||
CService addrLocal;
|
||||
@ -231,6 +233,7 @@ public:
|
||||
nRecvBytes = 0;
|
||||
nLastSendEmpty = GetTime();
|
||||
nTimeConnected = GetTime();
|
||||
nBlocksRequested = 0;
|
||||
addr = addrIn;
|
||||
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
|
||||
nVersion = 0;
|
||||
|
||||
@ -53,6 +53,7 @@ Value getpeerinfo(const Array& params, bool fHelp)
|
||||
obj.push_back(Pair("lastrecv", (boost::int64_t)stats.nLastRecv));
|
||||
obj.push_back(Pair("bytessent", (boost::int64_t)stats.nSendBytes));
|
||||
obj.push_back(Pair("bytesrecv", (boost::int64_t)stats.nRecvBytes));
|
||||
obj.push_back(Pair("blocksrequested", (boost::int64_t)stats.nBlocksRequested));
|
||||
obj.push_back(Pair("conntime", (boost::int64_t)stats.nTimeConnected));
|
||||
obj.push_back(Pair("version", stats.nVersion));
|
||||
obj.push_back(Pair("subver", stats.strSubVer));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user