drop relayedBy.
This commit is contained in:
parent
15a3f4b28b
commit
41c84c1937
@ -34,8 +34,6 @@ function AbstractBlock(data) {
|
|||||||
this._raw = data._raw || null;
|
this._raw = data._raw || null;
|
||||||
this._size = data._size || 0;
|
this._size = data._size || 0;
|
||||||
|
|
||||||
this.relayedBy = data.relayedBy || '0.0.0.0';
|
|
||||||
|
|
||||||
this._chain = data.chain;
|
this._chain = data.chain;
|
||||||
|
|
||||||
this.valid = null;
|
this.valid = null;
|
||||||
|
|||||||
@ -225,7 +225,6 @@ Block.prototype.toJSON = function toJSON() {
|
|||||||
return {
|
return {
|
||||||
type: this.type,
|
type: this.type,
|
||||||
height: this.height,
|
height: this.height,
|
||||||
relayedBy: this.relayedBy,
|
|
||||||
hash: utils.revHex(this.hash('hex')),
|
hash: utils.revHex(this.hash('hex')),
|
||||||
version: this.version,
|
version: this.version,
|
||||||
prevBlock: utils.revHex(this.prevBlock),
|
prevBlock: utils.revHex(this.prevBlock),
|
||||||
@ -260,7 +259,6 @@ Block.prototype.toCompact = function toCompact() {
|
|||||||
prevBlock: this.prevBlock,
|
prevBlock: this.prevBlock,
|
||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
height: this.height,
|
height: this.height,
|
||||||
relayedBy: this.relayedBy,
|
|
||||||
block: utils.toHex(this.render())
|
block: utils.toHex(this.render())
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -277,7 +275,6 @@ Block._fromCompact = function _fromCompact(json) {
|
|||||||
data = parser.parseBlock(raw);
|
data = parser.parseBlock(raw);
|
||||||
|
|
||||||
data.height = json.height;
|
data.height = json.height;
|
||||||
data.relayedBy = json.relayedBy;
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -38,19 +38,16 @@ function MTX(options) {
|
|||||||
this._offset = 0;
|
this._offset = 0;
|
||||||
|
|
||||||
this.height = -1;
|
this.height = -1;
|
||||||
this.relayedBy = '0.0.0.0';
|
|
||||||
|
|
||||||
this._chain = options.chain;
|
this._chain = options.chain;
|
||||||
|
|
||||||
if (options.inputs) {
|
if (options.inputs) {
|
||||||
assert(this.inputs.length === 0);
|
|
||||||
options.inputs.forEach(function(input) {
|
options.inputs.forEach(function(input) {
|
||||||
this.addInput(input);
|
this.addInput(input);
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.outputs) {
|
if (options.outputs) {
|
||||||
assert(this.outputs.length === 0);
|
|
||||||
options.outputs.forEach(function(output) {
|
options.outputs.forEach(function(output) {
|
||||||
this.addOutput(output);
|
this.addOutput(output);
|
||||||
}, this);
|
}, this);
|
||||||
@ -1047,7 +1044,6 @@ MTX.prototype.toCompact = function toCompact(coins) {
|
|||||||
height: this.height,
|
height: this.height,
|
||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
ps: this.ps,
|
ps: this.ps,
|
||||||
relayedBy: this.relayedBy,
|
|
||||||
changeIndex: this.changeIndex,
|
changeIndex: this.changeIndex,
|
||||||
coins: coins ? this.inputs.map(function(input) {
|
coins: coins ? this.inputs.map(function(input) {
|
||||||
return input.output ? input.output.toRaw('hex') : null;
|
return input.output ? input.output.toRaw('hex') : null;
|
||||||
@ -1068,7 +1064,6 @@ MTX._fromCompact = function _fromCompact(json) {
|
|||||||
data.block = json.block;
|
data.block = json.block;
|
||||||
data.ts = json.ts;
|
data.ts = json.ts;
|
||||||
data.ps = json.ps;
|
data.ps = json.ps;
|
||||||
data.relayedBy = json.relayedBy;
|
|
||||||
data.changeIndex = json.changeIndex;
|
data.changeIndex = json.changeIndex;
|
||||||
|
|
||||||
if (json.coins) {
|
if (json.coins) {
|
||||||
@ -1095,7 +1090,6 @@ MTX.prototype.toJSON = function toJSON() {
|
|||||||
block: this.block ? utils.revHex(this.block) : null,
|
block: this.block ? utils.revHex(this.block) : null,
|
||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
ps: this.ps,
|
ps: this.ps,
|
||||||
relayedBy: this.relayedBy,
|
|
||||||
changeIndex: this.changeIndex,
|
changeIndex: this.changeIndex,
|
||||||
version: this.version,
|
version: this.version,
|
||||||
inputs: this.inputs.map(function(input) {
|
inputs: this.inputs.map(function(input) {
|
||||||
@ -1114,7 +1108,6 @@ MTX._fromJSON = function fromJSON(json) {
|
|||||||
height: json.height,
|
height: json.height,
|
||||||
ts: json.ts,
|
ts: json.ts,
|
||||||
ps: json.ps,
|
ps: json.ps,
|
||||||
relayedBy: json.relayedBy,
|
|
||||||
changeIndex: json.changeIndex,
|
changeIndex: json.changeIndex,
|
||||||
version: json.version,
|
version: json.version,
|
||||||
inputs: json.inputs.map(function(input) {
|
inputs: json.inputs.map(function(input) {
|
||||||
|
|||||||
@ -415,15 +415,12 @@ Peer.prototype._onPacket = function onPacket(packet) {
|
|||||||
return this._handleReject(payload);
|
return this._handleReject(payload);
|
||||||
|
|
||||||
if (cmd === 'block') {
|
if (cmd === 'block') {
|
||||||
payload.relayedBy = this.host || '0.0.0.0';
|
|
||||||
payload = bcoin.block(payload);
|
payload = bcoin.block(payload);
|
||||||
} else if (cmd === 'merkleblock') {
|
} else if (cmd === 'merkleblock') {
|
||||||
payload.relayedBy = this.host || '0.0.0.0';
|
|
||||||
payload = bcoin.merkleblock(payload);
|
payload = bcoin.merkleblock(payload);
|
||||||
this.lastBlock = payload;
|
this.lastBlock = payload;
|
||||||
return;
|
return;
|
||||||
} else if (cmd === 'tx') {
|
} else if (cmd === 'tx') {
|
||||||
payload.relayedBy = this.host || '0.0.0.0';
|
|
||||||
payload = bcoin.tx(payload, this.lastBlock);
|
payload = bcoin.tx(payload, this.lastBlock);
|
||||||
if (this.lastBlock) {
|
if (this.lastBlock) {
|
||||||
if (payload.block) {
|
if (payload.block) {
|
||||||
|
|||||||
@ -36,7 +36,6 @@ function TX(data, block) {
|
|||||||
this._offset = data._offset || 0;
|
this._offset = data._offset || 0;
|
||||||
|
|
||||||
this.height = data.height != null ? data.height : -1;
|
this.height = data.height != null ? data.height : -1;
|
||||||
this.relayedBy = data.relayedBy || '0.0.0.0';
|
|
||||||
|
|
||||||
this._chain = data.chain;
|
this._chain = data.chain;
|
||||||
|
|
||||||
@ -68,7 +67,6 @@ function TX(data, block) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TX.prototype.setBlock = function setBlock(block) {
|
TX.prototype.setBlock = function setBlock(block) {
|
||||||
this.relayedBy = block.relayedBy;
|
|
||||||
this.ts = block.ts;
|
this.ts = block.ts;
|
||||||
this.block = block.hash('hex');
|
this.block = block.hash('hex');
|
||||||
this.height = block.height;
|
this.height = block.height;
|
||||||
@ -763,7 +761,6 @@ TX.prototype.toCompact = function toCompact(coins) {
|
|||||||
block: this.block,
|
block: this.block,
|
||||||
height: this.height,
|
height: this.height,
|
||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
relayedBy: this.relayedBy,
|
|
||||||
coins: coins ? this.inputs.map(function(input) {
|
coins: coins ? this.inputs.map(function(input) {
|
||||||
return input.output ? input.output.toRaw('hex') : null;
|
return input.output ? input.output.toRaw('hex') : null;
|
||||||
}) : null,
|
}) : null,
|
||||||
@ -782,7 +779,6 @@ TX._fromCompact = function _fromCompact(json) {
|
|||||||
data.height = json.height;
|
data.height = json.height;
|
||||||
data.block = json.block;
|
data.block = json.block;
|
||||||
data.ts = json.ts;
|
data.ts = json.ts;
|
||||||
data.relayedBy = json.relayedBy;
|
|
||||||
|
|
||||||
if (json.coins) {
|
if (json.coins) {
|
||||||
json.coins.forEach(function(output, i) {
|
json.coins.forEach(function(output, i) {
|
||||||
@ -807,7 +803,6 @@ TX.prototype.toJSON = function toJSON() {
|
|||||||
height: this.height,
|
height: this.height,
|
||||||
block: this.block ? utils.revHex(this.block) : null,
|
block: this.block ? utils.revHex(this.block) : null,
|
||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
relayedBy: this.relayedBy,
|
|
||||||
version: this.version,
|
version: this.version,
|
||||||
inputs: this.inputs.map(function(input) {
|
inputs: this.inputs.map(function(input) {
|
||||||
return input.toJSON();
|
return input.toJSON();
|
||||||
@ -824,7 +819,6 @@ TX._fromJSON = function fromJSON(json) {
|
|||||||
block: json.block ? utils.revHex(json.block) : null,
|
block: json.block ? utils.revHex(json.block) : null,
|
||||||
height: json.height,
|
height: json.height,
|
||||||
ts: json.ts,
|
ts: json.ts,
|
||||||
relayedBy: json.relayedBy,
|
|
||||||
version: json.version,
|
version: json.version,
|
||||||
inputs: json.inputs.map(function(input) {
|
inputs: json.inputs.map(function(input) {
|
||||||
return bcoin.input._fromJSON(input);
|
return bcoin.input._fromJSON(input);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user