MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SetupDescriptorGeneration

Method SetupDescriptorGeneration

src/wallet/scriptpubkeyman.cpp:1185–1210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1183}
1184
1185void DescriptorScriptPubKeyMan::SetupDescriptorGeneration(WalletBatch& batch, const CExtKey& master_key, OutputType addr_type, bool internal)
1186{
1187 LOCK(cs_desc_man);
1188 Assert(m_storage.IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
1189 Assert(!m_wallet_descriptor.descriptor);
1190
1191 m_wallet_descriptor = GenerateWalletDescriptor(master_key.Neuter(), addr_type, internal);
1192
1193 // Store the master private key, and descriptor
1194 if (!AddDescriptorKeyWithDB(batch, master_key.key, master_key.key.GetPubKey())) {
1195 throw std::runtime_error(std::string(__func__) + ": writing descriptor master private key failed");
1196 }
1197 if (!batch.WriteDescriptor(GetID(), m_wallet_descriptor)) {
1198 throw std::runtime_error(std::string(__func__) + ": writing descriptor failed");
1199 }
1200
1201 // Set m_decryption_thoroughly_checked for encrypted wallets
1202 if (m_storage.HasEncryptionKeys()) {
1203 m_decryption_thoroughly_checked = true;
1204 }
1205
1206 // TopUp
1207 TopUpWithDB(batch);
1208
1209 m_storage.UnsetBlankWalletFlag(batch);
1210}
1211
1212bool DescriptorScriptPubKeyMan::IsHDEnabled() const
1213{

Callers 1

GenerateNewSingleSigMethod · 0.80

Calls 7

GenerateWalletDescriptorFunction · 0.85
IsWalletFlagSetMethod · 0.80
NeuterMethod · 0.80
HasEncryptionKeysMethod · 0.80
UnsetBlankWalletFlagMethod · 0.80
GetPubKeyMethod · 0.45
WriteDescriptorMethod · 0.45

Tested by

no test coverage detected