mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
wallet: maintain SPK consistency on internal flag change
This commit is contained in:
parent
f1b7db1474
commit
586f1d53d6
1 changed files with 9 additions and 0 deletions
|
@ -3153,12 +3153,21 @@ void CWallet::AddActiveScriptPubKeyMan(uint256 id, OutputType type, bool interna
|
|||
|
||||
void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool internal)
|
||||
{
|
||||
// Activating ScriptPubKeyManager for a given output and change type is incompatible with legacy wallets.
|
||||
// Legacy wallets have only one ScriptPubKeyManager and it's active for all output and change types.
|
||||
Assert(IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
|
||||
|
||||
WalletLogPrintf("Setting spkMan to active: id = %s, type = %d, internal = %d\n", id.ToString(), static_cast<int>(type), static_cast<int>(internal));
|
||||
auto& spk_mans = internal ? m_internal_spk_managers : m_external_spk_managers;
|
||||
auto& spk_mans_other = internal ? m_external_spk_managers : m_internal_spk_managers;
|
||||
auto spk_man = m_spk_managers.at(id).get();
|
||||
spk_man->SetInternal(internal);
|
||||
spk_mans[type] = spk_man;
|
||||
|
||||
if (spk_mans_other[type] == spk_man) {
|
||||
spk_mans_other[type] = nullptr;
|
||||
}
|
||||
|
||||
NotifyCanGetAddressesChanged();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue