You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
554 B
17 lines
554 B
8 years ago
|
// {signature} {pubKey}
|
||
|
|
||
6 years ago
|
import * as bscript from '../../script'
|
||
7 years ago
|
|
||
6 years ago
|
function isCompressedCanonicalPubKey (pubKey: Buffer): boolean {
|
||
7 years ago
|
return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33
|
||
|
}
|
||
|
|
||
6 years ago
|
export function check (script: Buffer | Array<number | Buffer>): boolean {
|
||
6 years ago
|
const chunks = <Array<number | Buffer>>bscript.decompile(script)
|
||
7 years ago
|
|
||
|
return chunks.length === 2 &&
|
||
6 years ago
|
bscript.isCanonicalScriptSignature(<Buffer>chunks[0]) &&
|
||
|
isCompressedCanonicalPubKey(<Buffer>chunks[1])
|
||
7 years ago
|
}
|
||
|
check.toJSON = function () { return 'witnessPubKeyHash input' }
|