<p>nRefCount indicates the number of slots in the <em>new</em> table that is occupied by the same IP address.</p>

CC BY-SA 4.0
2019-05-13T14:57:33.303Z
2019-05-13T14:57:33.303Z
Muoi Tran
<p>I'm reading the address management of Bitcoin core implementation. There is one thing I couldn't understand is in which condition an IP address in the <em>new</em> table of a node is overwritten?</p>

<p>In particular, when the node hears about a new peer, it adds that IP address into a slot in the <em>new</em> table, if that slot is occupied, it checks if the existing <em>isTerrible</em>: <a href="https://github.com/bitcoin/bitcoin/blob/master/src/addrman.cpp#L309" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/master/src/addrman.cpp#L309</a> </p>

<pre><code>if (infoExisting.IsTerrible() || (infoExisting.nRefCount &gt; 1 &amp;&amp; pinfo-&gt;nRefCount == 0))
</code></pre>

<p>What is nRefCount? What is the idea behind this check?</p>

<network><peer-discovery><ip-address>
When an IP address in *new* table is overwritten?
Muoi Tran
# When an IP address in *new* table is overwritten?

(Asked by: username_0 on 2018-10-30)

I'm reading the address management of Bitcoin core implementation. There is one thing I couldn't understand is in which condition an IP address in the *new* table of a node is overwritten?

In particular, when the node hears about a new peer, it adds that IP address into a slot in the *new* table, if that slot is occupied, it checks if the existing *isTerrible*: <https://github.com/bitcoin/bitcoin/blob/master/src/addrman.cpp#L309>

```
if (infoExisting.IsTerrible() || (infoExisting.nRefCount > 1 && pinfo->nRefCount == 0))

```

What is nRefCount? What is the idea behind this check?

**Tags:** network, peer-discovery, ip-address


---

## 1 answers

### Answer by username_0 on 2019-05-13. Score: 0 | Accepted answer

nRefCount indicates the number of slots in the *new* table that is occupied by the same IP address.


---

