From 84ec7bae4c845c20f7b17801775783d4872c0657 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Thu, 17 Apr 2014 11:27:48 -0300 Subject: [PATCH] fix PeerManager example --- PeerManager.js | 2 +- examples/PeerManager.js | 4 +++- examples/SendTx.js | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PeerManager.js b/PeerManager.js index 76daa5c..8e90317 100644 --- a/PeerManager.js +++ b/PeerManager.js @@ -25,7 +25,7 @@ function PeerManager(config) { this.interval = 5000; this.minConnections = 8; this.minKnownPeers = 10; -}; +} PeerManager.parent = imports.parent || require('events').EventEmitter; PeerManager.Connection = Connection; diff --git a/examples/PeerManager.js b/examples/PeerManager.js index 2cccac9..06d2c26 100644 --- a/examples/PeerManager.js +++ b/examples/PeerManager.js @@ -26,7 +26,9 @@ var run = function() { info.conn.sendGetData(invs); }; - var peerman = new PeerManager(); + var peerman = new PeerManager({ + network: 'testnet' + }); peerman.addPeer(new Peer('127.0.0.1', 18333)); diff --git a/examples/SendTx.js b/examples/SendTx.js index 5dddd80..0eed1f1 100644 --- a/examples/SendTx.js +++ b/examples/SendTx.js @@ -3,13 +3,12 @@ var run = function() { // Replace '../bitcore' with 'bitcore' if you use this code elsewhere. var bitcore = require('../bitcore'); - var networks = bitcore.networks; var Peer = bitcore.Peer; var Transaction = bitcore.Transaction; var Address = bitcore.Address; var Script = bitcore.Script; var coinUtil = bitcore.util; - var PeerManager = require('../PeerManager'); + var PeerManager = bitcore.PeerManager; var createTx = function() { var TXIN = 'd05f35e0bbc495f6dcab03e599c8f5e32a07cdb4bc76964de201d06a2a7d8265';