mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
spkm: Remove DescriptorSPKM constructor that doesn't take a descriptor
Instead of creating a DescriptorSPKM that doesn't have a descriptor, only to then generate the descriptor, combine SetupDescriptorGeneration into the GenerateNewSingleSig factory function, and within that function, generate the descriptor first before constructing the new DescriptorSPKM.
This commit is contained in:
@@ -28,17 +28,16 @@ std::unique_ptr<ExternalSignerScriptPubKeyMan> ExternalSignerScriptPubKeyMan::Lo
|
||||
|
||||
std::unique_ptr<ExternalSignerScriptPubKeyMan> ExternalSignerScriptPubKeyMan::CreateNew(WalletStorage& storage, WalletBatch& batch, int64_t keypool_size, std::unique_ptr<Descriptor> desc)
|
||||
{
|
||||
auto spkm = std::unique_ptr<ExternalSignerScriptPubKeyMan>(new ExternalSignerScriptPubKeyMan(storage, keypool_size));
|
||||
|
||||
LOCK(spkm->cs_desc_man);
|
||||
assert(storage.IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
|
||||
assert(storage.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER));
|
||||
|
||||
int64_t creation_time = GetTime();
|
||||
|
||||
// Make the descriptor
|
||||
WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0);
|
||||
spkm->m_wallet_descriptor = w_desc;
|
||||
|
||||
auto spkm = std::unique_ptr<ExternalSignerScriptPubKeyMan>(new ExternalSignerScriptPubKeyMan(storage, w_desc, keypool_size));
|
||||
|
||||
LOCK(spkm->cs_desc_man);
|
||||
assert(storage.IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
|
||||
assert(storage.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER));
|
||||
|
||||
// Store the descriptor
|
||||
if (!batch.WriteDescriptor(spkm->GetID(), spkm->m_wallet_descriptor)) {
|
||||
|
||||
Reference in New Issue
Block a user