Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._addSocketEventHandlers();
} else {
this.host = options.host || 'localhost';
this.status = Peer.STATUS.DISCONNECTED;
this.port = options.port;
}
this.network = Networks.get(options.network) || Networks.defaultNetwork;
if (!this.port) {
this.port = this.network.port;
}
this.messages = options.messages || new Messages({
network: this.network,
Block: bitcore.Block,
Transaction: bitcore.Transaction
});
this.dataBuffer = new Buffers();
this.version = 0;
this.bestHeight = 0;
this.subversion = null;
this.relay = options.relay === false ? false : true;
this.versionSent = false;
// set message handlers
var self = this;
this.on('verack', function() {
self.status = Peer.STATUS.READY;
function builder(options) {
/* jshint maxstatements: 20 */
/* jshint maxcomplexity: 10 */
if (!options) {
options = {};
}
if (!options.network) {
options.network = bitcore.Networks.defaultNetwork;
}
options.Block = options.Block || bitcore.Block;
options.BlockHeader = options.BlockHeader || bitcore.BlockHeader;
options.Transaction = options.Transaction || bitcore.Transaction;
options.MerkleBlock = options.MerkleBlock || bitcore.MerkleBlock;
options.protocolVersion = options.protocolVersion || 70001;
var exported = {
constructors: {
Block: options.Block,
BlockHeader: options.BlockHeader,
Transaction: options.Transaction,
MerkleBlock: options.MerkleBlock
},
defaults: {
protocolVersion: options.protocolVersion,
network: options.network
},