Skip to content

Commit

Permalink
descspkm: Remove unneeded key loading
Browse files Browse the repository at this point in the history
Key management will be done entirely by KeyManager, so
DescriptorScriptPubKeyMan does not need key loading functions.
  • Loading branch information
achow101 committed Nov 13, 2021
1 parent 00e9821 commit e1ac81f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
16 changes: 0 additions & 16 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2137,22 +2137,6 @@ void DescriptorScriptPubKeyMan::SetCache(const DescriptorCache& cache)
}
}

bool DescriptorScriptPubKeyMan::AddKey(const CKeyID& key_id, const CKey& key)
{
m_keyman.LoadKey(key_id, key);
m_set_stored_keys.insert(key_id);
return true;
}

bool DescriptorScriptPubKeyMan::AddCryptedKey(const CKeyID& key_id, const CPubKey& pubkey, const std::vector<unsigned char>& crypted_key)
{
if (!m_keyman.LoadCryptedKey(key_id, pubkey, crypted_key)) {
return false;
}
m_set_stored_keys.insert(key_id);
return true;
}

bool DescriptorScriptPubKeyMan::HasWalletDescriptor(const WalletDescriptor& desc) const
{
LOCK(cs_desc_man);
Expand Down
3 changes: 0 additions & 3 deletions src/wallet/scriptpubkeyman.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,6 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan

void SetCache(const DescriptorCache& cache);

bool AddKey(const CKeyID& key_id, const CKey& key);
bool AddCryptedKey(const CKeyID& key_id, const CPubKey& pubkey, const std::vector<unsigned char>& crypted_key);

bool HasWalletDescriptor(const WalletDescriptor& desc) const;
void UpdateWalletDescriptor(WalletDescriptor& descriptor);
bool CanUpdateToWalletDescriptor(const WalletDescriptor& descriptor, std::string& error);
Expand Down
10 changes: 0 additions & 10 deletions src/wallet/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1009,16 +1009,6 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
((DescriptorScriptPubKeyMan*)spk_man)->SetCache(desc_cache_pair.second);
}

// Set the descriptor keys
for (auto desc_key_pair : wss.m_descriptor_keys) {
auto spk_man = pwallet->GetScriptPubKeyMan(desc_key_pair.first.first);
((DescriptorScriptPubKeyMan*)spk_man)->AddKey(desc_key_pair.first.second, desc_key_pair.second);
}
for (auto desc_key_pair : wss.m_descriptor_crypt_keys) {
auto spk_man = pwallet->GetScriptPubKeyMan(desc_key_pair.first.first);
((DescriptorScriptPubKeyMan*)spk_man)->AddCryptedKey(desc_key_pair.first.second, desc_key_pair.second.first, desc_key_pair.second.second);
}

if (rescan_required && result == DBErrors::LOAD_OK) {
result = DBErrors::NEED_RESCAN;
} else if (fNoncriticalErrors && result == DBErrors::LOAD_OK) {
Expand Down

0 comments on commit e1ac81f

Please sign in to comment.