lib v1.4.1a: bug fix

- Fixed: bitjs.btrx.decodeRedeemScript not throwing Invalid RedeemScript error
This commit is contained in:
sairajzero 2023-02-20 05:20:04 +05:30
parent a102f5225b
commit 9132d169d2

4
lib.js
View File

@ -1,4 +1,4 @@
(function (GLOBAL) { //lib v1.4.1 (function (GLOBAL) { //lib v1.4.1a
'use strict'; 'use strict';
/* Utility Libraries required for Standard operations /* Utility Libraries required for Standard operations
* All credits for these codes belong to their respective creators, moderators and owners. * All credits for these codes belong to their respective creators, moderators and owners.
@ -4834,6 +4834,8 @@
if (typeof rs == "string") if (typeof rs == "string")
rs = Crypto.util.hexToBytes(rs); rs = Crypto.util.hexToBytes(rs);
var script = this.parseScript(rs); var script = this.parseScript(rs);
if (!(script[0] > 80 && script[script.length - 2] > 80 && script[script.length - 1] == 174)) //OP_CHECKMULTISIG
throw "Invalid RedeemScript";
var r = {}; var r = {};
r.required = script[0] - 80; r.required = script[0] - 80;
r.pubkeys = []; r.pubkeys = [];