put isBadPush in execute.

This commit is contained in:
Christopher Jeffrey 2016-04-20 09:20:45 -07:00
parent 1d8a86838d
commit 1168f55cef
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1046,6 +1046,9 @@ Script.prototype.execute = function execute(stack, flags, tx, index, version) {
for (ip = 0; ip < this.code.length; ip++) { for (ip = 0; ip < this.code.length; ip++) {
op = this.code[ip]; op = this.code[ip];
if (Script.isBadPush(op))
throw new ScriptError('BAD_OPCODE', op, ip);
if (Buffer.isBuffer(op)) { if (Buffer.isBuffer(op)) {
if (op.length > constants.script.MAX_PUSH) if (op.length > constants.script.MAX_PUSH)
throw new ScriptError('PUSH_SIZE', op, ip); throw new ScriptError('PUSH_SIZE', op, ip);
@ -1979,17 +1982,17 @@ Script.array = function(value) {
Script.prototype.removeData = function removeData(data) { Script.prototype.removeData = function removeData(data) {
var total = 0; var total = 0;
var op = data.op; var op, sig, raw, i, a, b;
var sig, raw, i, a, b;
if (!this.raw) if (!this.raw)
return this.removeDataFast(data); return this.removeDataFast(data);
// We need to reserialize // We need to reserialize
// the signature as minimaldata. // the signature as minimaldata.
op = data.op;
delete data.op; delete data.op;
sig = new Script([data]).encode(); sig = Script.encode([data]);
if (op) if (op != null)
utils.hidden(data, 'op', op); utils.hidden(data, 'op', op);
raw = this.encode(); raw = this.encode();