mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Merge bitcoin/bitcoin#22379: wallet: erase spkmans rather than setting to nullptr
b945a31afa
wallet: erase spkmans rather than setting to nullptr (Andrew Chow) Pull request description: 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 fixes a segmentation fault that can be reached with `test/functional/wallet_descriptors.py --descriptors` ACKs for top commit: S3RK: ACKb945a31
Tree-SHA512: 344a4cf9b1c168428750c751dcd24c52032506f20c81977fe93c4b5307ea209de72bb62a9c5284820f225b03acdc9573fceb734833d29b82f49d5a799ddcaea7
This commit is contained in:
commit
fa46e48982
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…
Add table
Reference in a new issue