parser: fix minimum block size.
This commit is contained in:
parent
2e0660f449
commit
566b2e9916
@ -195,7 +195,9 @@ Block.prototype._checkBlock = function checkBlock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First TX must be a coinbase
|
// First TX must be a coinbase
|
||||||
if (this.txs[0].inputs.length !== 1 || +this.txs[0].inputs[0].out.hash !== 0) {
|
if (!this.txs.length
|
||||||
|
|| this.txs[0].inputs.length !== 1
|
||||||
|
|| +this.txs[0].inputs[0].out.hash !== 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -215,7 +215,7 @@ Parser.prototype.parseMerkleBlock = function parseMerkleBlock(p) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Parser.prototype.parseBlock = function parseBlock(p) {
|
Parser.prototype.parseBlock = function parseBlock(p) {
|
||||||
if (p.length < 84)
|
if (p.length < 81)
|
||||||
return this._error('Invalid block size');
|
return this._error('Invalid block size');
|
||||||
|
|
||||||
var result = readIntv(p, 80);
|
var result = readIntv(p, 80);
|
||||||
@ -223,10 +223,12 @@ Parser.prototype.parseBlock = function parseBlock(p) {
|
|||||||
var totalTX = result.r;
|
var totalTX = result.r;
|
||||||
var txs = [];
|
var txs = [];
|
||||||
|
|
||||||
for (var i = 0; i < totalTX; i++) {
|
if (p.length >= off + 10) {
|
||||||
var tx = this.parseTX(p.slice(off));
|
for (var i = 0; i < totalTX; i++) {
|
||||||
off += tx._off;
|
var tx = this.parseTX(p.slice(off));
|
||||||
txs.push(tx);
|
off += tx._off;
|
||||||
|
txs.push(tx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user