CConnman::GetAddresses from CNode which was used only for getting network_key
CConnman::GetAddresses from CNode
#33900
CConnman::GetAddresses from CNode which was used only for getting network_key
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33900.
See the guideline for information on the review process. A summary of reviews will appear here.
it probably makes sense to check if those refactors are in line with the Net Split WG (ref https://achow101.com/ircmeetings/2025/bitcoin-core-dev.2025-11-13_16_00.log.html and the coredev meeting notes).
Otherwise, this may be touched again soon after.
it probably makes sense to check if those refactors are in line with the Net Split WG (ref https://achow101.com/ircmeetings/2025/bitcoin-core-dev.2025-11-13_16_00.log.html and the coredev meeting notes).
Otherwise, this may be touched again soon after.
it probably makes sense to check if those refactors are in line with the Net Split WG (ref https://achow101.com/ircmeetings/2025/bitcoin-core-dev.2025-11-13_16_00.log.html and the coredev meeting notes).
Otherwise, this may be touched again soon after.
They should be “in line” looking over @theuni’s net_processing_no_cnode* branches nothing seems to conflict.
If there are any concerns or things I might’ve missed, let me know.
0std::vector<CAddress> CConnman::GetAddresses(NodeId id, size_t max_addresses, size_t max_pct)
1{
2 std::shared_ptr<CNode> requestor;
3 {
4 LOCK(m_nodes_mutex);
5 auto it = std::find_if(m_nodes.begin(), m_nodes.end(), [&id](const auto& node) { return node->GetId() == id; });
6 requestor = *it;
7 }
8 return GetAddresses(*requestor, max_addresses, max_pct);
9}
10
11std::vector<CAddress> CConnman::GetAddresses(CNode& requestor, size_t max_addresses, size_t max_pct)
12{
1219@@ -1220,14 +1220,14 @@ class CConnman
1220 * A trusted caller (e.g. from RPC or a peer with addr permission) can use
1221 * @ref GetAddressesUnsafe to avoid using the cache.
1222 *
1223- * @param[in] requestor The requesting peer. Used to key the cache to prevent privacy leaks.
1224+ * @param[in] network_key Per peer network key. Used to key the cache to prevent privacy leaks.
I think the comment is slightly less helpful with the current version and the renaming of the variable otherwise.
0 * [@param](/bitcoin-bitcoin/contributor/param/)[in] network_key Network key of the requesting peer. Used to key the cache to prevent privacy leaks.
requestor_key or something similar to transport this information.
m_network_key to the call site doesn’t really make the API nicer in my view. It would be different if the key was aready available at the call sites alone but that doesn’t seem to be the case.
waketraindev
DrahtBot
maflcko
fjahr
Labels
P2P