MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / BOOST_FOREACH

Function BOOST_FOREACH

src/script/standard.cpp:73–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 // Scan templates
72 const CScript& script1 = scriptPubKey;
73 BOOST_FOREACH(const PAIRTYPE(txnouttype, CScript)& tplate, mTemplates)
74 {
75 const CScript& script2 = tplate.second;
76 vSolutionsRet.clear();
77
78 opcodetype opcode1, opcode2;
79 vector<unsigned char> vch1, vch2;
80
81 // Compare
82 CScript::const_iterator pc1 = script1.begin();
83 CScript::const_iterator pc2 = script2.begin();
84 while (true)
85 {
86 if (pc1 == script1.end() && pc2 == script2.end())
87 {
88 // Found a match
89 typeRet = tplate.first;
90 if (typeRet == TX_MULTISIG)
91 {
92 // Additional checks for TX_MULTISIG:
93 unsigned char m = vSolutionsRet.front()[0];
94 unsigned char n = vSolutionsRet.back()[0];
95 if (m < 1 || n < 1 || m > n || vSolutionsRet.size()-2 != n)
96 return false;
97 }
98 return true;
99 }
100 if (!script1.GetOp(pc1, opcode1, vch1))
101 break;
102 if (!script2.GetOp(pc2, opcode2, vch2))
103 break;
104
105 // Template matching opcodes:
106 if (opcode2 == OP_PUBKEYS)
107 {
108 while (vch1.size() >= 33 && vch1.size() <= 65)
109 {
110 vSolutionsRet.push_back(vch1);
111 if (!script1.GetOp(pc1, opcode1, vch1))
112 break;
113 }
114 if (!script2.GetOp(pc2, opcode2, vch2))
115 break;
116 // Normal situation is to fall through
117 // to other if/else statements
118 }
119
120 if (opcode2 == OP_PUBKEY)
121 {
122 if (vch1.size() < 33 || vch1.size() > 65)
123 break;
124 vSolutionsRet.push_back(vch1);
125 }
126 else if (opcode2 == OP_PUBKEYHASH)
127 {
128 if (vch1.size() != sizeof(uint160))
129 break;
130 vSolutionsRet.push_back(vch1);

Callers

nothing calls this directly

Calls 6

GetOpMethod · 0.80
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected