From 2e7892c79849742869dbe548acfcaefe61b17d50 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 19 Dec 2015 15:17:30 -0800 Subject: [PATCH] use keyPair() in script.verify. whitespace. --- lib/bcoin/script.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bcoin/script.js b/lib/bcoin/script.js index 8162ccae..399ce241 100644 --- a/lib/bcoin/script.js +++ b/lib/bcoin/script.js @@ -183,7 +183,7 @@ script.verify = function verify(hash, sig, pub) { var k; try { - k = bcoin.ecdsa.keyFromPublic(pub); + k = bcoin.ecdsa.keyPair({ pub: pub }); } catch (e) { return false; } @@ -774,7 +774,7 @@ script.execute = function execute(s, stack, tx, index, recurse) { threshold = constants.locktimeThreshold; if (!( - (tx.lock < threshold && lock < threshold) + (tx.lock < threshold && lock < threshold) || (tx.lock >= threshold && lock >= threshold) )) { return false; @@ -799,6 +799,7 @@ script.execute = function execute(s, stack, tx, index, recurse) { return false; evalScript = stack.pop(); + if (!Array.isArray(evalScript)) return false; @@ -1128,6 +1129,9 @@ script.isScripthashInput = function isScripthashInput(s, redeem) { script.isValidSig = function(sig) { var lenR, lenS; + if (!Array.isArray(sig)) + return false; + // Empty signature. Not strictly DER encoded, but allowed to provide a // compact way to provide an invalid signature for use with CHECK(MULTI)SIG if (sig.length === 0)