LiskArchive / lisk-elements

⚙️ Library for sending Lisk transactions from the client or server
https://lisk.io/
GNU General Public License v3.0
250 stars 64 forks source link

Add connectAndFetchPeers and new Discovery function Closes#1152 #1170

Closed ishantiw closed 5 years ago

ishantiw commented 5 years ago

Description

Discovery should just take IP address and wPort and should be able to connect and fetch peer list independently of Peer object. This will remove the need to create Peer 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.

Review checklist

ishantiw commented 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.

ishantiw commented 5 years ago

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.