script: fix undefined error.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
parent
f737532e83
commit
d5f29c37b4
@ -35,12 +35,12 @@ script.decode = function decode(s) {
|
|||||||
opcodes.push(s.slice(i, i + len));
|
opcodes.push(s.slice(i, i + len));
|
||||||
i += 2 + len;
|
i += 2 + len;
|
||||||
} else if (opcode === 'pushdata2') {
|
} else if (opcode === 'pushdata2') {
|
||||||
var len = readU16(s, i);
|
var len = utils.readU16(s, i);
|
||||||
i += 2;
|
i += 2;
|
||||||
opcodes.push(s.slice(i, i + len));
|
opcodes.push(s.slice(i, i + len));
|
||||||
i += len;
|
i += len;
|
||||||
} else if (opcode === 'pushdata4') {
|
} else if (opcode === 'pushdata4') {
|
||||||
var len = readU32(s, i);
|
var len = utils.readU32(s, i);
|
||||||
i += 4;
|
i += 4;
|
||||||
opcodes.push(s.slice(i, i + len));
|
opcodes.push(s.slice(i, i + len));
|
||||||
i += len;
|
i += len;
|
||||||
|
|||||||
@ -134,6 +134,12 @@ utils.dsha256 = function dsha256(data, enc) {
|
|||||||
return utils.sha256(utils.sha256(data, enc));
|
return utils.sha256(utils.sha256(data, enc));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
utils.readU16 = function readU16(arr, off) {
|
||||||
|
if (!off)
|
||||||
|
off = 0;
|
||||||
|
return arr[off] | (arr[off + 1] << 8);
|
||||||
|
};
|
||||||
|
|
||||||
utils.readU32 = function readU32(arr, off) {
|
utils.readU32 = function readU32(arr, off) {
|
||||||
if (!off)
|
if (!off)
|
||||||
off = 0;
|
off = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user