4

Consider the following, each of two peers has both TCP and UDP propery forwarded and bound:

Peer A
-> tcp 15600
-> udp 14600

Peer B
-> tcp 15600
-> udp 14600

Which of the following conditions will result in a successful connection:

# Valid TCP Connection
Peer A adds [ Peer B : tcp 15600 ]
Peer B adds [ Peer A : tcp 15600 ]

# Valid UDP Connection
Peer A adds [ Peer B : udp 14600 ]
Peer B adds [ Peer A : udp 14600 ]

But what will happen if the peers add each-other on different protocols?

Peer A adds [ Peer B : tcp : 15600 ]
Peer B adds [ Peer A : udp : 14600 ]

Will this scenario result in a mutual connection between nodes?

Helmar
  • 1,293
  • 1
  • 15
  • 28
Matt Clark
  • 815
  • 5
  • 14

1 Answers1

2

No, different protocols will not work.

When receiving a packet from your neighbor, iri will validate if the source of the packet is in your neighbors list. As the port numbers differ, the packets will get rejected.

Source: https://github.com/iotaledger/iri/blob/acfbc76f39c785aa0914f8bcb6745f34d8f6511b/src/main/java/com/iota/iri/network/Node.java#L244-L246

mihi
  • 7,324
  • 2
  • 15
  • 34
  • It would be great if you could integrate the relevant part of your link into your answer. SE answers should stand on their own even if links rot. – Helmar Dec 03 '17 at 20:32
  • @Helmar: What exactly should I include here? The link points to the source code of iri where eactly the neighbors are compared, and that the port number is compared, too. Also, the link refers to the commit hash so will be valid and have same content as long as iota's node (iri) is available on GitHub (even if iri changes later), and afterwards you can probably find it on some mirrors too. – mihi Dec 03 '17 at 21:08
  • Maybe the relevant 5-10 lines of code. The goal should be to not force the reader to read all the code. – Helmar Dec 04 '17 at 07:01