Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wsPort: peer.wsPort,
})),
previousPeers,
maxOutboundConnections: this.options.maxOutboundConnections,
maxInboundConnections: this.options.maxInboundConnections,
peerBanTime: this.options.peerBanTime,
populatorInterval: this.options.populatorInterval,
sendPeerLimit: this.options.sendPeerLimit,
maxPeerDiscoveryResponseLength: this.options
.maxPeerDiscoveryResponseLength,
maxPeerInfoSize: this.options.maxPeerInfoSize,
wsMaxPayload: this.options.wsMaxPayload,
secret: this.secret,
};
this.p2p = new P2P(p2pConfig);
this.channel.subscribe('app:state:updated', event => {
const newNodeInfo = sanitizeNodeInfo(event.data);
try {
this.p2p.applyNodeInfo(newNodeInfo);
} catch (error) {
this.logger.error(
`Applying NodeInfo failed because of error: ${error.message ||
error}`,
);
}
});
// ---- START: Bind event handlers ----
this.p2p.on(EVENT_NETWORK_READY, () => {
this.logger.debug('Node connected to the network');
public constructor() {
this._initialized = false;
this._logger = bunyan.createLogger({ name: 'lisk-node' });
this._logger.info('Starting application');
const genesisStr = fs.readFileSync(
`${__dirname}/../configs/mainnet/genesis_block.json`,
'utf8',
);
this._logger.info('Genesis block file obtained');
const genesis = JSON.parse(genesisStr);
this._p2p = new P2P({
blacklistedPeers: [],
connectTimeout: 5000,
ackTimeout: 15000,
seedPeers: [
{
ipAddress: '83.136.254.92',
wsPort: 8001,
},
{
ipAddress: '83.136.249.76',
wsPort: 8001,
},
],
wsEngine: 'ws',
nodeInfo: {
wsPort: 8001,