mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-17 19:10:40 +01:00
wallet: deactivate descriptor
This commit is contained in:
@@ -3171,6 +3171,23 @@ void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool intern
|
||||
NotifyCanGetAddressesChanged();
|
||||
}
|
||||
|
||||
void CWallet::DeactivateScriptPubKeyMan(uint256 id, OutputType type, bool internal)
|
||||
{
|
||||
auto spk_man = GetScriptPubKeyMan(type, internal);
|
||||
if (spk_man != nullptr && spk_man->GetID() == id) {
|
||||
WalletLogPrintf("Deactivate spkMan: id = %s, type = %d, internal = %d\n", id.ToString(), static_cast<int>(type), static_cast<int>(internal));
|
||||
WalletBatch batch(GetDatabase());
|
||||
if (!batch.EraseActiveScriptPubKeyMan(static_cast<uint8_t>(type), internal)) {
|
||||
throw std::runtime_error(std::string(__func__) + ": erasing active ScriptPubKeyMan id failed");
|
||||
}
|
||||
|
||||
auto& spk_mans = internal ? m_internal_spk_managers : m_external_spk_managers;
|
||||
spk_mans[type] = nullptr;
|
||||
}
|
||||
|
||||
NotifyCanGetAddressesChanged();
|
||||
}
|
||||
|
||||
bool CWallet::IsLegacy() const
|
||||
{
|
||||
if (m_internal_spk_managers.count(OutputType::LEGACY) == 0) {
|
||||
|
||||
Reference in New Issue
Block a user