diff --git a/lib/inventory.js b/lib/inventory.js index da26983..42bb0fa 100644 --- a/lib/inventory.js +++ b/lib/inventory.js @@ -10,9 +10,9 @@ var _ = bitcore.deps._; /** * A constructor for inventory related Bitcoin messages such as * "getdata", "inv" and "notfound". - * @param {Object} - obj - * @param {Number} - obj.type - Inventory.TYPE - * @param {Buffer} - obj.hash - The hash for the inventory + * @param {Object} obj + * @param {Number} obj.type - Inventory.TYPE + * @param {Buffer} obj.hash - The hash for the inventory * @constructor */ function Inventory(obj) { @@ -25,8 +25,8 @@ function Inventory(obj) { /** * A convenience constructor for Inventory. - * @param {Number} - type - Inventory.TYPE - * @param {Buffer|String} - hash - The hash for the inventory + * @param {Number} type - Inventory.TYPE + * @param {Buffer|String} hash - The hash for the inventory * @returns {Inventory} - A new instance of Inventory */ Inventory.forItem = function(type, hash) { @@ -40,7 +40,7 @@ Inventory.forItem = function(type, hash) { /** * A convenience constructor for Inventory for block inventory types. - * @param {Buffer|String} - hash - The hash for the block inventory + * @param {Buffer|String} hash - The hash for the block inventory * @returns {Inventory} - A new instance of Inventory */ Inventory.forBlock = function(hash) { @@ -49,7 +49,7 @@ Inventory.forBlock = function(hash) { /** * A convenience constructor for Inventory for filtered/merkle block inventory types. - * @param {Buffer|String} - hash - The hash for the filtered block inventory + * @param {Buffer|String} hash - The hash for the filtered block inventory * @returns {Inventory} - A new instance of Inventory */ Inventory.forFilteredBlock = function(hash) { @@ -58,7 +58,7 @@ Inventory.forFilteredBlock = function(hash) { /** * A convenience constructor for Inventory for transaction inventory types. - * @param {Buffer|String} - hash - The hash for the transaction inventory + * @param {Buffer|String} hash - The hash for the transaction inventory * @returns {Inventory} - A new instance of Inventory */ Inventory.forTransaction = function(hash) { @@ -76,7 +76,7 @@ Inventory.prototype.toBuffer = function() { }; /** - * @param {BufferWriter} - An instance of BufferWriter + * @param {BufferWriter} bw - An instance of BufferWriter */ Inventory.prototype.toBufferWriter = function(bw) { bw.writeUInt32LE(this.type); @@ -85,7 +85,7 @@ Inventory.prototype.toBufferWriter = function(bw) { }; /** - * @param {Buffer} - Seralized buffer of the inventory + * @param {Buffer} payload - Serialized buffer of the inventory */ Inventory.fromBuffer = function(payload) { var parser = new BufferReader(payload); @@ -96,7 +96,7 @@ Inventory.fromBuffer = function(payload) { }; /** - * @param {BufferWriter} - An instance of BufferWriter + * @param {BufferWriter} br - An instance of BufferWriter */ Inventory.fromBufferReader = function(br) { var obj = {}; diff --git a/lib/messages/commands/addr.js b/lib/messages/commands/addr.js index 5144cdd..884b5d0 100644 --- a/lib/messages/commands/addr.js +++ b/lib/messages/commands/addr.js @@ -10,8 +10,8 @@ var BufferWriter = bitcore.encoding.BufferWriter; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object} - options - * @param {Array} - options.addresses - An array of addrs + * @param {Object=} options + * @param {Array=} options.addresses - An array of addrs * @extends Message * @constructor */ diff --git a/lib/messages/commands/alert.js b/lib/messages/commands/alert.js index 03130a3..b4e60ea 100644 --- a/lib/messages/commands/alert.js +++ b/lib/messages/commands/alert.js @@ -10,9 +10,9 @@ var BufferWriter = bitcore.encoding.BufferWriter; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object} - options - * @param {Buffer} - options.payload - * @param {Buffer} - options.signature + * @param {Object=} options + * @param {Buffer=} options.payload + * @param {Buffer=} options.signature * @extends Message * @constructor */ diff --git a/lib/messages/commands/block.js b/lib/messages/commands/block.js index bdd3d2b..f50538d 100644 --- a/lib/messages/commands/block.js +++ b/lib/messages/commands/block.js @@ -8,8 +8,8 @@ var Block = bitcore.Block; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object|Block} - options - If is an instance of Block will use as options.block - * @param {Block} - options.block - An instance of a Block + * @param {Object|Block=} options - If is an instance of Block will use as options.block + * @param {Block=} options.block - An instance of a Block * @extends Message * @constructor */ diff --git a/lib/messages/commands/filteradd.js b/lib/messages/commands/filteradd.js index ac76682..592dd9a 100644 --- a/lib/messages/commands/filteradd.js +++ b/lib/messages/commands/filteradd.js @@ -13,8 +13,8 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** * Request peer to add data to a bloom filter already set by 'filterload' - * @param {Object} options - * @param {Buffer} options.data - Array of bytes representing bloom filter data + * @param {Object=} options + * @param {Buffer=} options.data - Array of bytes representing bloom filter data * @extends Message * @constructor */ diff --git a/lib/messages/commands/filterload.js b/lib/messages/commands/filterload.js index 0c4cab7..05a53bf 100644 --- a/lib/messages/commands/filterload.js +++ b/lib/messages/commands/filterload.js @@ -12,7 +12,7 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** * Request peer to send inv messages based on a bloom filter - * @param {BloomFilter} options.filter - An instance of BloomFilter + * @param {BloomFilter=} options.filter - An instance of BloomFilter * @extends Message * @constructor */ diff --git a/lib/messages/commands/getblocks.js b/lib/messages/commands/getblocks.js index 76fd462..09ea48c 100644 --- a/lib/messages/commands/getblocks.js +++ b/lib/messages/commands/getblocks.js @@ -15,9 +15,9 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); * Query another peer about blocks. It can query for multiple block hashes, * and the response will contain all the chains of blocks starting from those * hashes. - * @param {Object} options - * @param {Array} options.starts - Array of buffers or strings with the starting block hashes - * @param {Buffer} options.stop - Hash of the last block + * @param {Object=} options + * @param {Array=} options.starts - Array of buffers or strings with the starting block hashes + * @param {Buffer=} options.stop - Hash of the last block */ function GetblocksMessage(options) { if (!(this instanceof GetblocksMessage)) { diff --git a/lib/messages/commands/getdata.js b/lib/messages/commands/getdata.js index debdc18..49092f5 100644 --- a/lib/messages/commands/getdata.js +++ b/lib/messages/commands/getdata.js @@ -6,14 +6,13 @@ var bitcore = require('bitcore'); var utils = require('../utils'); var BufferReader = bitcore.encoding.BufferReader; var BufferWriter = bitcore.encoding.BufferWriter; -var Inventory = require('../../inventory'); var _ = bitcore.deps._; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object|Array} - options - If options is an array will use as "inventory" - * @param {Array} options.inventory - An array of inventory items + * @param {Object|Array=} - options - If options is an array will use as "inventory" + * @param {Array=} options.inventory - An array of inventory items * @extends Message * @constructor */ diff --git a/lib/messages/commands/getheaders.js b/lib/messages/commands/getheaders.js index ec1be4b..de4652c 100644 --- a/lib/messages/commands/getheaders.js +++ b/lib/messages/commands/getheaders.js @@ -15,9 +15,9 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); * Query another peer about block headers. It can query for multiple block hashes, * and the response will contain all the chains of blocks starting from those * hashes. - * @param {Object} options - * @param {Array} options.starts - Array of buffers or strings with the starting block hashes - * @param {Buffer} options.stop - Hash of the last block + * @param {Object=} options + * @param {Array=} options.starts - Array of buffers or strings with the starting block hashes + * @param {Buffer=} options.stop - Hash of the last block */ function GetheadersMessage(options) { if (!(this instanceof GetheadersMessage)) { diff --git a/lib/messages/commands/headers.js b/lib/messages/commands/headers.js index 785c01c..062d8f2 100644 --- a/lib/messages/commands/headers.js +++ b/lib/messages/commands/headers.js @@ -14,8 +14,8 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** * Sent in response to a `getheaders` message. It contains information about * block headers. - * @param {Object} options - * @param {Array} options.headers - array of block headers + * @param {Object=} options + * @param {Array=} options.headers - array of block headers */ function HeadersMessage(options) { if (!(this instanceof HeadersMessage)) { diff --git a/lib/messages/commands/inv.js b/lib/messages/commands/inv.js index 2b2b73c..4a0a5f8 100644 --- a/lib/messages/commands/inv.js +++ b/lib/messages/commands/inv.js @@ -12,8 +12,8 @@ var _ = bitcore.deps._; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object|Array} - options - If options is an array will use as "inventory" - * @param {Array} options.inventory - An array of inventory items + * @param {Object|Array=} - options - If options is an array will use as "inventory" + * @param {Array=} options.inventory - An array of inventory items * @extends Message * @constructor */ diff --git a/lib/messages/commands/merkleblock.js b/lib/messages/commands/merkleblock.js index 486cb95..8b23aa3 100644 --- a/lib/messages/commands/merkleblock.js +++ b/lib/messages/commands/merkleblock.js @@ -13,8 +13,8 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** * Contains information about a MerkleBlock * @see https://en.bitcoin.it/wiki/Protocol_documentation - * @param {Object} options - * @param {MerkleBlock} options.merkleBlock + * @param {Object=} options + * @param {MerkleBlock=} options.merkleBlock */ function MerkleblockMessage(options) { if (!(this instanceof MerkleblockMessage)) { diff --git a/lib/messages/commands/notfound.js b/lib/messages/commands/notfound.js index 66b2776..2c638da 100644 --- a/lib/messages/commands/notfound.js +++ b/lib/messages/commands/notfound.js @@ -12,8 +12,8 @@ var _ = bitcore.deps._; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object|Array} - options - If options is an array will use as "inventory" - * @param {Array} options.inventory - An array of inventory items + * @param {Object|Array=} options - If options is an array will use as "inventory" + * @param {Array=} options.inventory - An array of inventory items * @extends Message * @constructor */ diff --git a/lib/messages/commands/ping.js b/lib/messages/commands/ping.js index 77c2ff6..e1c5721 100644 --- a/lib/messages/commands/ping.js +++ b/lib/messages/commands/ping.js @@ -10,8 +10,8 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** * A message to confirm that a connection is still valid. - * @param {Object} options - * @param {Buffer} options.nonce + * @param {Object=} options + * @param {Buffer=} options.nonce * @extends Message * @constructor */ diff --git a/lib/messages/commands/pong.js b/lib/messages/commands/pong.js index 69ab964..2280624 100644 --- a/lib/messages/commands/pong.js +++ b/lib/messages/commands/pong.js @@ -10,8 +10,8 @@ var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** * A message in response to a ping message. - * @param {Object} options - * @param {Buffer} options.nonce + * @param {Object=} options + * @param {Buffer=} options.nonce * @extends Message * @constructor */ diff --git a/lib/messages/commands/tx.js b/lib/messages/commands/tx.js index e203417..7062fad 100644 --- a/lib/messages/commands/tx.js +++ b/lib/messages/commands/tx.js @@ -8,8 +8,8 @@ var Transaction = bitcore.Transaction; var magicNumber = bitcore.Networks.defaultNetwork.networkMagic.readUInt32LE(0); /** - * @param {Object|Transaction} - options - If is an instance of Transaction will use as options.transaction - * @param {Transaction} - options.transaction - An instance of a Transaction + * @param {Object|Transaction=} options - If is an instance of Transaction will use as options.transaction + * @param {Transaction=} options.transaction - An instance of a Transaction * @extends Message * @constructor */ diff --git a/lib/messages/commands/version.js b/lib/messages/commands/version.js index 0c9627d..6986060 100644 --- a/lib/messages/commands/version.js +++ b/lib/messages/commands/version.js @@ -19,12 +19,12 @@ var packageInfo = require('../../../package.json'); * communication is possible until both peers have exchanged their versions. * * @see https://en.bitcoin.it/wiki/Protocol_documentation#version - * @param{Object} [obj] - properties for the version - * @param{Buffer} [obj.nonce] - a random 8 byte buffer - * @param{String} [obj.subversion] - version of the client - * @param{BN} [obj.services] - * @param{Date} [obj.timestamp] - * @param{Number} [obj.startHeight] + * @param {Object=} obj - properties for the version + * @param {Buffer=} obj.nonce - a random 8 byte buffer + * @param {String=} obj.subversion - version of the client + * @param {BN=} obj.services + * @param {Date=} obj.timestamp + * @param {Number=} obj.startHeight * @extends Message * @constructor */ diff --git a/lib/messages/index.js b/lib/messages/index.js index 54bba09..d55e9f8 100644 --- a/lib/messages/index.js +++ b/lib/messages/index.js @@ -6,12 +6,12 @@ var Hash = bitcore.crypto.Hash; /** * A factory to build Bitcoin protocol messages. - * @param {Object} - [options] - * @param {Number} - [options.magicNumber] - * @param {Function} - [options.Block] - A block constructor - * @param {Function} - [options.BlockHeader] - A block header constructor - * @param {Function} - [options.MerkleBlock] - A merkle block constructor - * @param {Function} - [options.Transaction] - A transaction constructor + * @param {Object=} options + * @param {Number=} options.magicNumber + * @param {Function=} options.Block - A block constructor + * @param {Function=} options.BlockHeader - A block header constructor + * @param {Function=} options.MerkleBlock - A merkle block constructor + * @param {Function=} options.Transaction - A transaction constructor * @constructor */ function Messages(options) { diff --git a/lib/messages/message.js b/lib/messages/message.js index 60fa2fb..60cb656 100644 --- a/lib/messages/message.js +++ b/lib/messages/message.js @@ -7,9 +7,9 @@ var Hash = bitcore.crypto.Hash; /** * Base message that can be inherited to add an additional * `getPayload` method to modify the message payload. - * @param {Object} - options - * @param {String} - options.command - * @param {Number} - options.magicNumber + * @param {Object=} options + * @param {String=} options.command + * @param {Number=} options.magicNumber * @constructor */ function Message(options) { diff --git a/lib/peer.js b/lib/peer.js index 4ba35dd..31539ac 100644 --- a/lib/peer.js +++ b/lib/peer.js @@ -27,12 +27,12 @@ var util = require('util'); * peer.connect(); * ``` * - * @param {Object} [options] - * @param {String} [options.host] - IP address of the remote host - * @param {Number} [options.port] - Port number of the remote host - * @param {Network} [options.network=Networks.defaultNetwork] - The network configuration - * @param {Boolean} [options.relay] - An option to disable automatic inventory relaying from the remote peer - * @param {Socket} [options.socket] - An existing connected socket + * @param {Object} options + * @param {String} options.host - IP address of the remote host + * @param {Number} options.port - Port number of the remote host + * @param {Network} options.network - The network configuration + * @param {Boolean=} options.relay - An option to disable automatic inventory relaying from the remote peer + * @param {Socket=} options.socket - An existing connected socket * @returns {Peer} A new instance of Peer. * @constructor @@ -222,7 +222,7 @@ Peer.prototype._readMessage = function() { }; /** - * Internal function that creates a socket using a proxy if neccesary. + * Internal function that creates a socket using a proxy if necessary. * @returns {Socket} A Socket instance not yet connected. */ Peer.prototype._getSocket = function() { diff --git a/lib/pool.js b/lib/pool.js index 08ac3cd..4c12b48 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -29,12 +29,12 @@ function now() { * pool.connect(); * ``` * - * @param {Object} [options] - * @param {Network} [options.network=Networks.defaultNetwork] - The network configuration - * @param {Boolean} [options.listenAddr=true] - Prevent new peers being added from addr messages - * @param {Boolean} [options.dnsSeed=true] - Prevent seeding with DNS discovered known peers - * @param {Boolean} [options.relay=true] - Prevent inventory announcements until a filter is loaded - * @param {Number} [options.maxSize=Pool.MaxConnectedPeers] - The max number of peers + * @param {Object=} options + * @param {Network=} options.network - The network configuration + * @param {Boolean=} options.listenAddr - Prevent new peers being added from addr messages + * @param {Boolean=} options.dnsSeed - Prevent seeding with DNS discovered known peers + * @param {Boolean=} options.relay - Prevent inventory announcements until a filter is loaded + * @param {Number=} options.maxSize - The max number of peers * @returns {Pool} * @constructor */