2

From what I understand, when a node first comes online, it requests a list of known IPs from all of it's peers. I'm assuming that by doing that, it shares its own ip to all of the peers, which in turn save it into their list. At this point, the network is in sync.

My question is, what happens when the node in question changes IPs?

4
  • Well, you can't change IP without disconnecting and re-connecting, which means you would start the sync process all over.
    – Mr.Nobody
    Commented Jul 6, 2017 at 0:20
  • What if the node is assigned a new IP? It would not be aware of that
    – jeanluc
    Commented Jul 6, 2017 at 0:22
  • Any app that is currently connected when a new IP is assigned loses connection, because connections are based on IP:Port, because the IP no longer exists. The app would need to reconnect to re-establish a connection with the new IP.
    – Mr.Nobody
    Commented Jul 6, 2017 at 0:27
  • You are probably confused because many apps automatically reconnect when this happens, so it appears they keep a stable connection. But behind the scenes, they don't.
    – Mr.Nobody
    Commented Jul 6, 2017 at 0:37

1 Answer 1

0

That's a good question, but nothing really substantial changes.

The node will reconnect to a peer (whose IP address has remained the same) and the node's new IP address is added to the list of available peers. The old IP address remains in the list, but eventually removed when it gets older: the peer list also keeps track of the last time it saw the node.

it shares its own ip to all of the peers

It doesn't actually, the node you connected to will tell you what your IP address is. (I'm not a 100% sure about this tho)

what if the list if full of old IPs?

Well, that's why there are 'seed nodes' active on the network. They often use domain names, which get resolved to IP addresses (so they can change). They only exist to distribute peer lists. In Bitcoin Core, you connect to the seed node and disconnect after about a minute. You should have enough IPs in your peer list to remain connected to the network from then on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.