From 41c84c193754b71b1076736c50294ce6d86af772 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 24 Feb 2016 17:47:21 -0800 Subject: [PATCH] drop relayedBy. --- lib/bcoin/abstractblock.js | 2 -- lib/bcoin/block.js | 3 --- lib/bcoin/mtx.js | 7 ------- lib/bcoin/peer.js | 3 --- lib/bcoin/tx.js | 6 ------ 5 files changed, 21 deletions(-) diff --git a/lib/bcoin/abstractblock.js b/lib/bcoin/abstractblock.js index 83bc782c..416860b3 100644 --- a/lib/bcoin/abstractblock.js +++ b/lib/bcoin/abstractblock.js @@ -34,8 +34,6 @@ function AbstractBlock(data) { this._raw = data._raw || null; this._size = data._size || 0; - this.relayedBy = data.relayedBy || '0.0.0.0'; - this._chain = data.chain; this.valid = null; diff --git a/lib/bcoin/block.js b/lib/bcoin/block.js index 8328b9e1..42a5ff62 100644 --- a/lib/bcoin/block.js +++ b/lib/bcoin/block.js @@ -225,7 +225,6 @@ Block.prototype.toJSON = function toJSON() { return { type: this.type, height: this.height, - relayedBy: this.relayedBy, hash: utils.revHex(this.hash('hex')), version: this.version, prevBlock: utils.revHex(this.prevBlock), @@ -260,7 +259,6 @@ Block.prototype.toCompact = function toCompact() { prevBlock: this.prevBlock, ts: this.ts, height: this.height, - relayedBy: this.relayedBy, block: utils.toHex(this.render()) }; }; @@ -277,7 +275,6 @@ Block._fromCompact = function _fromCompact(json) { data = parser.parseBlock(raw); data.height = json.height; - data.relayedBy = json.relayedBy; return data; }; diff --git a/lib/bcoin/mtx.js b/lib/bcoin/mtx.js index 25b55c89..8f823514 100644 --- a/lib/bcoin/mtx.js +++ b/lib/bcoin/mtx.js @@ -38,19 +38,16 @@ function MTX(options) { this._offset = 0; this.height = -1; - this.relayedBy = '0.0.0.0'; this._chain = options.chain; if (options.inputs) { - assert(this.inputs.length === 0); options.inputs.forEach(function(input) { this.addInput(input); }, this); } if (options.outputs) { - assert(this.outputs.length === 0); options.outputs.forEach(function(output) { this.addOutput(output); }, this); @@ -1047,7 +1044,6 @@ MTX.prototype.toCompact = function toCompact(coins) { height: this.height, ts: this.ts, ps: this.ps, - relayedBy: this.relayedBy, changeIndex: this.changeIndex, coins: coins ? this.inputs.map(function(input) { return input.output ? input.output.toRaw('hex') : null; @@ -1068,7 +1064,6 @@ MTX._fromCompact = function _fromCompact(json) { data.block = json.block; data.ts = json.ts; data.ps = json.ps; - data.relayedBy = json.relayedBy; data.changeIndex = json.changeIndex; if (json.coins) { @@ -1095,7 +1090,6 @@ MTX.prototype.toJSON = function toJSON() { block: this.block ? utils.revHex(this.block) : null, ts: this.ts, ps: this.ps, - relayedBy: this.relayedBy, changeIndex: this.changeIndex, version: this.version, inputs: this.inputs.map(function(input) { @@ -1114,7 +1108,6 @@ MTX._fromJSON = function fromJSON(json) { height: json.height, ts: json.ts, ps: json.ps, - relayedBy: json.relayedBy, changeIndex: json.changeIndex, version: json.version, inputs: json.inputs.map(function(input) { diff --git a/lib/bcoin/peer.js b/lib/bcoin/peer.js index 77d60bf8..ed25cb0f 100644 --- a/lib/bcoin/peer.js +++ b/lib/bcoin/peer.js @@ -415,15 +415,12 @@ Peer.prototype._onPacket = function onPacket(packet) { return this._handleReject(payload); if (cmd === 'block') { - payload.relayedBy = this.host || '0.0.0.0'; payload = bcoin.block(payload); } else if (cmd === 'merkleblock') { - payload.relayedBy = this.host || '0.0.0.0'; payload = bcoin.merkleblock(payload); this.lastBlock = payload; return; } else if (cmd === 'tx') { - payload.relayedBy = this.host || '0.0.0.0'; payload = bcoin.tx(payload, this.lastBlock); if (this.lastBlock) { if (payload.block) { diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index c92cdd5e..bcce0be3 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -36,7 +36,6 @@ function TX(data, block) { this._offset = data._offset || 0; this.height = data.height != null ? data.height : -1; - this.relayedBy = data.relayedBy || '0.0.0.0'; this._chain = data.chain; @@ -68,7 +67,6 @@ function TX(data, block) { } TX.prototype.setBlock = function setBlock(block) { - this.relayedBy = block.relayedBy; this.ts = block.ts; this.block = block.hash('hex'); this.height = block.height; @@ -763,7 +761,6 @@ TX.prototype.toCompact = function toCompact(coins) { block: this.block, height: this.height, ts: this.ts, - relayedBy: this.relayedBy, coins: coins ? this.inputs.map(function(input) { return input.output ? input.output.toRaw('hex') : null; }) : null, @@ -782,7 +779,6 @@ TX._fromCompact = function _fromCompact(json) { data.height = json.height; data.block = json.block; data.ts = json.ts; - data.relayedBy = json.relayedBy; if (json.coins) { json.coins.forEach(function(output, i) { @@ -807,7 +803,6 @@ TX.prototype.toJSON = function toJSON() { height: this.height, block: this.block ? utils.revHex(this.block) : null, ts: this.ts, - relayedBy: this.relayedBy, version: this.version, inputs: this.inputs.map(function(input) { return input.toJSON(); @@ -824,7 +819,6 @@ TX._fromJSON = function fromJSON(json) { block: json.block ? utils.revHex(json.block) : null, height: json.height, ts: json.ts, - relayedBy: json.relayedBy, version: json.version, inputs: json.inputs.map(function(input) { return bcoin.input._fromJSON(input);