Skip to content

Commit bad16af

Browse files
committed
p2p: Add CConnman::GetCurrentBlockRelayOnlyConns()
1 parent c29272a commit bad16af

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/net.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,19 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)
20192019
}
20202020
}
20212021

2022+
std::vector<CAddress> CConnman::GetCurrentBlockRelayOnlyConns() const
2023+
{
2024+
std::vector<CAddress> ret;
2025+
LOCK(cs_vNodes);
2026+
for (const CNode* pnode : vNodes) {
2027+
if (pnode->IsBlockOnlyConn()) {
2028+
ret.push_back(pnode->addr);
2029+
}
2030+
}
2031+
2032+
return ret;
2033+
}
2034+
20222035
std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo()
20232036
{
20242037
std::vector<AddedNodeInfo> ret;

src/net.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,11 @@ class CConnman
460460
void RecordBytesRecv(uint64_t bytes);
461461
void RecordBytesSent(uint64_t bytes);
462462

463+
/**
464+
* Return vector of current BLOCK_RELAY peers.
465+
*/
466+
std::vector<CAddress> GetCurrentBlockRelayOnlyConns() const;
467+
463468
// Whether the node should be passed out in ForEach* callbacks
464469
static bool NodeFullyConnected(const CNode* pnode);
465470

0 commit comments

Comments
 (0)