This commit is contained in:
Manuel Araoz 2015-02-06 12:32:52 -03:00
parent c8674a8633
commit 24b02ccaa6
3 changed files with 9 additions and 4 deletions

View File

@ -39,7 +39,7 @@ var txHash = {
describe('Integration with ' + network.name + ' bitcoind', function() {
this.timeout(15000);
it('handshakes', function(cb) {
it.only('handshakes', function(cb) {
var peer = new Peer('localhost', network);
peer.once('version', function(m) {
m.version.should.be.above(70000);
@ -47,6 +47,7 @@ describe('Integration with ' + network.name + ' bitcoind', function() {
Math.abs(new Date() - m.timestamp).should.be.below(10000); // less than 10 seconds of time difference
m.nonce.length.should.equal(8);
m.start_height.should.be.above(300000);
console.log(peer.host);
cb();
});
peer.once('verack', function(m) {

View File

@ -254,6 +254,10 @@ Version.prototype.fromBuffer = function(payload) {
};
Version.writeAddr = function(addr, parser) {
if (_.isUndefined(addr)) {
parser.pad(26);
return;
}
parser.word64le(addr.services);
parser.put(addr.ip);
parser.word16be(addr.port);

View File

@ -12,15 +12,15 @@ var sinon = require('sinon');
var fs = require('fs');
var bitcore = require('bitcore');
var P2P = require('../');
var Peer = P2P.Peer;
var p2p = require('../');
var Peer = p2p.Peer;
var Networks = bitcore.Networks;
describe('Peer', function() {
describe('Integration test', function() {
it('parses this stream of data from a connection', function(callback) {
var peer = new P2P.Peer('');
var peer = new p2p.Peer('');
var stub = sinon.stub();
var dataCallback;
var connectCallback;