Removed arg argument from parent message constructor.

This commit is contained in:
Braydon Fuller 2015-04-01 15:26:20 -04:00
parent 36709faaa9
commit 81a9f1c1fb
23 changed files with 24 additions and 24 deletions

View File

@ -17,7 +17,7 @@ var BufferWriter = bitcore.encoding.BufferWriter;
* @constructor
*/
function AddrMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'addr';
this.magicNumber = options.magicNumber;
$.checkArgument(

View File

@ -17,7 +17,7 @@ var BufferWriter = bitcore.encoding.BufferWriter;
* @constructor
*/
function AlertMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'alert';
if (!arg) {

View File

@ -15,7 +15,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function BlockMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.Block = options.Block;
this.command = 'block';
this.magicNumber = options.magicNumber;

View File

@ -19,7 +19,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function FilteraddMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'filteradd';
$.checkArgument(

View File

@ -12,7 +12,7 @@ var BufferUtil = bitcore.util.buffer;
* @constructor
*/
function FilterclearMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'filterclear';
}

View File

@ -17,7 +17,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function FilterloadMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'filterload';
$.checkArgument(

View File

@ -13,7 +13,7 @@ var BufferUtil = bitcore.util.buffer;
* @constructor
*/
function GetaddrMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'getaddr';
}

View File

@ -21,7 +21,7 @@ var $ = bitcore.util.preconditions;
* @constructor
*/
function GetblocksMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'getblocks';
this.version = options.protocolVersion;
this.magicNumber = options.magicNumber;

View File

@ -16,7 +16,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function GetdataMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'getdata';
this.magicNumber = options.magicNumber;
utils.checkInventory(arg);

View File

@ -20,7 +20,7 @@ var $ = bitcore.util.preconditions;
* @constructor
*/
function GetheadersMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'getheaders';
this.version = options.protocolVersion;
this.magicNumber = options.magicNumber;

View File

@ -21,7 +21,7 @@ var $ = bitcore.util.preconditions;
* @constructor
*/
function HeadersMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.BlockHeader = options.BlockHeader;
this.magicNumber = options.magicNumber;
this.command = 'headers';

View File

@ -17,7 +17,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function InvMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'inv';
this.magicNumber = options.magicNumber;
utils.checkInventory(arg);

View File

@ -15,7 +15,7 @@ var BufferUtil = bitcore.util.buffer;
* @constructor
*/
function MempoolMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'mempool';
}

View File

@ -18,7 +18,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function MerkleblockMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.MerkleBlock = options.MerkleBlock; // constructor
this.magicNumber = options.magicNumber;
this.command = 'merkleblock';

View File

@ -17,7 +17,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function NotfoundMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'notfound';
this.magicNumber = options.magicNumber;
utils.checkInventory(arg);

View File

@ -18,7 +18,7 @@ var BufferReader = bitcore.encoding.BufferReader;
* @constructor
*/
function PingMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'ping';
this.magicNumber = options.magicNumber;
$.checkArgument(

View File

@ -18,7 +18,7 @@ var BufferReader = bitcore.encoding.BufferReader;
* @constructor
*/
function PongMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'pong';
this.magicNumber = options.magicNumber;
$.checkArgument(

View File

@ -7,7 +7,7 @@ var BufferUtil = bitcore.util.buffer;
// todo: add payload: https://en.bitcoin.it/wiki/Protocol_documentation#reject
function RejectMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'reject';
}

View File

@ -14,7 +14,7 @@ var _ = bitcore.deps._;
* @constructor
*/
function TransactionMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'tx';
this.magicNumber = options.magicNumber;
this.Transaction = options.Transaction;

View File

@ -12,7 +12,7 @@ var BufferUtil = bitcore.util.buffer;
* @constructor
*/
function VerackMessage(arg, options) {
Message.call(this, arg, options);
Message.call(this, options);
this.magicNumber = options.magicNumber;
this.command = 'verack';
}

View File

@ -32,7 +32,7 @@ function VersionMessage(arg, options) {
if (!arg) {
arg = {};
}
Message.call(this, arg, options);
Message.call(this, options);
this.command = 'version';
this.magicNumber = options.magicNumber;
this.version = arg.version || options.protocolVersion;

View File

@ -12,7 +12,7 @@ var Hash = bitcore.crypto.Hash;
* @param {Number=} options.magicNumber
* @constructor
*/
function Message(arg, options) {
function Message(options) {
this.command = options.command;
this.magicNumber = options.magicNumber;
}

View File

@ -8,7 +8,7 @@ describe('Message', function() {
describe('@constructor', function() {
it('construct with magic number and command', function() {
var message = new Message(null, {magicNumber: 0xd9b4bef9, command: 'command'});
var message = new Message({magicNumber: 0xd9b4bef9, command: 'command'});
message.command.should.equal('command');
message.magicNumber.should.equal(0xd9b4bef9);
});
@ -16,7 +16,7 @@ describe('Message', function() {
describe('#toBuffer', function() {
it('serialize to a buffer', function() {
var message = new Message(null, {magicNumber: 0xd9b4bef9, command: 'command'});
var message = new Message({magicNumber: 0xd9b4bef9, command: 'command'});
message.getPayload = function() {
return new Buffer(0);
};