| 70 | } |
| 71 | |
| 72 | static bool MatchMultisig(const CScript& script, unsigned int& required, std::vector<valtype>& pubkeys) |
| 73 | { |
| 74 | opcodetype opcode; |
| 75 | valtype data; |
| 76 | CScript::const_iterator it = script.begin(); |
| 77 | if (script.size() < 1 || script.back() != OP_CHECKMULTISIG) return false; |
| 78 | |
| 79 | if (!script.GetOp(it, opcode, data) || !IsSmallInteger(opcode)) return false; |
| 80 | required = CScript::DecodeOP_N(opcode); |
| 81 | while (script.GetOp(it, opcode, data) && CPubKey::ValidSize(data)) { |
| 82 | pubkeys.emplace_back(std::move(data)); |
| 83 | } |
| 84 | if (!IsSmallInteger(opcode)) return false; |
| 85 | unsigned int keys = CScript::DecodeOP_N(opcode); |
| 86 | if (pubkeys.size() != keys || keys < required) return false; |
| 87 | return (it + 1 == script.end()); |
| 88 | } |
| 89 | |
| 90 | bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet) |
| 91 | { |