handle op_1negate.
This commit is contained in:
parent
79a594716a
commit
2fd1d171f2
@ -57,7 +57,7 @@ exports.opcodes = {
|
||||
pushdata1: 0x4c,
|
||||
pushdata2: 0x4d,
|
||||
pushdata4: 0x4e,
|
||||
negate1: 0x4f,
|
||||
// negate1: 0x4f,
|
||||
|
||||
nop1: 0x61,
|
||||
if_: 0x63,
|
||||
@ -141,18 +141,13 @@ exports.opcodes = {
|
||||
checklocktimeverify: 0xb1
|
||||
};
|
||||
|
||||
exports.opcodes['-1'] = 0x50 + -1;
|
||||
for (var i = 1; i <= 16; i++)
|
||||
exports.opcodes[i] = 0x50 + i;
|
||||
|
||||
for (var i = 0; i <= 7; i++)
|
||||
exports.opcodes['nop' + (i + 3)] = 0xb2 + i;
|
||||
|
||||
// exports.opcodes['false'] = exports.opcodes['0'];
|
||||
// exports.opcodes['true'] = exports.opcodes['1'];
|
||||
|
||||
// exports.opcodes['if'] = exports.opcodes.if_;
|
||||
// exports.opcodes['else'] = exports.opcodes.else_;
|
||||
|
||||
exports.opcodesByVal = new Array(256);
|
||||
Object.keys(exports.opcodes).forEach(function(name) {
|
||||
exports.opcodesByVal[exports.opcodes[name]] = name;
|
||||
|
||||
@ -25,8 +25,8 @@ script.decode = function decode(s) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Raw number
|
||||
if (b >= 0x51 && b <= 0x60) {
|
||||
// Raw number (-1 and 1-16)
|
||||
if (b === 0x4f || (b >= 0x51 && b <= 0x60)) {
|
||||
opcodes.push(b - 0x50);
|
||||
continue;
|
||||
}
|
||||
@ -170,7 +170,7 @@ script.execute = function execute(s, stack, tx, index) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof o === 'number' && o >= 1 && o <= 16) {
|
||||
if (o === -1 || (o >= 1 && o <= 16)) {
|
||||
stack.push([o]);
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user