* Test whether the output script is pay-to-multisig. * @param {Boolean} [minimal=false] - Minimaldata only. * @returns {Boolean}
(minimal)
| 1923 | */ |
| 1924 | |
| 1925 | isMultisig(minimal) { |
| 1926 | if (this.code.length < 4 || this.code.length > 19) |
| 1927 | return false; |
| 1928 | |
| 1929 | if (this.getOp(-1) !== opcodes.OP_CHECKMULTISIG) |
| 1930 | return false; |
| 1931 | |
| 1932 | const m = this.getSmall(0); |
| 1933 | |
| 1934 | if (m < 1) |
| 1935 | return false; |
| 1936 | |
| 1937 | const n = this.getSmall(-2); |
| 1938 | |
| 1939 | if (n < 1 || m > n) |
| 1940 | return false; |
| 1941 | |
| 1942 | if (this.code.length !== n + 3) |
| 1943 | return false; |
| 1944 | |
| 1945 | for (let i = 1; i < n + 1; i++) { |
| 1946 | const op = this.code[i]; |
| 1947 | const size = op.toLength(); |
| 1948 | |
| 1949 | if (size !== 33 && size !== 65) |
| 1950 | return false; |
| 1951 | |
| 1952 | if (minimal && !op.isMinimal()) |
| 1953 | return false; |
| 1954 | } |
| 1955 | |
| 1956 | return true; |
| 1957 | } |
| 1958 | |
| 1959 | /** |
| 1960 | * Get multisig m and n values if present. |
no test coverage detected