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

Method SetupDescriptor

src/wallet/external_signer_scriptpubkeyman.cpp:17–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16namespace wallet {
17bool ExternalSignerScriptPubKeyMan::SetupDescriptor(std::unique_ptr<Descriptor> desc)
18{
19 LOCK(cs_desc_man);
20 assert(m_storage.IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
21 assert(m_storage.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER));
22
23 int64_t creation_time = GetTime();
24
25 // Make the descriptor
26 WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0);
27 m_wallet_descriptor = w_desc;
28
29 // Store the descriptor
30 WalletBatch batch(m_storage.GetDatabase());
31 if (!batch.WriteDescriptor(GetID(), m_wallet_descriptor)) {
32 throw std::runtime_error(std::string(__func__) + ": writing descriptor failed");
33 }
34
35 // TopUp
36 TopUp();
37
38 m_storage.UnsetBlankWalletFlag(batch);
39 return true;
40}
41
42ExternalSigner ExternalSignerScriptPubKeyMan::GetExternalSigner() {
43 const std::string command = gArgs.GetArg("-signer", "");

Callers 1

Calls 4

GetTimeFunction · 0.85
IsWalletFlagSetMethod · 0.80
UnsetBlankWalletFlagMethod · 0.80
WriteDescriptorMethod · 0.45

Tested by

no test coverage detected