File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -134,10 +134,18 @@ function isCanonicalPubKey (buffer) {
134134
135135function isCanonicalSignature ( buffer ) {
136136 if ( ! Buffer . isBuffer ( buffer ) ) return false
137+ if ( ! isDefinedHashType ( buffer [ buffer . length - 1 ] ) ) return false
137138
138139 return bip66 . check ( buffer . slice ( 0 , - 1 ) )
139140}
140141
142+ function isDefinedHashType ( hashType ) {
143+ var hashTypeMod = hashType & ~ 0x80
144+
145+ // return hashTypeMod > SIGHASH_ALL && hashTypeMod < SIGHASH_SINGLE
146+ return hashTypeMod > 0x00 && hashTypeMod < 0x04
147+ }
148+
141149function isPubKeyHashInput ( script ) {
142150 var chunks = decompile ( script )
143151
@@ -369,6 +377,7 @@ module.exports = {
369377
370378 isCanonicalPubKey : isCanonicalPubKey ,
371379 isCanonicalSignature : isCanonicalSignature ,
380+ isDefinedHashType : isDefinedHashType ,
372381 isPubKeyHashInput : isPubKeyHashInput ,
373382 isPubKeyHashOutput : isPubKeyHashOutput ,
374383 isPubKeyInput : isPubKeyInput ,
You can’t perform that action at this time.
0 commit comments