Removed arg argument from parent message constructor.
This commit is contained in:
parent
36709faaa9
commit
81a9f1c1fb
@ -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(
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user