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
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -215,7 +215,7 @@ Parser.prototype.parseMerkleBlock = function parseMerkleBlock(p) {
|
||||
};
|
||||
|
||||
Parser.prototype.parseBlock = function parseBlock(p) {
|
||||
if (p.length < 84)
|
||||
if (p.length < 81)
|
||||
return this._error('Invalid block size');
|
||||
|
||||
var result = readIntv(p, 80);
|
||||
@ -223,10 +223,12 @@ Parser.prototype.parseBlock = function parseBlock(p) {
|
||||
var totalTX = result.r;
|
||||
var txs = [];
|
||||
|
||||
for (var i = 0; i < totalTX; i++) {
|
||||
var tx = this.parseTX(p.slice(off));
|
||||
off += tx._off;
|
||||
txs.push(tx);
|
||||
if (p.length >= off + 10) {
|
||||
for (var i = 0; i < totalTX; i++) {
|
||||
var tx = this.parseTX(p.slice(off));
|
||||
off += tx._off;
|
||||
txs.push(tx);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user