MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / ExtractDestination

Function ExtractDestination

src/script/standard.cpp:158–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158bool ExtractDestination(const CScript &scriptPubKey,
159 CTxDestination &addressRet) {
160 std::vector<valtype> vSolutions;
161 TxoutType whichType = Solver(scriptPubKey, vSolutions);
162
163 if (whichType == TxoutType::PUBKEY) {
164 CPubKey pubKey(vSolutions[0]);
165 if (!pubKey.IsValid()) {
166 return false;
167 }
168
169 addressRet = PKHash(pubKey);
170 return true;
171 }
172 if (whichType == TxoutType::PUBKEYHASH) {
173 addressRet = PKHash(uint160(vSolutions[0]));
174 return true;
175 }
176 if (whichType == TxoutType::SCRIPTHASH) {
177 addressRet = ScriptHash(uint160(vSolutions[0]));
178 return true;
179 }
180 // Multisig txns have more than one address...
181 return false;
182}
183
184bool ExtractDestinations(const CScript &scriptPubKey, TxoutType &typeRet,
185 std::vector<CTxDestination> &addressRet,

Callers 15

ScriptToUnivFunction · 0.85
CheckMinerFundFunction · 0.85
rpcwallet.cppFile · 0.85
listunspentFunction · 0.85
ProcessSubScriptMethod · 0.85
GetNewDestinationMethod · 0.85
ListCoinsFunction · 0.85
SetSpentKeyStateMethod · 0.85
IsSpentKeyMethod · 0.85
ImportScriptPubKeysMethod · 0.85
MarkDestinationsDirtyMethod · 0.85
AddWalletDescriptorMethod · 0.85

Calls 5

SolverFunction · 0.85
PKHashClass · 0.85
ScriptHashClass · 0.85
uint160Class · 0.50
IsValidMethod · 0.45

Tested by 4

BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68
paymentServerTestsMethod · 0.68