nano-node
nano-node copied to clipboard
Rep crawler switching between IPv4 and IPv6 for certain representatives
Summary
If representative node has both IPv4 and IPv6 addresses, then rep crawler will frequently reassign representative to different channels. As of now, it seems, check for existing node ID is removed when establishing new connections and node can have multiple connections to the same peer.
Additional question I didn't check: can node actually flood same data (blocks propagation etc.) twice to the same peer via both IPv4 and IPv6?
Node version
27.0
Build details
manually built
OS and version
Linux
Steps to reproduce the behavior
- Launch live network node
- Search log files "warning" level for "[rep_crawler] [warning] Updated representative:" items
Expected behavior
Don't switch representative channel often
Actual behavior
Frequent changes of representative channel between IPv4 and IPv6
[2024-09-02 17:30:30.170] [rep_crawler] [warning] Updated representative: nano_16u1uufyoig8777y6r8iqjtrw8sg8maqrm36zzcm95jmbd9i9aj5i8abr8u5 at: [2a01:7e00::f03c:91ff:fe7a:c863]:57702 (was at: [::ffff:139.162.199.142]:7075) ... [2024-09-02 17:30:35.841] [rep_crawler] [warning] Updated representative: nano_16u1uufyoig8777y6r8iqjtrw8sg8maqrm36zzcm95jmbd9i9aj5i8abr8u5 at: [::ffff:139.162.199.142]:7075 (was at: [2a01:7e00::f03c:91ff:fe7a:c863]:57702)
Possible solution
A. This should improve live network node behavior, but probably it's not desired by new network design
if (rep.channel->get_endpoint () != channel->get_endpoint () && rep.channel->get_node_id () != channel->get_node_id ())
B. Make a setting to prefer either IPv4 or IPv6 for this or any similar situations.
C. Group peers by node ID rather than IP and allow multiple connections per one node ID (?). Don't send duplication data to different channels of one peer.