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

The P2PPeerSelectionForSendRequest function should receive the current message/request packet as an argument #1200

Closed jondubois closed 5 years ago

jondubois commented 5 years ago

Expected behavior

The P2PPeerSelectionForSendRequest function is invoked for each message and request which is about to be sent out to the network. We need to pass the request or message to that function so that it can make peer selection decisions on a per-request (P2PRequestPacket) and per-message (P2PMessagePacket) basis.

We should try to split up the P2PPeerSelectionForSendRequest into two:

By default, we could pass the same selection function to both properties.

This is needed for the module subnet feature.

Actual behavior

Right now the function only receives peers, nodeInfo and numOfPeers.