MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetNewDestination

Method GetNewDestination

src/wallet/scriptpubkeyman.cpp:24–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000;
23
24bool LegacyScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, bilingual_str& error)
25{
26 if (LEGACY_OUTPUT_TYPES.count(type) == 0) {
27 error = _("Error: Legacy wallets only support the \"legacy\", \"p2sh-segwit\", and \"bech32\" address types");
28 return false;
29 }
30 assert(type != OutputType::BECH32M);
31
32 LOCK(cs_KeyStore);
33 error.clear();
34
35 // Generate a new key that is added to wallet
36 CPubKey new_key;
37 if (!GetKeyFromPool(new_key, type)) {
38 error = _("Error: Keypool ran out, please call keypoolrefill first");
39 return false;
40 }
41 LearnRelatedScripts(new_key, type);
42 dest = GetDestinationForKey(new_key, type);
43
44 return true;
45}
46
47typedef std::vector<unsigned char> valtype;
48

Callers

nothing calls this directly

Calls 10

_Function · 0.85
GetDestinationForKeyFunction · 0.85
ExtractDestinationFunction · 0.85
WalletBatchClass · 0.85
countMethod · 0.80
ExpandFromCacheMethod · 0.80
clearMethod · 0.45
IsSingleTypeMethod · 0.45
GetOutputTypeMethod · 0.45
WriteDescriptorMethod · 0.45

Tested by

no test coverage detected