fix witness error type.

This commit is contained in:
Christopher Jeffrey 2016-05-06 16:32:50 -07:00
parent 6a482af6d0
commit 81c8eb5f5b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -3883,8 +3883,11 @@ Script.verify = function verify(input, witness, output, tx, i, flags) {
hadWitness = true;
// Input script must be exactly one push of the redeem script.
if (!(input.code.length === 1 && utils.equal(input.code[0], raw)))
throw new ScriptError('WITNESS_MALLEATED');
if (!(input.code.length === 1
&& utils.equal(input.code[0], raw)
&& Script.checkMinimal(input.code[0]))) {
throw new ScriptError('WITNESS_MALLEATED_P2SH');
}
// Verify the program in the redeem script
Script.verifyProgram(witness, redeem, flags, tx, i);