aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-12-23 11:24:29 +0000
committerJohn Newbery <john@johnnewbery.com>2021-04-01 08:08:11 +0100
commit86acc9646968213aaa4408635915b1bfd75a10c9 (patch)
tree90ce1182c49e34e3e74570a3d5bdac3d65820e6e /src/net_processing.cpp
parent539e4eec63fa5cbc525343c33c40c43f7b48cb6a (diff)
downloadbitcoin-86acc9646968213aaa4408635915b1bfd75a10c9.tar.xz
[net processing] Take NodeId instead of CNode* as originator for RelayAddress()
This makes the following commit easier.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 14b628acf0..b800dc67f2 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1490,13 +1490,13 @@ void PeerManagerImpl::RelayTransaction(const uint256& txid, const uint256& wtxid
* address. So within 24h we will likely relay a given address once. This is to
* prevent a peer from unjustly giving their address better propagation by sending
* it to us repeatedly.
- * @param[in] originator The peer that sent us the address. We don't want to relay it back.
+ * @param[in] originator The id of the peer that sent us the address. We don't want to relay it back.
* @param[in] addr Address to relay.
* @param[in] fReachable Whether the address' network is reachable. We relay unreachable
* addresses less.
* @param[in] connman Connection manager to choose nodes to relay to.
*/
-static void RelayAddress(const CNode& originator,
+static void RelayAddress(NodeId originator,
const CAddress& addr,
bool fReachable,
const CConnman& connman)
@@ -1516,8 +1516,8 @@ static void RelayAddress(const CNode& originator,
std::array<std::pair<uint64_t, CNode*>,2> best{{{0, nullptr}, {0, nullptr}}};
assert(nRelayNodes <= best.size());
- auto sortfunc = [&best, &hasher, nRelayNodes, &originator, &addr](CNode* pnode) {
- if (pnode->RelayAddrsWithConn() && pnode != &originator && pnode->IsAddrCompatible(addr)) {
+ auto sortfunc = [&best, &hasher, nRelayNodes, originator, &addr](CNode* pnode) {
+ if (pnode->RelayAddrsWithConn() && pnode->GetId() != originator && pnode->IsAddrCompatible(addr)) {
uint64_t hashKey = CSipHasher(hasher).Write(pnode->GetId()).Finalize();
for (unsigned int i = 0; i < nRelayNodes; i++) {
if (hashKey > best[i].first) {
@@ -2683,7 +2683,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
if (addr.nTime > nSince && !pfrom.fGetAddr && vAddr.size() <= 10 && addr.IsRoutable())
{
// Relay to a limited number of other nodes
- RelayAddress(pfrom, addr, fReachable, m_connman);
+ RelayAddress(pfrom.GetId(), addr, fReachable, m_connman);
}
// Do not store addresses outside our network
if (fReachable)