suen / dheba

A minimal usuable toy cryptocurrency
MIT License
0 stars 0 forks source link

Peer discovery #2

Open suen opened 6 years ago

suen commented 6 years ago

After the first handshake message, exchange the addresses of connected peer with the new node.

The bitcoin network exchanges the peer address via "getaddr" and "addr".

Define a message format for addr et getaddr and exchange these messages after the initial handshake. These messages may be exchanged at any point during the exchange.

suen commented 6 years ago

When a peer initiates a connection with another peer, it does so by creating a TCP connection to the remote port. The connecting peer is the client and the remote peer is the server in this context. The port used by connecting peer is not in listen mode and thus other peers cannot use this to establish connection. Thus the remote peers (the servers) should not share the connecting peer's (client) address with others.

suen commented 6 years ago

Do not send self address port in the list of peers sent to the remote peer