use keyPair() in script.verify. whitespace.

This commit is contained in:
Christopher Jeffrey 2015-12-19 15:17:30 -08:00
parent a18a501c37
commit 2e7892c798

View File

@ -183,7 +183,7 @@ script.verify = function verify(hash, sig, pub) {
var k; var k;
try { try {
k = bcoin.ecdsa.keyFromPublic(pub); k = bcoin.ecdsa.keyPair({ pub: pub });
} catch (e) { } catch (e) {
return false; return false;
} }
@ -774,7 +774,7 @@ script.execute = function execute(s, stack, tx, index, recurse) {
threshold = constants.locktimeThreshold; threshold = constants.locktimeThreshold;
if (!( if (!(
(tx.lock < threshold && lock < threshold) (tx.lock < threshold && lock < threshold)
|| (tx.lock >= threshold && lock >= threshold) || (tx.lock >= threshold && lock >= threshold)
)) { )) {
return false; return false;
@ -799,6 +799,7 @@ script.execute = function execute(s, stack, tx, index, recurse) {
return false; return false;
evalScript = stack.pop(); evalScript = stack.pop();
if (!Array.isArray(evalScript)) if (!Array.isArray(evalScript))
return false; return false;
@ -1128,6 +1129,9 @@ script.isScripthashInput = function isScripthashInput(s, redeem) {
script.isValidSig = function(sig) { script.isValidSig = function(sig) {
var lenR, lenS; var lenR, lenS;
if (!Array.isArray(sig))
return false;
// Empty signature. Not strictly DER encoded, but allowed to provide a // Empty signature. Not strictly DER encoded, but allowed to provide a
// compact way to provide an invalid signature for use with CHECK(MULTI)SIG // compact way to provide an invalid signature for use with CHECK(MULTI)SIG
if (sig.length === 0) if (sig.length === 0)