MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / MatchMultisig

Function MatchMultisig

src/script/solver.cpp:85–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static 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
107std::optional<std::pair<int, std::vector<std::span<const unsigned char>>>> MatchMultiA(const CScript& script)
108{

Callers 1

SolverFunction · 0.85

Calls 7

GetScriptNumberFunction · 0.85
GetOpMethod · 0.80
beginMethod · 0.45
sizeMethod · 0.45
backMethod · 0.45
emplace_backMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected