2016-12-14 05:52:38 +01:00
|
|
|
// {signature} {pubKey}
|
|
|
|
|
2018-06-25 08:25:12 +02:00
|
|
|
const bscript = require('../../script')
|
2017-08-22 01:15:53 +02:00
|
|
|
|
|
|
|
function isCompressedCanonicalPubKey (pubKey) {
|
|
|
|
return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33
|
|
|
|
}
|
|
|
|
|
|
|
|
function check (script) {
|
2018-06-25 08:37:45 +02:00
|
|
|
const chunks = bscript.decompile(script)
|
2017-08-22 01:15:53 +02:00
|
|
|
|
|
|
|
return chunks.length === 2 &&
|
2018-06-05 09:17:40 +02:00
|
|
|
bscript.isCanonicalScriptSignature(chunks[0]) &&
|
2017-08-22 01:15:53 +02:00
|
|
|
isCompressedCanonicalPubKey(chunks[1])
|
|
|
|
}
|
|
|
|
check.toJSON = function () { return 'witnessPubKeyHash input' }
|
|
|
|
|
2018-07-03 15:00:00 +02:00
|
|
|
module.exports = { check }
|
2018-12-26 06:25:33 +01:00
|
|
|
export {}
|