MCPcopy Create free account
hub / github.com/LUX-Core/lux / ExtractDestinations

Function ExtractDestinations

src/script/standard.cpp:363–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, vector<CTxDestination>& addressRet, int& nRequiredRet)
364{
365 addressRet.clear();
366 typeRet = TX_NONSTANDARD;
367 vector<valtype> vSolutions;
368 if (!Solver(scriptPubKey, typeRet, vSolutions))
369 return false;
370 if (typeRet == TX_NULL_DATA) {
371 // This is data, not addresses
372 return false;
373 }
374
375 if (typeRet == TX_MULTISIG) {
376 nRequiredRet = vSolutions.front()[0];
377 for (unsigned int i = 1; i < vSolutions.size()-1; i++) {
378 CPubKey pubKey(vSolutions[i]);
379 if (!pubKey.IsValid())
380 continue;
381
382 CTxDestination address = pubKey.GetID();
383 addressRet.push_back(address);
384 }
385
386 if (addressRet.empty())
387 return false;
388 } else {
389 nRequiredRet = 1;
390 CTxDestination address;
391 if (!ExtractDestination(scriptPubKey, address))
392 return false;
393 addressRet.push_back(address);
394 }
395
396 return true;
397}
398
399namespace
400{

Callers 4

ScriptPubKeyToUnivFunction · 0.85
ProcessMethod · 0.85
ScriptPubKeyToJSONFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 8

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

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68