<p>I'm playing around with connecting my node to another one of my nodes to see how many incoming connections I can handle.
Whenever I add node A from node B with <code>bitcoin-cli addnode 1.1.1.1 add</code> after the first time, I get:</p>

<p><code>error code: -23
error message:
Error: Node already added</code></p>

<p>Is there a way around this? Can I edit the source code somehow to allow multiple connections between the same nodes? Presumably I would only have to edit the code for the sending node, not the receiving node, since I think the receiving node has to be able to accept connections from what appear to be the same IP and port because of NATS?
The alternative is to run many instances of bitcoind in pruned mode which would work I guess, but it's not ideal obviously</p>

CC BY-SA 4.0
2018-12-04T22:24:32.667Z
I'm curious, why do you want to do this?
chytrik
CC BY-SA 4.0
2018-12-04T22:28:50.203Z
To see how many incoming connections my nodes can handle. :)
user46871
CC BY-SA 4.0
2018-12-04T22:38:47.033Z
Max number of incoming connections is part of config.
James C.
CC BY-SA 4.0
2018-12-04T22:40:58.957Z
@JamesC. I know but I want to allow one node (A) to establish many `outgoing` connections to the same node (B)
user46871
CC BY-SA 4.0
2018-12-04T22:48:38.690Z
Ok, it is not allowed as you already mentioned. The same p2p communication will be repeated, so multiple channels are redundant. If a node propagates a new tx or header, it will announce it to all channels. But if you still want to do it, I think the peer is id’ed by IP in version msg, so you would have to tweak the sourcecode to broadcast a different address for each channel, or accept identical IP on multiple inbound connections.
James C.
CC BY-SA 4.0
2018-12-04T23:00:53.537Z
Wouldn't changing the IP in the msg make data sent back to (A) go to the wrong IP address?
user46871
CC BY-SA 4.0
2018-12-04T23:06:19.237Z
No, its separate from the actual tcp connection, which is why a peer may send a different address sitting behind a nat than is seen by receiving peer ofthe tcp connection.
James C.
CC BY-SA 4.0
2018-12-05T00:16:47.650Z
@JamesC. I see, thanks!
I can't mark your comment as an answer for some reason though
Also, if anyone could point me to where in the code I should edit, that would be awesome haha
user46871
CC BY-SA 4.0
2018-12-19T11:04:01.787Z
To find the point in the source code you want to change, the best thing to do is to search for the error string you receive ("Node already added").

However, for your purpose (to see how many connections you can handle) I'd rather run multiple nodes on the same machine of B. You can easily do it by using the '-datadir' option and using different ports (keeping the same IP).

The only limit there could be is the number of peers from the same subnet you can connect to, which is limited to 1 in Bitcoin Core.
But maybe this is not the case with manual connections like 'addnode'.
FedFranz
<bitcoin-core><bitcoind><client><network><nodes>
How to get multiple connections to the same node
user46871
# How to get multiple connections to the same node

(Asked by: username_0 on 2018-12-04)

I'm playing around with connecting my node to another one of my nodes to see how many incoming connections I can handle.
Whenever I add node A from node B with `bitcoin-cli addnode 1.1.1.1 add` after the first time, I get:

`error code: -23
error message:
Error: Node already added`

Is there a way around this? Can I edit the source code somehow to allow multiple connections between the same nodes? Presumably I would only have to edit the code for the sending node, not the receiving node, since I think the receiving node has to be able to accept connections from what appear to be the same IP and port because of NATS?
The alternative is to run many instances of bitcoind in pruned mode which would work I guess, but it's not ideal obviously

**Tags:** bitcoin-core, bitcoind, client, network, nodes

> **Comments:**
> **username_1**: I'm curious, why do you want to do this?  
> **username_0**: To see how many incoming connections my nodes can handle. :)  
> **username_2**: Max number of incoming connections is part of config.  
> **username_0**: @JamesC. I know but I want to allow one node (A) to establish many `outgoing` connections to the same node (B)  
> **username_2**: Ok, it is not allowed as you already mentioned. The same p2p communication will be repeated, so multiple channels are redundant. If a node propagates a new tx or header, it will announce it to all channels. But if you still want to do it, I think the peer is id’ed by IP in version msg, so you would have to tweak the sourcecode to broadcast a different address for each channel, or accept identical IP on multiple inbound connections.  
> **username_0**: Wouldn't changing the IP in the msg make data sent back to (A) go to the wrong IP address?  
> **username_2**: No, its separate from the actual tcp connection, which is why a peer may send a different address sitting behind a nat than is seen by receiving peer ofthe tcp connection.  
> **username_0**: @JamesC. I see, thanks! I can't mark your comment as an answer for some reason though Also, if anyone could point me to where in the code I should edit, that would be awesome haha  
> **username_3**: To find the point in the source code you want to change, the best thing to do is to search for the error string you receive ("Node already added").  However, for your purpose (to see how many connections you can handle) I'd rather run multiple nodes on the same machine of B. You can easily do it by using the '-datadir' option and using different ports (keeping the same IP).  The only limit there could be is the number of peers from the same subnet you can connect to, which is limited to 1 in Bitcoin Core. But maybe this is not the case with manual connections like 'addnode'.  

---

## 0 answers

