| 83 | } |
| 84 | |
| 85 | static bool MatchMultisig(const CScript& script, int& required_sigs, std::vector<valtype>& pubkeys) |
| 86 | { |
| 87 | opcodetype opcode; |
| 88 | valtype data; |
| 89 | |
| 90 | CScript::const_iterator it = script.begin(); |
| 91 | if (script.size() < 1 || script.back() != OP_CHECKMULTISIG) return false; |
| 92 | |
| 93 | if (!script.GetOp(it, opcode, data)) return false; |
| 94 | auto req_sigs = GetScriptNumber(opcode, data, 1, MAX_PUBKEYS_PER_MULTISIG); |
| 95 | if (!req_sigs) return false; |
| 96 | required_sigs = *req_sigs; |
| 97 | while (script.GetOp(it, opcode, data) && CPubKey::ValidSize(data)) { |
| 98 | pubkeys.emplace_back(std::move(data)); |
| 99 | } |
| 100 | auto num_keys = GetScriptNumber(opcode, data, required_sigs, MAX_PUBKEYS_PER_MULTISIG); |
| 101 | if (!num_keys) return false; |
| 102 | if (pubkeys.size() != static_cast<unsigned long>(*num_keys)) return false; |
| 103 | |
| 104 | return (it + 1 == script.end()); |
| 105 | } |
| 106 | |
| 107 | std::optional<std::pair<int, std::vector<std::span<const unsigned char>>>> MatchMultiA(const CScript& script) |
| 108 | { |
no test coverage detected