Closed ishantiw closed 5 years ago
I have kept it in the draft state because there are a lot of changes that affect overall discovery, connecting with incoming connections and maintaining Peers in PeerPool.
NOTE: Need to resolve a couple of tests related to stopping the node. I have skipped the partial network test (where nodes start at once without going into discovery) because it's not relevant anymore due to the change in initial discovery process.
I'm reverting back the changes related to the use of independent connectToFetchPeers
call in discovery as it was it creating a lot of instability in tests. Since its making independent calls in some interval, the connection doesn't close properly sometimes. Also, in the beginning, if there are no peers in the peer list of any node in the network then it cannot fetch peers of each other and hence throws the error. I'm still keeping the fetch connectAndRequest
to fetch status of seed peers and adding them to peer pool in the initial discovery process.
Description
Discovery should just take
IP
address andwPort
and should be able to connect and fetch peer list independently ofPeer
object. This will remove the need to createPeer
objects for the seed peers just to fetch peer list from them. Also, it will be independent of the peer pool in terms of choosing peers with Peer objects already and could be handled independently.Add new
connectAndFetchPeers
method that will fetch all the peers fromP2PPeerInfo ({ipAddress, wsPort})
, this will assign an outbound socket and destroy it after fetching peers.Update discovery function
discoverPeer
to useconnectAndFetchPeers
to fetch peers from the peers passed as arguments.Update P2P
start()
method and subsequent_startDiscovery()
methods to use and accept new updated discovery method.Review checklist