<p>The result from <code>CAddrMan::GetAddr()</code> is fed to <code>CNode::PushAddress</code>, which filters out addresses the peer already has, and inserts them in a temporary buffer of up to 1000 addresses.</p>

<p>Later, in <code>SendMessages()</code>, the contents of that buffer is sent out periodically.</p>

CC BY-SA 3.0
2016-06-03T21:19:39.993Z
2016-06-03T21:19:39.993Z
Pieter Wuille
<p>According to the wiki, it seems like these are <strong>"Ongoing "addr" advertisements"</strong> thus unsolicited. </p>

CC BY-SA 3.0
2016-05-04T20:19:40.770Z
2016-05-04T20:19:40.770Z
mrkent
<p>I've been trying to determine the number of addresses a node sends when it receives a getaddr message but I'm a little confused.</p>

<p>On one hand, on addrman.h/.cpp I can see that:</p>

<pre><code>// the maximum percentage of nodes to return in a getaddr call
#define ADDRMAN_GETADDR_MAX_PCT 23

// the maximum number of nodes to return in a getaddr call
#define ADDRMAN_GETADDR_MAX 2500
</code></pre>

<p>[...]</p>

<pre><code>int nNodes = ADDRMAN_GETADDR_MAX_PCT*vRandom.size()/100;
if (nNodes &gt; ADDRMAN_GETADDR_MAX)
    nNodes = ADDRMAN_GETADDR_MAX;
</code></pre>

<p>So it seems that the number of addresses sent is the smaller of the two conditions, namely, 23% of the (active known) nodes or 2500 nodes.</p>

<p>But on the other hand, from the <a href="https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery">bitcoin wiki</a>:</p>

<blockquote>
  <p>The getaddr message sends a request to a node asking for information about known active peers to help with identifying potential nodes in the network. <strong>The response to receiving this message is to transmit an addr message</strong> with one or more peers from a database of known active peers.</p>
</blockquote>

<p>...and...</p>

<blockquote>
  <p>[About addr messages] <strong>If the sender sent over 1000 addresses, they are all ignored.</strong> </p>
</blockquote>

<p>So, why does a node try to send 2500 addresses if the receiver is going to discard them? Why not sending at most 1000 addresses? </p>

<protocol><bitcoin-core><network>
How many addresses are sent in response to a getaddr message?
cpsola
# How many addresses are sent in response to a getaddr message?

(Asked by: username_0 on 2013-12-13)

I've been trying to determine the number of addresses a node sends when it receives a getaddr message but I'm a little confused.

On one hand, on addrman.h/.cpp I can see that:

```
// the maximum percentage of nodes to return in a getaddr call
#define ADDRMAN_GETADDR_MAX_PCT 23

// the maximum number of nodes to return in a getaddr call
#define ADDRMAN_GETADDR_MAX 2500

```

[...]

```
int nNodes = ADDRMAN_GETADDR_MAX_PCT*vRandom.size()/100;
if (nNodes > ADDRMAN_GETADDR_MAX)
    nNodes = ADDRMAN_GETADDR_MAX;

```

So it seems that the number of addresses sent is the smaller of the two conditions, namely, 23% of the (active known) nodes or 2500 nodes.

But on the other hand, from the [bitcoin wiki](https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery):

> The getaddr message sends a request to a node asking for information about known active peers to help with identifying potential nodes in the network. **The response to receiving this message is to transmit an addr message** with one or more peers from a database of known active peers.

...and...

> [About addr messages] **If the sender sent over 1000 addresses, they are all ignored.**

So, why does a node try to send 2500 addresses if the receiver is going to discard them? Why not sending at most 1000 addresses?

**Tags:** protocol, bitcoin-core, network


---

## 2 answers

### Answer by username_1 on 2016-06-03. Score: 1 | Accepted answer

The result from `CAddrMan::GetAddr()` is fed to `CNode::PushAddress`, which filters out addresses the peer already has, and inserts them in a temporary buffer of up to 1000 addresses.

Later, in `SendMessages()`, the contents of that buffer is sent out periodically.


---

### Answer by username_2 on 2016-05-04. Score: 0

According to the wiki, it seems like these are **"Ongoing "addr" advertisements"** thus unsolicited.


---

