Merge pull request #58 from braydonf/bug/version-constructor-relay
Added default relay value for Version message.
This commit is contained in:
commit
8fc31e29db
@ -39,6 +39,7 @@ function VersionMessage(obj) {
|
|||||||
this.timestamp = this.timestamp || new Date();
|
this.timestamp = this.timestamp || new Date();
|
||||||
this.subversion = this.subversion || '/bitcore:' + packageInfo.version + '/';
|
this.subversion = this.subversion || '/bitcore:' + packageInfo.version + '/';
|
||||||
this.startHeight = this.startHeight || 0;
|
this.startHeight = this.startHeight || 0;
|
||||||
|
this.relay = this.relay === false ? false : true;
|
||||||
}
|
}
|
||||||
inherits(VersionMessage, Message);
|
inherits(VersionMessage, Message);
|
||||||
|
|
||||||
|
|||||||
@ -129,7 +129,24 @@ describe('Command Messages', function() {
|
|||||||
var message = messages.MerkleBlock({merkleBlock: 'not a merkle block'});
|
var message = messages.MerkleBlock({merkleBlock: 'not a merkle block'});
|
||||||
}).should.throw('An instance of MerkleBlock');
|
}).should.throw('An instance of MerkleBlock');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Version', function() {
|
||||||
|
it('should set the default relay property as true', function() {
|
||||||
|
var message = messages.Version();
|
||||||
|
should.exist(message.relay);
|
||||||
|
message.relay.should.equal(true);
|
||||||
|
});
|
||||||
|
it('should set the relay as false', function() {
|
||||||
|
var message = messages.Version({relay: false});
|
||||||
|
should.exist(message.relay);
|
||||||
|
message.relay.should.equal(false);
|
||||||
|
});
|
||||||
|
it('should set the relay as true', function() {
|
||||||
|
var message = messages.Version({relay: true});
|
||||||
|
should.exist(message.relay);
|
||||||
|
message.relay.should.equal(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user