script: use ecc.isPoint for canonical public keys
This commit is contained in:
parent
d7eb6c8e77
commit
726e4c53b6
1 changed files with 2 additions and 12 deletions
|
@ -1,5 +1,6 @@
|
|||
var Buffer = require('safe-buffer').Buffer
|
||||
var bip66 = require('bip66')
|
||||
let ecc = require('tiny-secp256k1')
|
||||
var pushdata = require('pushdata-bitcoin')
|
||||
var typeforce = require('typeforce')
|
||||
var types = require('./types')
|
||||
|
@ -170,18 +171,7 @@ function toStack (chunks) {
|
|||
}
|
||||
|
||||
function isCanonicalPubKey (buffer) {
|
||||
if (!Buffer.isBuffer(buffer)) return false
|
||||
if (buffer.length < 33) return false
|
||||
|
||||
switch (buffer[0]) {
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
return buffer.length === 33
|
||||
case 0x04:
|
||||
return buffer.length === 65
|
||||
}
|
||||
|
||||
return false
|
||||
return ecc.isPoint(buffer)
|
||||
}
|
||||
|
||||
function isDefinedHashType (hashType) {
|
||||
|
|
Loading…
Reference in a new issue