MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / ExtractDestinations

Function ExtractDestinations

src/script/standard.cpp:212–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet)
213{
214 addressRet.clear();
215 typeRet = TX_NONSTANDARD;
216 std::vector<valtype> vSolutions;
217 if (!Solver(scriptPubKey, typeRet, vSolutions))
218 return false;
219 if (typeRet == TX_NULL_DATA){
220 // This is data, not addresses
221 return false;
222 }
223
224 if (typeRet == TX_MULTISIG)
225 {
226 nRequiredRet = vSolutions.front()[0];
227 for (unsigned int i = 1; i < vSolutions.size()-1; i++)
228 {
229 CPubKey pubKey(vSolutions[i]);
230 if (!pubKey.IsValid())
231 continue;
232
233 CTxDestination address = pubKey.GetID();
234 addressRet.push_back(address);
235 }
236
237 if (addressRet.empty())
238 return false;
239 }
240 else
241 {
242 nRequiredRet = 1;
243 CTxDestination address;
244 if (!ExtractDestination(scriptPubKey, address))
245 return false;
246 addressRet.push_back(address);
247 }
248
249 return true;
250}
251
252namespace
253{

Callers 3

ScriptPubKeyToUnivFunction · 0.85
ProcessMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 8

SolverFunction · 0.85
ExtractDestinationFunction · 0.85
GetIDMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
IsValidMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68