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) {
|
Block.prototype.toWitness = function toWitness(writer) {
|
||||||
var raw;
|
return this.toRaw(writer);
|
||||||
if (this.hasWitness()) {
|
|
||||||
raw = this.getRaw();
|
|
||||||
if (writer) {
|
|
||||||
writer.writeBytes(raw);
|
|
||||||
return writer;
|
|
||||||
}
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
return this.frameWitness(writer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -415,28 +415,14 @@ Framer.prototype.feeFilter = function feeFilter(options) {
|
|||||||
|
|
||||||
Framer.version = function version(options, writer) {
|
Framer.version = function version(options, writer) {
|
||||||
var p = new BufferWriter(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)
|
p.write32(options.version);
|
||||||
services = constants.LOCAL_SERVICES;
|
p.writeU64(options.services);
|
||||||
|
p.write64(options.ts);
|
||||||
if (local.services == null)
|
options.remote.toRaw(false, p);
|
||||||
local.services = constants.LOCAL_SERVICES;
|
options.local.toRaw(false, p);
|
||||||
|
p.writeU64(options.nonce);
|
||||||
if (!nonce)
|
p.writeVarString(options.agent, 'ascii');
|
||||||
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.height || 0);
|
p.write32(options.height || 0);
|
||||||
p.writeU8(options.relay ? 1 : 0);
|
p.writeU8(options.relay ? 1 : 0);
|
||||||
|
|
||||||
@ -642,7 +628,7 @@ Framer.tx = function _tx(tx, writer) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Framer.witnessTX = function _witnessTX(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) {
|
Framer.witnessBlock = function _witnessBlock(block, writer) {
|
||||||
return block.toWitness(writer);
|
return block.toRaw(writer);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user