more refactoring.
This commit is contained in:
parent
8cfa46f943
commit
79bc477476
@ -86,9 +86,6 @@ function ScriptError(code, op, ip) {
|
||||
this.code = code;
|
||||
|
||||
if (typeof op !== 'string') {
|
||||
if (Buffer.isBuffer(op))
|
||||
op = 'PUSHDATA[' + op.length + ']';
|
||||
|
||||
if (op || ip != null) {
|
||||
code += ' (';
|
||||
if (op) {
|
||||
|
||||
@ -1201,7 +1201,7 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
var alt = [];
|
||||
var state = [];
|
||||
var negate = 0;
|
||||
var op, val, v1, v2, v3;
|
||||
var op, code, data, val, v1, v2, v3;
|
||||
var n, n1, n2, n3;
|
||||
var res, key, sig, type, subscript, hash;
|
||||
var i, j, m, ikey, isig;
|
||||
@ -1214,26 +1214,26 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
|
||||
throw new ScriptError('SCRIPT_SIZE');
|
||||
|
||||
for (ip = 0; ip < this.code.length; ip++) {
|
||||
op = this.code[ip];
|
||||
code = this.code[ip];
|
||||
op = code.value;
|
||||
data = code.data;
|
||||
|
||||
if (op.value === -1)
|
||||
if (op === -1)
|
||||
throw new ScriptError('BAD_OPCODE', op, ip);
|
||||
|
||||
if (op.data) {
|
||||
if (op.data.length > constants.script.MAX_PUSH)
|
||||
if (data) {
|
||||
if (data.length > constants.script.MAX_PUSH)
|
||||
throw new ScriptError('PUSH_SIZE', op, ip);
|
||||
// Note that minimaldata is not checked
|
||||
// on unexecuted branches of code.
|
||||
if (negate === 0) {
|
||||
if (!Script.isMinimal(op.data, op.value, flags))
|
||||
if (!Script.isMinimal(data, op, flags))
|
||||
throw new ScriptError('MINIMALDATA', op, ip);
|
||||
stack.push(op.data);
|
||||
stack.push(data);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
op = op.value;
|
||||
|
||||
if (op > opcodes.OP_16 && ++opCount > constants.script.MAX_OPS)
|
||||
throw new ScriptError('OP_COUNT', op, ip);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user