Skip to content

Commit

Permalink
p2p: Add CConnman::GetCurrentBlockRelayOnlyConns()
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Oct 9, 2020
1 parent c29272a commit bad16af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,19 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
}
}

std::vector<CAddress> CConnman::GetCurrentBlockRelayOnlyConns() const
{
std::vector<CAddress> ret;
LOCK(cs_vNodes);
for (const CNode* pnode : vNodes) {
if (pnode->IsBlockOnlyConn()) {
ret.push_back(pnode->addr);
}
}

return ret;
}

std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo()
{
std::vector<AddedNodeInfo> ret;
Expand Down
5 changes: 5 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ class CConnman
void RecordBytesRecv(uint64_t bytes);
void RecordBytesSent(uint64_t bytes);

/**
* Return vector of current BLOCK_RELAY peers.
*/
std::vector<CAddress> GetCurrentBlockRelayOnlyConns() const;

// Whether the node should be passed out in ForEach* callbacks
static bool NodeFullyConnected(const CNode* pnode);

Expand Down

0 comments on commit bad16af

Please sign in to comment.