You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.
If there is a failure to connect to a selected peer, then another peer on the same network should be chosen.
Actual behaviour
If there is a failure to connect to a selected peer, then the current behaviour results in another mainnet peer being selected, regardless of whether a peer on another network was selected.
Steps to reproduce
Select a localhost peer even though there is no instance of Lisk running locally. Perform an API request. Connection will timeout / fail, resulting in a change of peer to one of the predefined mainnet peers. If the intention was to connect to the testnet or a local devnet, the current behaviour would be undesirable.
Then if a nethash is provided, restrict the peer selection to the chosen network. Allowing the switch to occur when matching. Throwing an error when there are no matching peers.
The text was updated successfully, but these errors were encountered:
Today I am coming back to this issue. We also had several discussions on this. So my proposal would be the following behaviour:
When a user enters a node himself, the default behaviour should be that lisk-js does not change peers on its own. This can be enabled with setting a node AND using randomPeer: true on the settings.
Lisk-JS should be checking for a user entered nethash. When the user has entered the nethash, it should compare to the given testnet and mainnet nethashes. When it does match, the specified network can be chosen to discover a new peer. When it does not match, no peer shall be chosen.
Expected behaviour
If there is a failure to connect to a selected peer, then another peer on the same network should be chosen.
Actual behaviour
If there is a failure to connect to a selected peer, then the current behaviour results in another
mainnet
peer being selected, regardless of whether a peer on another network was selected.Steps to reproduce
Select a
localhost
peer even though there is no instance of Lisk running locally. Perform an API request. Connection will timeout / fail, resulting in a change of peer to one of the predefinedmainnet
peers. If the intention was to connect to thetestnet
or a localdevnet
, the current behaviour would be undesirable.Possible Solution
Assuming, upon catching an error, the switch is being here: https://github.com/LiskHQ/lisk-js/blob/development/lib/api/liskApi.js#L203.
Then improve information available to
selectNode
: https://github.com/LiskHQ/lisk-js/blob/development/lib/api/liskApi.js#L143, by allowing the developer to optionally indicate their chosen network using an appropriatenethash
.Then if a
nethash
is provided, restrict the peer selection to the chosen network. Allowing the switch to occur when matching. Throwing an error when there are no matching peers.The text was updated successfully, but these errors were encountered: