Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lisk-interchain

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lisk-interchain - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

30

index.js

@@ -5,2 +5,3 @@ const shuffle = require('lodash.shuffle');

let defaultSelectForSendFunction;
let defaultSelectForConnectionFunction;

@@ -14,2 +15,21 @@ function getAffectedModule(remoteActionName) {

function interchainSelectForConnection(input) {
if (!defaultSelectForConnectionFunction) {
return [];
}
let knownPeers = [...input.newPeers, ...input.triedPeers];
let {nodeInfo} = input;
let nodeModules = Object.keys(nodeInfo.modules || {}).sort().join(',');
let matchingPeer = knownPeers.find((peerInfo) => {
let peerModules = Object.keys(peerInfo.modules || {}).sort().join(',');
return peerModules === nodeModules;
});
let selectedPeers = defaultSelectForConnectionFunction(input);
if (selectedPeers.length > 1) {
selectedPeers[0] = matchingPeer;
}
return selectedPeers;
}
function interchainSelectForRequest(input) {

@@ -30,2 +50,6 @@ let {nodeInfo, peers, peerLimit, requestPacket} = input;

if (!defaultSelectForRequestFunction) {
return [];
}
return defaultSelectForRequestFunction(input);

@@ -48,2 +72,6 @@ }

if (!defaultSelectForSendFunction) {
return [];
}
return defaultSelectForSendFunction(input);

@@ -75,5 +103,7 @@ }

defaultSelectForSendFunction = this.network.p2p._peerPool._peerSelectForSend;
defaultSelectForConnectionFunction = this.network.p2p._peerPool._peerSelectForConnection;
this.network.p2p._peerPool._peerSelectForRequest = interchainSelectForRequest;
this.network.p2p._peerPool._peerSelectForSend = interchainSelectForSend;
this.network.p2p._peerPool._peerSelectForConnection = interchainSelectForConnection;
};

@@ -80,0 +110,0 @@ }

2

package.json
{
"name": "lisk-interchain",
"version": "1.0.1",
"version": "1.1.0",
"description": "Custom peer selector plugin for Lisk interchain.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc