diff --git a/package.json b/package.json index b64098f..a499bec 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ }, "dependencies": { "bigi": "^1.4.0", - "bip66": "^1.0.8", + "bip66": "^1.1.0", "bs58check": "^1.0.5", "create-hash": "^1.1.0", "create-hmac": "^1.1.3", diff --git a/src/script.js b/src/script.js index ffd4f14..783c5da 100644 --- a/src/script.js +++ b/src/script.js @@ -1,8 +1,8 @@ +var bip66 = require('bip66') var bufferutils = require('./bufferutils') var typeforce = require('typeforce') var types = require('./types') -var ECSignature = require('./ecsignature') var ecurve = require('ecurve') var curve = ecurve.getCurveByName('secp256k1') @@ -135,17 +135,7 @@ function isCanonicalPubKey (buffer) { function isCanonicalSignature (buffer) { if (!Buffer.isBuffer(buffer)) return false - try { - ECSignature.parseScriptSignature(buffer) - } catch (e) { - if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) { - throw e - } - - return false - } - - return true + return bip66.check(buffer.slice(0, -1)) } function isPubKeyHashInput (script) {