framer.
This commit is contained in:
parent
ea512ab9aa
commit
8a16cefe30
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user