mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
wallet: erase spkmans rather than setting to nullptr
In many places in ScriptPubKeyMan managing code, we assume that the ScriptPubKeyMan being retrieved actually exists and is not a nullptr. Thus removing a ScriptPubKeyMan requires erasing the object from the map rather than setting it to a nullptr.
This commit is contained in:
parent
5a95c5179c
commit
b945a31afa
1 changed files with 2 additions and 2 deletions
|
@ -3184,7 +3184,7 @@ void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool intern
|
|||
spk_mans[type] = spk_man;
|
||||
|
||||
if (spk_mans_other[type] == spk_man) {
|
||||
spk_mans_other[type] = nullptr;
|
||||
spk_mans_other.erase(type);
|
||||
}
|
||||
|
||||
NotifyCanGetAddressesChanged();
|
||||
|
@ -3201,7 +3201,7 @@ void CWallet::DeactivateScriptPubKeyMan(uint256 id, OutputType type, bool intern
|
|||
}
|
||||
|
||||
auto& spk_mans = internal ? m_internal_spk_managers : m_external_spk_managers;
|
||||
spk_mans[type] = nullptr;
|
||||
spk_mans.erase(type);
|
||||
}
|
||||
|
||||
NotifyCanGetAddressesChanged();
|
||||
|
|
Loading…
Reference in a new issue