Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/scriptpubkeyman.cpp
Show First 20 Lines • Show All 1,648 Lines • ▼ Show 20 Lines | bool DescriptorScriptPubKeyMan::GetReservedDestination(const OutputType type, | ||||
LOCK(cs_desc_man); | LOCK(cs_desc_man); | ||||
std::string error; | std::string error; | ||||
bool result = GetNewDestination(type, address, error); | bool result = GetNewDestination(type, address, error); | ||||
index = m_wallet_descriptor.next_index - 1; | index = m_wallet_descriptor.next_index - 1; | ||||
return result; | return result; | ||||
} | } | ||||
void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, | void DescriptorScriptPubKeyMan::ReturnDestination(int64_t index, bool internal, | ||||
const CTxDestination &addr) {} | const CTxDestination &addr) { | ||||
LOCK(cs_desc_man); | |||||
// Only return when the index was the most recent | |||||
if (m_wallet_descriptor.next_index - 1 == index) { | |||||
m_wallet_descriptor.next_index--; | |||||
} | |||||
WalletBatch(m_storage.GetDatabase()) | |||||
.WriteDescriptor(GetID(), m_wallet_descriptor); | |||||
NotifyCanGetAddressesChanged(); | |||||
} | |||||
std::map<CKeyID, CKey> DescriptorScriptPubKeyMan::GetKeys() const { | std::map<CKeyID, CKey> DescriptorScriptPubKeyMan::GetKeys() const { | ||||
AssertLockHeld(cs_desc_man); | AssertLockHeld(cs_desc_man); | ||||
if (m_storage.HasEncryptionKeys() && !m_storage.IsLocked()) { | if (m_storage.HasEncryptionKeys() && !m_storage.IsLocked()) { | ||||
KeyMap keys; | KeyMap keys; | ||||
for (auto key_pair : m_map_crypted_keys) { | for (auto key_pair : m_map_crypted_keys) { | ||||
const CPubKey &pubkey = key_pair.second.first; | const CPubKey &pubkey = key_pair.second.first; | ||||
const std::vector<uint8_t> &crypted_secret = key_pair.second.second; | const std::vector<uint8_t> &crypted_secret = key_pair.second.second; | ||||
▲ Show 20 Lines • Show All 355 Lines • Show Last 20 Lines |