diff --git a/lib/script/script.js b/lib/script/script.js index 176efdb..24c31c9 100644 --- a/lib/script/script.js +++ b/lib/script/script.js @@ -228,7 +228,21 @@ Script.prototype._chunkToString = function(chunk, type) { if (!chunk.buf) { // no data chunk if (typeof Opcode.reverseMap[opcodenum] !== 'undefined') { - str = str + ' ' + Opcode(opcodenum).toString(); + if (asm) { + // A few cases where the opcode name differs from reverseMap + // aside from 1 to 16 data pushes. + if (opcodenum === 0) { + // OP_0 -> 0 + str = str + ' 0'; + } else if(opcodenum === 79) { + // OP_1NEGATE -> 1 + str = str + ' -1'; + } else { + str = str + ' ' + Opcode(opcodenum).toString(); + } + } else { + str = str + ' ' + Opcode(opcodenum).toString(); + } } else { var numstr = opcodenum.toString(16); if (numstr.length % 2 !== 0) { @@ -242,7 +256,7 @@ Script.prototype._chunkToString = function(chunk, type) { } } else { // data chunk - if (opcodenum === Opcode.OP_PUSHDATA1 || + if (!asm && opcodenum === Opcode.OP_PUSHDATA1 || opcodenum === Opcode.OP_PUSHDATA2 || opcodenum === Opcode.OP_PUSHDATA4) { str = str + ' ' + Opcode(opcodenum).toString();