What happens when you start two nodes with the same PeerID

I was just pondering things and had a curious thought. What happens when if you were to start two IPFS nodes with the same PeerID?

The only way to get two nodes with the same Peer ID is to purposefully copy the Peer ID…

ipfs init -c /my/ipfs/directory

should always generate a new and unique Peer ID.

Right. So what happens when someone does that? (purposefully is probably a poor description because it can be done inadvertently and probably quite easily)

Things won’t work as expected. Connections may go to the wrong peer etc.

So the problems would be localized to the two misconfigured nodes. I guess I was concerned about problems to the broader network…now I’m wondering about malicious nodes advertising themselves as relay hosts.

Thanks for the info.

A node will refuse to start if the Peer ID and the Private Key do not match. So, unless one distributes the private key or the private key is stolen, one need not worry about impersonation. Simply knowing the Peer ID is not a security issue.