|
|
@ -879,9 +879,8 @@ ScriptInterpreter.prototype.step = function() { |
|
|
|
}); |
|
|
|
|
|
|
|
// Drop the signature, since there's no way for a signature to sign itself
|
|
|
|
console.log(subscript.toString()); |
|
|
|
subscript.findAndDelete(Script().add(bufSig)); |
|
|
|
console.log(subscript.toString()); |
|
|
|
var tmpScript = Script().add(bufSig); |
|
|
|
subscript.findAndDelete(tmpScript); |
|
|
|
|
|
|
|
if (!this.checkSignatureEncoding(bufSig) || !this.checkPubkeyEncoding(bufPubkey)) { |
|
|
|
// serror is set
|
|
|
@ -890,11 +889,12 @@ ScriptInterpreter.prototype.step = function() { |
|
|
|
|
|
|
|
var fSuccess; |
|
|
|
try { |
|
|
|
var sig = Signature().fromTxFormat(bufSig); |
|
|
|
var pubkey = PublicKey().fromBuffer(bufPubkey, false); |
|
|
|
var sig = Signature.fromTxFormat(bufSig); |
|
|
|
var pubkey = PublicKey.fromBuffer(bufPubkey, false); |
|
|
|
fSuccess = this.tx.verify(sig, pubkey, this.nin, subscript); |
|
|
|
} catch (e) { |
|
|
|
//invalid sig or pubkey
|
|
|
|
console.log('FALSEEEEEEEEEEEEEEEEee ' + e); |
|
|
|
fSuccess = false; |
|
|
|
} |
|
|
|
|
|
|
@ -980,8 +980,8 @@ ScriptInterpreter.prototype.step = function() { |
|
|
|
|
|
|
|
var fOk; |
|
|
|
try { |
|
|
|
var sig = Signature().fromTxFormat(bufSig); |
|
|
|
var pubkey = PublicKey().fromBuffer(bufPubkey, false); |
|
|
|
var sig = Signature.fromTxFormat(bufSig); |
|
|
|
var pubkey = PublicKey.fromBuffer(bufPubkey, false); |
|
|
|
fOk = this.tx.verify(sig, pubkey, this.nin, subscript); |
|
|
|
} catch (e) { |
|
|
|
//invalid sig or pubkey
|
|
|
@ -1088,13 +1088,13 @@ ScriptInterpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, |
|
|
|
return false; |
|
|
|
|
|
|
|
if (this.stack.length === 0) { |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE'; |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE_NO_RESULT'; |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
var buf = this.stack[this.stack.length - 1]; |
|
|
|
if (!ScriptInterpreter.castToBool(buf)) { |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE'; |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE_IN_STACK'; |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
@ -1131,12 +1131,12 @@ ScriptInterpreter.prototype.verify = function(scriptSig, scriptPubkey, tx, nin, |
|
|
|
return false; |
|
|
|
|
|
|
|
if (stackCopy.length === 0) { |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE'; |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK'; |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!ScriptInterpreter.castToBool(stackCopy[stackCopy.length - 1])) { |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE'; |
|
|
|
this.errstr = 'SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK'; |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
return true; |
|
|
|