From 7592a6bcc2c21d7c430224670d010c0f4c500789 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Tue, 5 Jun 2018 17:17:40 +1000 Subject: [PATCH] script: rename isCanonicalSignature to isCanonicalScriptSignature --- src/script.js | 4 ++-- src/templates/multisig/input.js | 4 ++-- src/templates/pubkey/input.js | 4 ++-- src/templates/pubkeyhash/input.js | 4 ++-- src/templates/witnesspubkeyhash/input.js | 4 ++-- test/script.js | 3 ++- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/script.js b/src/script.js index 6094589..290ba00 100644 --- a/src/script.js +++ b/src/script.js @@ -181,7 +181,7 @@ function isDefinedHashType (hashType) { return hashTypeMod > 0x00 && hashTypeMod < 0x04 } -function isCanonicalSignature (buffer) { +function isCanonicalScriptSignature (buffer) { if (!Buffer.isBuffer(buffer)) return false if (!isDefinedHashType(buffer[buffer.length - 1])) return false @@ -199,7 +199,7 @@ module.exports = { signature: require('./script_signature'), isCanonicalPubKey: isCanonicalPubKey, - isCanonicalSignature: isCanonicalSignature, + isCanonicalScriptSignature: isCanonicalScriptSignature, isPushOnly: isPushOnly, isDefinedHashType: isDefinedHashType } diff --git a/src/templates/multisig/input.js b/src/templates/multisig/input.js index a0b2eee..0ba0a06 100644 --- a/src/templates/multisig/input.js +++ b/src/templates/multisig/input.js @@ -7,7 +7,7 @@ var typeforce = require('typeforce') var OPS = require('bitcoin-ops') function partialSignature (value) { - return value === OPS.OP_0 || bscript.isCanonicalSignature(value) + return value === OPS.OP_0 || bscript.isCanonicalScriptSignature(value) } function check (script, allowIncomplete) { @@ -19,7 +19,7 @@ function check (script, allowIncomplete) { return chunks.slice(1).every(partialSignature) } - return chunks.slice(1).every(bscript.isCanonicalSignature) + return chunks.slice(1).every(bscript.isCanonicalScriptSignature) } check.toJSON = function () { return 'multisig input' } diff --git a/src/templates/pubkey/input.js b/src/templates/pubkey/input.js index 4c61664..9149289 100644 --- a/src/templates/pubkey/input.js +++ b/src/templates/pubkey/input.js @@ -7,12 +7,12 @@ function check (script) { var chunks = bscript.decompile(script) return chunks.length === 1 && - bscript.isCanonicalSignature(chunks[0]) + bscript.isCanonicalScriptSignature(chunks[0]) } check.toJSON = function () { return 'pubKey input' } function encodeStack (signature) { - typeforce(bscript.isCanonicalSignature, signature) + typeforce(bscript.isCanonicalScriptSignature, signature) return [signature] } diff --git a/src/templates/pubkeyhash/input.js b/src/templates/pubkeyhash/input.js index ae1d758..81e1f80 100644 --- a/src/templates/pubkeyhash/input.js +++ b/src/templates/pubkeyhash/input.js @@ -7,14 +7,14 @@ function check (script) { var chunks = bscript.decompile(script) return chunks.length === 2 && - bscript.isCanonicalSignature(chunks[0]) && + bscript.isCanonicalScriptSignature(chunks[0]) && bscript.isCanonicalPubKey(chunks[1]) } check.toJSON = function () { return 'pubKeyHash input' } function encodeStack (signature, pubKey) { typeforce({ - signature: bscript.isCanonicalSignature, + signature: bscript.isCanonicalScriptSignature, pubKey: bscript.isCanonicalPubKey }, { signature: signature, diff --git a/src/templates/witnesspubkeyhash/input.js b/src/templates/witnesspubkeyhash/input.js index d61c426..089c8d8 100644 --- a/src/templates/witnesspubkeyhash/input.js +++ b/src/templates/witnesspubkeyhash/input.js @@ -11,14 +11,14 @@ function check (script) { var chunks = bscript.decompile(script) return chunks.length === 2 && - bscript.isCanonicalSignature(chunks[0]) && + bscript.isCanonicalScriptSignature(chunks[0]) && isCompressedCanonicalPubKey(chunks[1]) } check.toJSON = function () { return 'witnessPubKeyHash input' } function encodeStack (signature, pubKey) { typeforce({ - signature: bscript.isCanonicalSignature, + signature: bscript.isCanonicalScriptSignature, pubKey: isCompressedCanonicalPubKey }, { signature: signature, diff --git a/test/script.js b/test/script.js index 5a51dbd..537e75a 100644 --- a/test/script.js +++ b/test/script.js @@ -19,7 +19,8 @@ describe('script', function () { } }) }) - describe.skip('isCanonicalSignature', function () {}) + describe.skip('isCanonicalScriptSignature', function () { + }) describe('fromASM/toASM', function () { fixtures.valid.forEach(function (f) {