mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-15 12:19:46 +01:00
add m_last_block_announcement to CNodeStateStats
Copy its value from CNodeState. Unused until the next commit.
This commit is contained in:
parent
50ed54854a
commit
7e86088685
2 changed files with 3 additions and 1 deletions
|
@ -1679,6 +1679,7 @@ bool PeerManagerImpl::GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) c
|
||||||
if (queue.pindex)
|
if (queue.pindex)
|
||||||
stats.vHeightInFlight.push_back(queue.pindex->nHeight);
|
stats.vHeightInFlight.push_back(queue.pindex->nHeight);
|
||||||
}
|
}
|
||||||
|
stats.m_last_block_announcement = state->m_last_block_announcement;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerRef peer = GetPeerRef(nodeid);
|
PeerRef peer = GetPeerRef(nodeid);
|
||||||
|
@ -5156,7 +5157,7 @@ void PeerManagerImpl::EvictExtraOutboundPeers(std::chrono::seconds now)
|
||||||
CNodeState &state = *State(pnode->GetId());
|
CNodeState &state = *State(pnode->GetId());
|
||||||
if (now - pnode->m_connected > MINIMUM_CONNECT_TIME && state.vBlocksInFlight.empty()) {
|
if (now - pnode->m_connected > MINIMUM_CONNECT_TIME && state.vBlocksInFlight.empty()) {
|
||||||
LogDebug(BCLog::NET, "disconnecting extra outbound peer=%d (last block announcement received at time %d)\n",
|
LogDebug(BCLog::NET, "disconnecting extra outbound peer=%d (last block announcement received at time %d)\n",
|
||||||
pnode->GetId(), (*oldest_block_announcement).time_since_epoch().count());
|
pnode->GetId(), TicksSinceEpoch<std::chrono::seconds>(*oldest_block_announcement));
|
||||||
pnode->fDisconnect = true;
|
pnode->fDisconnect = true;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct CNodeStateStats {
|
||||||
ServiceFlags their_services;
|
ServiceFlags their_services;
|
||||||
int64_t presync_height{-1};
|
int64_t presync_height{-1};
|
||||||
std::chrono::seconds time_offset{0};
|
std::chrono::seconds time_offset{0};
|
||||||
|
NodeSeconds m_last_block_announcement;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PeerManagerInfo {
|
struct PeerManagerInfo {
|
||||||
|
|
Loading…
Add table
Reference in a new issue