MCPcopy Create free account
hub / github.com/citp/BlockSci / getScriptNestedEquivalents

Function getScriptNestedEquivalents

src/address/equiv_address.cpp:31–46  ·  view source on GitHub ↗

Returns the script-equivalent addresses from a script-hash address. Note, this only returns nested addresses of a script-hash address, not the reverse (i.e., it doesn't look up potential wrapping addresses for non-script-hash addresses) */

Source from the content-addressed store, hash-verified

29 Note, this only returns nested addresses of a script-hash address, not the reverse (i.e., it doesn't look up potential wrapping addresses for non-script-hash addresses)
30 */
31 std::vector<DedupAddress> getScriptNestedEquivalents(const DedupAddress &searchAddress, DataAccess &access) {
32 std::vector<DedupAddress> nestedAddressed;
33 auto address = searchAddress;
34 while (address.type == DedupAddressType::SCRIPTHASH) {
35 auto scriptHash = script::ScriptHash{address.scriptNum, access};
36 auto wrapped = scriptHash.getWrappedAddress();
37 if (wrapped) {
38 nestedAddressed.emplace_back(address);
39 address = DedupAddress{wrapped->scriptNum, dedupType(wrapped->type)};
40 } else {
41 break;
42 }
43 }
44 nestedAddressed.emplace_back(address);
45 return nestedAddressed;
46 }
47
48 /**
49 Returns addresses that are equivalent (i.e., use the same public key)

Callers 1

initAddressesFunction · 0.85

Calls 1

dedupTypeFunction · 0.85

Tested by

no test coverage detected