diff --git a/src/payments/p2wpkh.js b/src/payments/p2wpkh.js index bd010f7..b11a0bb 100644 --- a/src/payments/p2wpkh.js +++ b/src/payments/p2wpkh.js @@ -118,9 +118,9 @@ function p2wpkh (a, opts) { } if (a.witness) { - if (a.witness.length !== 2) throw new TypeError('Input is invalid') - if (!bscript.isCanonicalScriptSignature(a.witness[0])) throw new TypeError('Input has invalid signature') - if (!ecc.isPoint(a.witness[1])) throw new TypeError('Input has invalid pubkey') + if (a.witness.length !== 2) throw new TypeError('Witness is invalid') + if (!bscript.isCanonicalScriptSignature(a.witness[0])) throw new TypeError('Witness has invalid signature') + if (!ecc.isPoint(a.witness[1])) throw new TypeError('Witness has invalid pubkey') if (a.signature && !a.signature.equals(a.witness[0])) throw new TypeError('Signature mismatch') if (a.pubkey && !a.pubkey.equals(a.witness[1])) throw new TypeError('Pubkey mismatch') diff --git a/test/fixtures/p2wpkh.json b/test/fixtures/p2wpkh.json index 84e0c08..3a53525 100644 --- a/test/fixtures/p2wpkh.json +++ b/test/fixtures/p2wpkh.json @@ -148,7 +148,13 @@ } }, { - "exception": "Input has invalid signature", + "exception": "Witness is invalid", + "arguments": { + "witness": [] + } + }, + { + "exception": "Witness has invalid signature", "arguments": { "witness": [ "ffffffffffffffffff", @@ -157,7 +163,7 @@ } }, { - "exception": "Input has invalid pubkey", + "exception": "Witness has invalid pubkey", "arguments": { "witness": [ "300602010002010001",