fixes.
This commit is contained in:
parent
b473ca7d18
commit
68f3ef599d
@ -127,7 +127,7 @@ Block.verify = function verify(data, subtype) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Block.prototype.render = function render() {
|
Block.prototype.render = function render() {
|
||||||
if (this.network && this._raw && this._raw.length > 80)
|
if (this.network && this._raw)
|
||||||
return this._raw;
|
return this._raw;
|
||||||
return bcoin.protocol.framer.block(this, this.subtype);
|
return bcoin.protocol.framer.block(this, this.subtype);
|
||||||
};
|
};
|
||||||
@ -561,10 +561,7 @@ Block.prototype.toRaw = function toRaw(enc) {
|
|||||||
|
|
||||||
assert(this.subtype === 'block');
|
assert(this.subtype === 'block');
|
||||||
|
|
||||||
if (this.network && this._raw && this._raw.length > 80)
|
data = new Buffer(this.render());
|
||||||
data = this._raw;
|
|
||||||
else
|
|
||||||
data = new Buffer(this.render());
|
|
||||||
|
|
||||||
if (enc === 'hex')
|
if (enc === 'hex')
|
||||||
data = utils.toHex(data);
|
data = utils.toHex(data);
|
||||||
|
|||||||
@ -231,12 +231,9 @@ Miner.prototype.createBlock = function createBlock(tx) {
|
|||||||
// miner succeeded.
|
// miner succeeded.
|
||||||
new Buffer(this.msg || 'mined by bcoin', 'ascii')
|
new Buffer(this.msg || 'mined by bcoin', 'ascii')
|
||||||
],
|
],
|
||||||
seq: 0xffffffff
|
sequence: 0xffffffff
|
||||||
});
|
});
|
||||||
|
|
||||||
if (bcoin.script.getSize(coinbase.inputs[0].script) > 100)
|
|
||||||
throw new Error('Coinbase script is too large');
|
|
||||||
|
|
||||||
coinbase.addOutput({
|
coinbase.addOutput({
|
||||||
address: this.address,
|
address: this.address,
|
||||||
value: new bn(0)
|
value: new bn(0)
|
||||||
@ -246,7 +243,7 @@ Miner.prototype.createBlock = function createBlock(tx) {
|
|||||||
headers = {
|
headers = {
|
||||||
version: 4,
|
version: 4,
|
||||||
prevBlock: this.last.hash,
|
prevBlock: this.last.hash,
|
||||||
merkleRoot: utils.toHex(constants.zeroHash.slice()),
|
merkleRoot: utils.toHex(constants.zeroHash),
|
||||||
ts: ts,
|
ts: ts,
|
||||||
bits: target,
|
bits: target,
|
||||||
nonce: 0
|
nonce: 0
|
||||||
|
|||||||
@ -262,7 +262,7 @@ Framer.prototype._getBlocks = function _getBlocks(cmd, hashes, stop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stop) {
|
if (stop) {
|
||||||
if (typeof hash === 'string')
|
if (typeof stop === 'string')
|
||||||
stop = new Buffer(stop, 'hex');
|
stop = new Buffer(stop, 'hex');
|
||||||
len = utils.copy(stop, p, off);
|
len = utils.copy(stop, p, off);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -440,7 +440,7 @@ Parser.prototype.parseCoin = function parseCoin(p, extended) {
|
|||||||
spent = utils.readU8(p, off) === 1;
|
spent = utils.readU8(p, off) === 1;
|
||||||
off += 1;
|
off += 1;
|
||||||
} else {
|
} else {
|
||||||
hash = constants.zeroHash;
|
hash = new Buffer(constants.zeroHash);
|
||||||
index = 0xffffffff;
|
index = 0xffffffff;
|
||||||
spent = false;
|
spent = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -832,7 +832,7 @@ TX.prototype.signatureHash = function signatureHash(index, s, type) {
|
|||||||
// Bitcoind used to return 1 as an error code:
|
// Bitcoind used to return 1 as an error code:
|
||||||
// it ended up being treated like a hash.
|
// it ended up being treated like a hash.
|
||||||
if (index >= copy.outputs.length)
|
if (index >= copy.outputs.length)
|
||||||
return constants.oneHash.slice();
|
return new Buffer(constants.oneHash);
|
||||||
|
|
||||||
// Drop all the outputs after the input index.
|
// Drop all the outputs after the input index.
|
||||||
copy.outputs.length = index + 1;
|
copy.outputs.length = index + 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user