parse errors.
This commit is contained in:
parent
d605af7ed8
commit
26d3003a9d
@ -850,9 +850,8 @@ Parser.parseBlockCompact = function parseBlockCompact(p) {
|
|||||||
inCount = p.readVarint();
|
inCount = p.readVarint();
|
||||||
|
|
||||||
if (inCount === 0) {
|
if (inCount === 0) {
|
||||||
if (p.readU8() === 0)
|
if (p.readU8() !== 0)
|
||||||
throw new Error('Invalid witness tx (flag == 0)');
|
inCount = p.readVarint();
|
||||||
inCount = p.readVarint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inCount > 0)
|
if (inCount > 0)
|
||||||
@ -1055,12 +1054,11 @@ Parser.parseWitnessTX = function parseWitnessTX(p) {
|
|||||||
|
|
||||||
version = p.readU32(); // Technically signed
|
version = p.readU32(); // Technically signed
|
||||||
marker = p.readU8();
|
marker = p.readU8();
|
||||||
|
flag = p.readU8();
|
||||||
|
|
||||||
if (marker !== 0)
|
if (marker !== 0)
|
||||||
throw new Error('Invalid witness tx (marker != 0)');
|
throw new Error('Invalid witness tx (marker != 0)');
|
||||||
|
|
||||||
flag = p.readU8();
|
|
||||||
|
|
||||||
if (flag === 0)
|
if (flag === 0)
|
||||||
throw new Error('Invalid witness tx (flag == 0)');
|
throw new Error('Invalid witness tx (flag == 0)');
|
||||||
|
|
||||||
@ -1085,7 +1083,8 @@ Parser.parseWitnessTX = function parseWitnessTX(p) {
|
|||||||
hasWitness = true;
|
hasWitness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(hasWitness, 'Serialized wtx has an empty witness.');
|
if (!hasWitness)
|
||||||
|
throw new Error('Witness tx has an empty witness.');
|
||||||
|
|
||||||
witnessSize = p.end() + 2;
|
witnessSize = p.end() + 2;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user