From 173994c6e0034f3218cf86769d3d6c68264e7112 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 2 Oct 2015 13:02:03 +1000 Subject: [PATCH] script: avoid slice if n !== pubKeys.length --- src/script.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/script.js b/src/script.js index 69ce147..2004fa1 100644 --- a/src/script.js +++ b/src/script.js @@ -242,11 +242,9 @@ function isMultisigOutput (script) { if (m <= 0) return false if (m > n) return false if (n > 16) return false + if (n !== chunks.length - 3) return false - var pubKeys = chunks.slice(1, -2) - if (n !== pubKeys.length) return false - - return pubKeys.every(isCanonicalPubKey) + return chunks.slice(1, -2).every(isCanonicalPubKey) } function isNullDataOutput (script) {