fix #1018
This commit is contained in:
parent
c8674a8633
commit
24b02ccaa6
@ -39,7 +39,7 @@ var txHash = {
|
|||||||
describe('Integration with ' + network.name + ' bitcoind', function() {
|
describe('Integration with ' + network.name + ' bitcoind', function() {
|
||||||
|
|
||||||
this.timeout(15000);
|
this.timeout(15000);
|
||||||
it('handshakes', function(cb) {
|
it.only('handshakes', function(cb) {
|
||||||
var peer = new Peer('localhost', network);
|
var peer = new Peer('localhost', network);
|
||||||
peer.once('version', function(m) {
|
peer.once('version', function(m) {
|
||||||
m.version.should.be.above(70000);
|
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
|
Math.abs(new Date() - m.timestamp).should.be.below(10000); // less than 10 seconds of time difference
|
||||||
m.nonce.length.should.equal(8);
|
m.nonce.length.should.equal(8);
|
||||||
m.start_height.should.be.above(300000);
|
m.start_height.should.be.above(300000);
|
||||||
|
console.log(peer.host);
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
peer.once('verack', function(m) {
|
peer.once('verack', function(m) {
|
||||||
|
|||||||
@ -254,6 +254,10 @@ Version.prototype.fromBuffer = function(payload) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Version.writeAddr = function(addr, parser) {
|
Version.writeAddr = function(addr, parser) {
|
||||||
|
if (_.isUndefined(addr)) {
|
||||||
|
parser.pad(26);
|
||||||
|
return;
|
||||||
|
}
|
||||||
parser.word64le(addr.services);
|
parser.word64le(addr.services);
|
||||||
parser.put(addr.ip);
|
parser.put(addr.ip);
|
||||||
parser.word16be(addr.port);
|
parser.word16be(addr.port);
|
||||||
|
|||||||
@ -12,15 +12,15 @@ var sinon = require('sinon');
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
var P2P = require('../');
|
var p2p = require('../');
|
||||||
var Peer = P2P.Peer;
|
var Peer = p2p.Peer;
|
||||||
var Networks = bitcore.Networks;
|
var Networks = bitcore.Networks;
|
||||||
|
|
||||||
describe('Peer', function() {
|
describe('Peer', function() {
|
||||||
|
|
||||||
describe('Integration test', function() {
|
describe('Integration test', function() {
|
||||||
it('parses this stream of data from a connection', function(callback) {
|
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 stub = sinon.stub();
|
||||||
var dataCallback;
|
var dataCallback;
|
||||||
var connectCallback;
|
var connectCallback;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user