diff --git a/lib/bcoin/block.js b/lib/bcoin/block.js index 1cdb0539..bbc2604f 100644 --- a/lib/bcoin/block.js +++ b/lib/bcoin/block.js @@ -114,16 +114,7 @@ Block.prototype.toNormal = function toNormal(writer) { */ Block.prototype.toWitness = function toWitness(writer) { - var raw; - if (this.hasWitness()) { - raw = this.getRaw(); - if (writer) { - writer.writeBytes(raw); - return writer; - } - return raw; - } - return this.frameWitness(writer); + return this.toRaw(writer); }; /** diff --git a/lib/bcoin/protocol/framer.js b/lib/bcoin/protocol/framer.js index 59fbcfd7..3e91e6e5 100644 --- a/lib/bcoin/protocol/framer.js +++ b/lib/bcoin/protocol/framer.js @@ -415,28 +415,14 @@ Framer.prototype.feeFilter = function feeFilter(options) { Framer.version = function version(options, writer) { var p = new BufferWriter(writer); - var agent = options.agent || constants.USER_AGENT; - var services = options.services; - var remote = options.remote || new bcoin.networkaddress(); - var local = options.local || new bcoin.networkaddress(); - var nonce = options.nonce; - if (services == null) - services = constants.LOCAL_SERVICES; - - if (local.services == null) - local.services = constants.LOCAL_SERVICES; - - if (!nonce) - nonce = utils.nonce(); - - p.write32(options.version || constants.VERSION); - p.writeU64(services); - p.write64(options.ts || bcoin.now()); - remote.toRaw(false, p); - local.toRaw(false, p); - p.writeU64(nonce); - p.writeVarString(agent, 'ascii'); + p.write32(options.version); + p.writeU64(options.services); + p.write64(options.ts); + options.remote.toRaw(false, p); + options.local.toRaw(false, p); + p.writeU64(options.nonce); + p.writeVarString(options.agent, 'ascii'); p.write32(options.height || 0); p.writeU8(options.relay ? 1 : 0); @@ -642,7 +628,7 @@ Framer.tx = function _tx(tx, writer) { */ Framer.witnessTX = function _witnessTX(tx, writer) { - return tx.toWitness(writer); + return tx.toRaw(writer); }; /** @@ -665,7 +651,7 @@ Framer.block = function _block(block, writer) { */ Framer.witnessBlock = function _witnessBlock(block, writer) { - return block.toWitness(writer); + return block.toRaw(writer); }; /**